I am using Aspose.Word to create a EMF file from MathML.
The post here:
explains how to do this.
Then, I add this image into Worksheet:
var mathMl =
@"<math xmlns="“http://www.w3.org/1998/Math/MathML”">y=a+bx+cx2+dx3+ex4";
var doc = new Document();
var builder = new DocumentBuilder(doc);
builder.InsertHtml(mathMl);
OfficeMath math = (OfficeMath)doc.GetChild(NodeType.OfficeMath, 0, true);
var options = new ImageSaveOptions(SaveFormat.Emf)
{
Resolution = 200
};
var workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
using (var imageStream = new MemoryStream())
{
math.GetMathRenderer().Save(imageStream, options);
worksheet.Pictures.Add(1, 1, imageStream);
}
var pdfSaveOption = new Aspose.Cells.PdfSaveOptions();
workbook.Save(“test.pdf”, pdfSaveOption);
Process.Start(“test.pdf”);
workbook.Save(“test.xlsx”, Aspose.Cells.SaveFormat.Xlsx);
Process.Start(“test.xlsx”);
Pdf output is incorrect.
Excel and Pdf document int the attachment files.