I have a Table Inside Word and I am fetching the equation from the word but it is considering equation as texts. I get equation as f(x)={■(x^2,&x≥0@x^2 |x|,&x<0) in code. I have given below the code where I am looping through the word document paragraphs and the image of my word document
private string ExtractContentWithImages(WordprocessingDocument doc, DocumentFormat.OpenXml.Wordprocessing.TableCell cell)
{
StringBuilder contentBuilder = new StringBuilder();
foreach (var paragraph in cell.Elements<Paragraph>())
{
foreach (var equation in paragraph.Descendants<OfficeMath>())
{
string equationText = GetEquationFromOMath(equation);
contentBuilder.AppendLine(equationText);
}
if (!string.IsNullOrWhiteSpace(paragraph.InnerText))
{
// This is a text paragraph, process text
string lineText = paragraph.InnerText;
contentBuilder.Append(lineText);
}
}
return contentBuilder.ToString();
}