Answer the question
In order to leave comments, you need to log in
How to generate a docx document with xml code?
I explain in more detail: a docx file is uploaded to the server. I read it, find the right piece, copy the text with the xml code. Now, having xml code, how to form a new docx document so that the text formatting is the same as in the old one?
In other words, I need to automatically do ctrl+c, ctrl+v from the loaded file to the new one.
I correctly understand that everything is described in the xml code: the position of the text, sizes, font types, paragraphs, and so on.
Answer the question
In order to leave comments, you need to log in
docx is a zip with an internal structure consisting of xml files and pictures as linked objects.
Your task (if you do everything by hand):
unzip .docx > search for the required xml file > parsing and extracting a fragment inside xml > xslt conversion to new xml > zip .xml > docx is obtained.
You need to know:
- the docx specification (for the directory structure of the zip file).
- specification of the internal xml file.
- XSLT (including work with namespace).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question