I am trying to use WordprocessingDocument of OpenXML in C# to create MS WORD document.
I succeeded to add the normal paragraph, but, I have problem on adding math equation.
I got the idea to use OfficeMath from GPT, and I tried to add the simple text data into OfficeMath as follows,
OfficeMath officeMath = new OfficeMath();
Run run = new Run();
run.Append(new Text("test text"));
officeMath.Append(run);
return officeMath;
Here I had an error in execution on the line “officeMath.Append(run);”.
The exception shows “System.InvalidOperationException: ‘Non-composite elements do not have child elements.'”
despite I add the text element to “run”.
Is the any example to add math equation to the paragraph for WordprocessingDocument in C#?
shetora is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.