Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Sep 04, 2024 1:29 pm

Hi, i am trying for my company to automatize some modifying docx files.

I have a template file that i am modifying in my script. This file has differents headers/footers for the first page and the other pages of the file.
But when i load the file it seems that the header and footer of the first page is udplicated to all the other pages.

I know there is "section.PageSetup.DifferentFirstPageHeaderFooter = True" but i don't know how to make it work.

It seems that just doing this does the problem, so i guess it's when loading the word document.

doc = Document()
doc.LoadFromFile(word_template_path)

doc.SaveToFile(final_rapport_path, FileFormat.Docx2016)
doc.Close()

Do you have any ideas on how to deal with my problem ? I thought about splitting my document in two parts but if there is any more efficient and easier way i'm open to ideas !

Thank you

Gabidev94
 
Posts: 1
Joined: Wed Sep 04, 2024 1:20 pm

Thu Sep 05, 2024 6:40 am

Hello,

Thanks for your inquiry.You can refer to the following article(https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/Header/Footer/How-to-add-different-first-page-header-footer.html) to add different first page headers and footers. If you have any further questions, you can provide us with your Word file and expected results, and we can provide you with corresponding examples.You can upload here or send it to us via email( support@e-iceblue.com ). Thank you in advance.

Sincerely,
Amin
E-iceblue support team
User avatar

Amin.Gan
 
Posts: 277
Joined: Mon Jul 15, 2024 5:40 am

Fri Oct 18, 2024 1:47 am

加粗某些字体时,生成的新的world文档会把纸张方向由纵向变成横向

zcw41329
 
Posts: 2
Joined: Fri Oct 18, 2024 1:42 am

Return to Spire.Doc

cron