C
C
CryptoPython2018-05-17 18:14:30
C++ / C#
CryptoPython, 2018-05-17 18:14:30

How to change headers and footers in docx file via c# - WindowsForms?

In general, the problem is that I need to insert variables into the headers and replace them with my own value through the textbox, but since these variables are in the headers, the program does not see them and does not change them, maybe someone has encountered this problem, help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
ApeCoder, 2018-05-17
@ApeCoder

I see the following options:
Using the Word application - record a macro that it does in VBA (enable macro recording, manually follow the steps, then look at the code in VBA). Then translate to C#
Using the OpenOffice XML SDK - parse and replace in the file as needed.
Also don't forget that docx is zipped XML that can be parsed and transformed

A
Alexander Yudakov, 2018-05-18
@AlexanderYudakov

Headers and footers are accessed through Document.Sections
Example:
www.programmersforum.ru/showthread.php?t=64739

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question