MarkdownConverter
Contents
[
Hide
]
MarkdownConverter class
Converts various document formats to Markdown format.
public class MarkdownConverter : IDisposable
Constructors
Name | Description |
---|---|
MarkdownConverter(Stream) | Initializes a new instance of the MarkdownConverter class. |
MarkdownConverter(string) | Initializes a new instance of the MarkdownConverter class. |
MarkdownConverter(Stream, LoadOptions) | Initializes a new instance of the MarkdownConverter class. |
MarkdownConverter(string, LoadOptions) | Initializes a new instance of the MarkdownConverter class. |
Methods
Name | Description |
---|---|
Convert() | Converts the source document to Markdown format and returns the result as a string. |
Convert(DocumentConverterOptions) | Converts the source document to Markdown format using the specified conversion options and returns the result as a string. |
Convert(Stream) | Converts the source document to Markdown format and writes the result to the specified output stream. |
Convert(string) | Converts the source document to Markdown format and saves it to the specified file path. |
Convert(Stream, DocumentConverterOptions) | Converts the source document to Markdown format using the specified conversion options and writes the result to the specified output stream. |
Convert(string, DocumentConverterOptions) | Converts the source document to Markdown format using the specified conversion options and saves it to the specified file path. |
Dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
Remarks
The MarkdownConverter class provides functionality to convert documents from various formats to Markdown. It supports conversion from popular document formats like Word (DOCX, DOC) and Excel (XLSX, XLS). The conversion process can be customized using DocumentConverterOptions
.
Examples
The following example shows how to convert a Word document to Markdown:
using (var converter = new MarkdownConverter("document.docx"))
{
var result = converter.Convert();
if (result.IsSuccess)
{
string markdown = result.Content;
Console.WriteLine(markdown);
}
}
The following example shows how to convert a password-protected document:
var streamInfo = new StreamInfo
{
Extension = ".docx",
Password = "password123"
};
using (var converter = new MarkdownConverter("protected.docx", streamInfo))
{
var result = converter.Convert();
if (result.IsSuccess)
{
string markdown = result.Content;
Console.WriteLine(markdown);
}
}
See Also
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown