DocumentConverterResult
Contents
[
Hide
]
DocumentConverterResult class
Represents the result of a document conversion operation to Markdown format.
public class DocumentConverterResult
Properties
Name | Description |
---|---|
Content { get; } | Gets the converted Markdown content. |
ErrorMessage { get; } | Gets the error message if the conversion failed. |
Exception { get; } | Gets the exception that occurred during conversion, if any. |
IsSuccess { get; } | Gets a value indicating whether the conversion was successful. |
Methods
Name | Description |
---|---|
static Failure(string, Exception) | Creates a failed conversion result with error information. |
static Success() | Creates a successful conversion result without Markdown content. |
static Success(string) | Creates a successful conversion result with Markdown content. |
Remarks
This class provides information about the success or failure of a document conversion operation. When the conversion is successful, it contains the converted Markdown content. When the conversion fails, it contains error information including an error message and exception details.
Examples
The following example shows how to handle the result of a document conversion:
using var converter = new MarkdownConverter("document.docx");
var result = converter.Convert();
if (result.IsSuccess)
{
// Use the converted Markdown content
Console.WriteLine(result.Content);
}
else
{
// Handle the conversion error
Console.WriteLine($"Conversion failed: {result.ErrorMessage}");
if (result.Exception != null)
{
Console.WriteLine($"Exception: {result.Exception.Message}");
}
}
See Also
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown