Document.IsEncrypted

IsEncrypted(Stream, LoadOptions, out Document)

Kontrollerar om ett dokument från en ström är krypterat. För att kontrollera det måste vi ladda det här dokumentet helt. Så den här metoden kan leda till prestationsstraff.

public static bool IsEncrypted(Stream stream, LoadOptions options, out Document document)
ParameterTypBeskrivning
streamStreamStrömmen.
optionsLoadOptionsInläsningsalternativen.
documentDocument&Det laddade dokumentet.

Returvärde

Returnerar sant om dokumentet är krypterat annars falskt.

Exempel

Visar hur man kontrollerar om ett dokument är lösenordsskyddat.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (!Document.IsEncrypted(fileName, out document))
{
    Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
    Console.WriteLine("The document is encrypted. Provide a password.");
}

Visar hur man kontrollerar om ett dokument är lösenordsskyddat med ett specifikt lösenord.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
    if (document != null)
    {
        Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
    }
    else
    {
        Console.WriteLine("The document is encrypted. Invalid password was provided.");
    }
}
else
{
    Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}

Se även


IsEncrypted(Stream, string, out Document)

Kontrollerar om ett dokument från en ström är krypterat. För att kontrollera det måste vi ladda det här dokumentet helt. Så den här metoden kan leda till prestationsstraff.

public static bool IsEncrypted(Stream stream, string password, out Document document)
ParameterTypBeskrivning
streamStreamStrömmen.
passwordStringLösenordet för att dekryptera ett dokument.
documentDocument&Det laddade dokumentet.

Returvärde

Returnerar sant om dokumentet är krypterat annars falskt.

Exempel

Visar hur man kontrollerar om ett dokument är lösenordsskyddat.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (!Document.IsEncrypted(fileName, out document))
{
    Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
    Console.WriteLine("The document is encrypted. Provide a password.");
}

Visar hur man kontrollerar om ett dokument är lösenordsskyddat med ett specifikt lösenord.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
    if (document != null)
    {
        Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
    }
    else
    {
        Console.WriteLine("The document is encrypted. Invalid password was provided.");
    }
}
else
{
    Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}

Se även


IsEncrypted(Stream, out Document)

Kontrollerar om ett dokument från en ström är krypterat. För att kontrollera det måste vi ladda det här dokumentet helt. Så den här metoden kan leda till prestationsstraff.

public static bool IsEncrypted(Stream stream, out Document document)
ParameterTypBeskrivning
streamStreamStrömmen.
documentDocument&Det laddade dokumentet.

Returvärde

Returnerar sant om dokumentet är krypterat annars falskt.

Exempel

Visar hur man kontrollerar om ett dokument är lösenordsskyddat.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (!Document.IsEncrypted(fileName, out document))
{
    Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
    Console.WriteLine("The document is encrypted. Provide a password.");
}

Visar hur man kontrollerar om ett dokument är lösenordsskyddat med ett specifikt lösenord.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
    if (document != null)
    {
        Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
    }
    else
    {
        Console.WriteLine("The document is encrypted. Invalid password was provided.");
    }
}
else
{
    Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}

Se även


IsEncrypted(string, LoadOptions, out Document)

Kontrollerar om ett dokument från en fil är krypterat. För att kontrollera det måste vi ladda det här dokumentet helt. Så den här metoden kan leda till prestationsstraff.

public static bool IsEncrypted(string filePath, LoadOptions options, out Document document)
ParameterTypBeskrivning
filePathStringFilsökvägen.
optionsLoadOptionsInläsningsalternativen.
documentDocument&Det laddade dokumentet.

Returvärde

Returnerar sant om dokumentet är krypterat annars falskt.

Exempel

Visar hur man kontrollerar om ett dokument är lösenordsskyddat.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (!Document.IsEncrypted(fileName, out document))
{
    Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
    Console.WriteLine("The document is encrypted. Provide a password.");
}

Visar hur man kontrollerar om ett dokument är lösenordsskyddat med ett specifikt lösenord.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
    if (document != null)
    {
        Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
    }
    else
    {
        Console.WriteLine("The document is encrypted. Invalid password was provided.");
    }
}
else
{
    Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}

Se även


IsEncrypted(string, out Document)

Kontrollerar om ett dokument från en fil är krypterat. För att kontrollera det måste vi ladda det här dokumentet helt. Så den här metoden kan leda till prestationsstraff.

public static bool IsEncrypted(string filePath, out Document document)
ParameterTypBeskrivning
filePathStringFilsökvägen.
documentDocument&Det laddade dokumentet.

Returvärde

Returnerar sant om dokumentet är krypterat annars falskt.

Exempel

Visar hur man kontrollerar om ett dokument är lösenordsskyddat.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (!Document.IsEncrypted(fileName, out document))
{
    Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
    Console.WriteLine("The document is encrypted. Provide a password.");
}

Visar hur man kontrollerar om ett dokument är lösenordsskyddat med ett specifikt lösenord.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
    if (document != null)
    {
        Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
    }
    else
    {
        Console.WriteLine("The document is encrypted. Invalid password was provided.");
    }
}
else
{
    Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}

Se även


IsEncrypted(string, string, out Document)

Kontrollerar om ett dokument från en fil är krypterat. För att kontrollera det måste vi ladda det här dokumentet helt. Så den här metoden kan leda till prestationsstraff.

public static bool IsEncrypted(string filePath, string password, out Document document)
ParameterTypBeskrivning
filePathStringFilsökvägen.
passwordStringLösenordet för att dekryptera ett dokument.
documentDocument&Det laddade dokumentet.

Returvärde

Returnerar sant om dokumentet är krypterat annars falskt.

Exempel

Visar hur man kontrollerar om ett dokument är lösenordsskyddat.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (!Document.IsEncrypted(fileName, out document))
{
    Console.WriteLine("The document is loaded and ready to be processed.");
}
else
{
    Console.WriteLine("The document is encrypted. Provide a password.");
}

Visar hur man kontrollerar om ett dokument är lösenordsskyddat med ett specifikt lösenord.

// Sökvägen till dokumentkatalogen.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = Path.Combine(dataDir, "Aspose.one");

Document document;
if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
{
    if (document != null)
    {
        Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
    }
    else
    {
        Console.WriteLine("The document is encrypted. Invalid password was provided.");
    }
}
else
{
    Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
}

Se även