After an initial testing, I was able to reproduce the issue as you mentioned by using your template XLSX file and image file. I found replacing image makes math equation lost in the output Excel file
We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-56177
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@amjad.sahi
Thanks for quick reply and another question
How to extract math equation to an image or mathml string from Excel ?
Is it possible to get mathml string like this?
\int_{\theta=0}^{\pi}
I tried this but not work:
public static void ExcelMathml(string excelPath, string dirPath)
{
using (Workbook workbook = new Workbook(excelPath))
{
int index;
string imagePath;
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageType = Aspose.Cells.Drawing.ImageType.Svg;
foreach (Worksheet worksheet in workbook.Worksheets)
{
foreach (Aspose.Cells.Drawing.Shape shape in worksheet.Shapes)
{
// always false
if (shape.IsEquation)
{
index = worksheet.Shapes.IndexOf(shape) + 1;
imagePath = Path.Combine(dirPath, index.ToString() + ".svg");
shape.ToImage(imagePath, options);
}
}
}
}
}
In word I can get svg like this:
public static void WordMathml(string wordPath, string dirPath)
{
Document document = new Document(wordPath);
OfficeMath math;
int index;
string imagePath;
Aspose.Words.Saving.ImageSaveOptions imageSaveOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Svg);
foreach (Node node in document.GetChildNodes(NodeType.OfficeMath, true))
{
index = document.GetChildNodes(NodeType.OfficeMath, true).IndexOf(node) + 1;
math = (OfficeMath)node;
imagePath = Path.Combine(dirPath, index.ToString() + ".svg");
math.GetMathRenderer().Save(imagePath, imageSaveOptions);
}
}
It seems rendering Math equations in Excel spreadsheets to image format is not supported. Anyways, we need to evaluate it in details.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-56180
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@mymbrooks
1). We have fixed the issue of reading equations from your template file.
2).
Which tool created this html?
“\int_{\theta=0}^{\pi}” is the annotation part in your attached html, the format is “TeX” ,not MathML. So is “Tex” your expected format?
Both MathML and Text are new file format for us. And they are different from “http://schemas.openxmlformats.org/officeDocument/2006/math” (office math).
We have to check whether we should support them first.
Now you can get EquationNode with the following codes:
Sorry for my mistake. Yes, It’s Tex and difference from mathml.
Because modern browsers support Text、mathml, so I ask for this feature for some customer requirement.
We will investigate if we could support rendering math equation to TeX format. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-56213
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@mymbrooks
Did you want to directly extract equation to a TeX String or Embed the equation into html as a TeX string (now Aspose.Cells exports an image)?
1). We plan to add EquationNode.ToTeX() method to directly extract equation to a Tex String:
2). If exporting TeX to html, the most common and user-friendly methods are using MathJax or KaTeX to make the TeX work. So if exporting to html, would you like to add those external JS references?
@mymbrooks
Thanks for your confirm.
We will start to support EquationNode.ToTeX(); first.
And it’s better that you can share files contains your excepted equations. We will prioritize implementing the ones you frequently use because there are two many TeX Equation syntax.
@simon.zhao
Take it easy, this feature is in my wish list, not for production now.
I want to serialization math equation in my work.
I will share some example equation Example.zip (75.5 KB)
Thank you for providing your desired TeX equations. We have logged the archive with your existing ticket “CELLSNET-56213” into our database. We will look into the equations list soon.
We are pleased to inform you that your issue (Ticket ID: “CELLSNET-56177”) has been resolved now. The fix will be included in the upcoming release (Aspose.Cells v24.8) which we plan to release in the first half of August 2024. We will notify you when the next release is released.
@mymbrooks
After closely comparing LaTeX and Tex syntax, we decided to add EquationNode.ToLaTeX(); not ToTex().
Sorry for confusion in the previous post.
The issues you have found earlier (filed as CELLSNET-56177) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi