Skip to content Skip to sidebar Skip to footer

How Can I Copy Equations From Docx To A Specific Location In Another Docx?

Hello I am currently trying to write a code that combines docx files. These files may have text, images, tables, or equations. The code aims to copy these objects and append them t

Solution 1:

I'm sure you'll find your answer in the XML. You can conveniently browse an XML "part" in a .docx "package" using opc-diag.

The paragraphs and tables in a Word document are located in the document.xml part, as child elements under the <w:body> element. The last element in <w:body> is a section element (<w:sectPr> IIRC). If you're appending your equations after that element, they will continue to float to the bottom as new paragraphs and tables are added above that sectPr element.

I would work with a short-as-possible test document and examine the XML produced by your code, comparing it to one that looks the way you want, perhaps created by hand in Word. That should quickly point up any element sequencing problems you have in your code.


Post a Comment for "How Can I Copy Equations From Docx To A Specific Location In Another Docx?"