MarkdownSaveOptions.OfficeMathOutputType

MarkdownSaveOptions.OfficeMathOutputType property

Indicates how OfficeMath objects are exported to Markdown, Default value is Image.

public HtmlOfficeMathOutputType OfficeMathOutputType { get; set; }

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class MarkdownSaveOptionsPropertyOfficeMathOutputTypeDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add sample data including a formula that might contain OfficeMath
            worksheet.Cells["A1"].PutValue("Sample Data");
            worksheet.Cells["A2"].Formula = "=SQRT(16)";

            try
            {
                // Create Markdown save options
                MarkdownSaveOptions saveOptions = new MarkdownSaveOptions();

                // Display the current value of OfficeMathOutputType
                Console.WriteLine("Current OfficeMathOutputType: " + saveOptions.OfficeMathOutputType);

                // Set OfficeMathOutputType to MathML
                saveOptions.OfficeMathOutputType = HtmlOfficeMathOutputType.MathML;
                Console.WriteLine("Changed OfficeMathOutputType to: " + saveOptions.OfficeMathOutputType);

                // Save the workbook with MathML output type
                workbook.Save("OfficeMathOutputType_MathML.md", saveOptions);

                // Change to Image output type
                saveOptions.OfficeMathOutputType = HtmlOfficeMathOutputType.Image;
                Console.WriteLine("Changed OfficeMathOutputType to: " + saveOptions.OfficeMathOutputType);

                // Save the workbook with Image output type
                workbook.Save("OfficeMathOutputType_Image.md", saveOptions);

                Console.WriteLine("OfficeMathOutputType demonstration completed successfully.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
            }
        }
    }
}

See Also