ConvertResult

ConvertResult class

Contains the output of a successful document-to-Markdown conversion.

public class ConvertResult

Properties

Name Description
Content { get; } Gets the converted Markdown content as a string.
ErrorMessage { get; } Gets the error message if the conversion failed, or null if it succeeded.
Exception { get; } Gets the exception that caused the conversion to fail, or null if the conversion succeeded.
IsSuccess { get; } Gets a value indicating whether the conversion completed successfully.
Warnings { get; } Gets a list of non-fatal warnings that occurred during conversion.

Methods

Name Description
static Failure(string, Exception) Creates a failed result with error information.
static Success() Creates a successful result without content. Used when the output was written to a stream or file.
static Success(string) Creates a successful result containing the converted Markdown content.

Remarks

All Convert methods throw on failure, so a returned ConvertResult always represents a successful conversion. Use Content to read the Markdown string (when converting to string) and Warnings to check for non-fatal issues.

Examples

using var converter = new MarkdownConverter("report.docx");
ConvertResult result = converter.Convert(); // throws on failure
Console.WriteLine(result.Content);           // always valid

foreach (string warning in result.Warnings)
    Console.WriteLine("Warning: " + warning);

See Also