LoadOptions
Leave feedback
On this page
Specifies additional options for loading a document, such as an explicit file format or a password for encrypted files.
public class LoadOptions
| Name | Description |
|---|---|
| LoadOptions() | Initializes a new instance of the LoadOptions class with automatic format detection. |
| LoadOptions(FileFormat) | Initializes a new instance of the LoadOptions class with an explicit file format. |
| Name | Description |
|---|---|
| FileFormat { get; } | Gets the file format of the document to load. |
| Password { get; set; } | Gets or sets the password for opening an encrypted document. |
By default, the library detects the file format automatically from the file extension or content. Use this class when you need to override automatic detection (for example, when loading from a stream without a file name) or when the document is password-protected.
Specifying the file format explicitly (useful when loading from a stream):
var loadOptions = new LoadOptions(FileFormat.Docx);
using (var stream = File.OpenRead("document"))
using (var converter = new MarkdownConverter(stream, loadOptions))
{
ConvertResult result = converter.Convert();
Console.WriteLine(result.Content);
}
Loading a password-protected document:
var loadOptions = new LoadOptions(FileFormat.Docx)
{
Password = "secret"
};
string markdown = MarkdownConverter.ToMarkdown("protected.docx", loadOptions);
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.