Adding header to docx using openxml

I am trying to add a new header (manually using openxml code) to a docx document (office 2010) that already contains a header (header1.xml). I tried to do this with openxml, adding a file called myheader.xml with just one paragraph. When you open a document in a word, the contents of heading 1 are displayed in a different position (2 lines lower) than before.

When I deleted the paragraph (only <w:hdr> </w:hdr> with the corresponding namespaces), the contents of heading 1 were still presented in another potion ( only 1 line below)

Is there a solution for this problem?

+4
source share
1 answer

I suggest you familiarize yourself with this topic here: Add header and footer to an existing empty Word document with OpenXML SDK 2.0

I think this will solve this problem, since it is a little more than just adding a paragraph, but not much.

0
source

Source: https://habr.com/ru/post/1396427/


All Articles