Enum MarkdownExportAsHtml

Enum MarkdownExportAsHtml

Namespace: Aspose.Words.Saving
Assembly: Aspose.Words.dll (25.12.0)

Allows to specify the elements to be exported to Markdown as raw HTML.

[Flags]
public enum MarkdownExportAsHtml

Fields

NonCompatibleTables = 2

Export tables that cannot be correctly represented in pure Markdown as raw HTML.

When this option is enabled, Aspose.Words will only export tables that have merged cells or nested tables as raw HTML. And all other tables will be exported in Markdown format. Also note, this option will not preserve all formatting of the table, but only preserves corresponding spans of the cells.

If related Aspose.Words.Saving.MarkdownExportAsHtml.Tables flag is set, then this flag will be ignored.

None = 0

Export all elements using Markdown syntax without any raw HTML.

Tables = 1

Export tables as raw HTML.

When this option is enabled, every table will be exported as raw HTML. Aspose.Words will try to preserve all formatting of the tables in this case.

If this flag is set, then related Aspose.Words.Saving.MarkdownExportAsHtml.NonCompatibleTables flag will be ignored.

Examples

Shows how to export tables that cannot be correctly represented in pure Markdown as raw HTML.

string outputPath = ArtifactsDir + "MarkdownSaveOptions.NonCompatibleTables.md";

                                                                                                        Document doc = new Document(MyDir + "Non compatible table.docx");

                                                                                                        // With the "NonCompatibleTables" option, you can export tables that have a complex structure with merged cells
                                                                                                        // or nested tables to raw HTML and leave simple tables in Markdown format.
                                                                                                        MarkdownSaveOptions saveOptions = new MarkdownSaveOptions();
                                                                                                        saveOptions.ExportAsHtml = MarkdownExportAsHtml.NonCompatibleTables;

                                                                                                        doc.Save(outputPath, saveOptions);

Shows how to export a table to Markdown as raw HTML.

Document doc = new Document();
                                                               DocumentBuilder builder = new DocumentBuilder(doc);

                                                               builder.Writeln("Sample table:");

                                                               // Create table.
                                                               builder.InsertCell();
                                                               builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
                                                               builder.Write("Cell1");
                                                               builder.InsertCell();
                                                               builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
                                                               builder.Write("Cell2");

                                                               MarkdownSaveOptions saveOptions = new MarkdownSaveOptions();
                                                               saveOptions.ExportAsHtml = MarkdownExportAsHtml.Tables;

                                                               doc.Save(ArtifactsDir + "MarkdownSaveOptions.ExportTableAsHtml.md", saveOptions);
 English