We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

open an existing word.doc/docx with DocIO, add a header to first page only, convert to pdf

Does anybody on this forum know how to open an existing word.doc/docx with DocIO, add a header section (with Picture) to the first page only.

 

I can add the header but it is only doing it on a new page

 

Any assistance is greatly appreciated.
Jeff


7 Replies

SK Sathish K Syncfusion Team October 11, 2013 12:44 PM UTC

Hi Jeff,

 

Thank you for your interest in Syncfusion products.

 

As per your request, we have prepared a sample which illustrates how to open an existing word document and insert header content in the first page of that document. Please find the attached sample and let us know if this meets your requirement.

 

Please refer the following link to get more information about Headers and Footers.

http://help.syncfusion.com/ug/wpf/docio/default.htm#!documents/headersandfooters.htm

 

Please let us know if you need further assistance.

 

Regards,

Sathish



GenerateWord_Windows_325f287e.zip


LP Luba Pyat January 11, 2017 04:30 PM UTC

Hi. I have the same task: adding the header (image) to an existing document. Can you please help? I cannot open the zip file you added. Thanks!


VR Vijay Ramachandran Syncfusion Team January 12, 2017 07:38 AM UTC

Hi Luba,

Thank you for contacting Syncfusion support.

We have resolved the link corruption issue, now you can download the attachment. Also refer the below UG documentation to know more about header footers:
https://help.syncfusion.com/file-formats/docio/working-with-sections#working-with-headers-and-footers

Online demo link:
http://asp.syncfusion.com/demos/web/docio/headerandfooter.aspx

Let us know if you have any concern.

Regards,
Vijay R
 



JU Julian October 20, 2017 01:17 AM UTC

Hi, is there any way that can add footer to the last page only?



SY Sethumanikkam Yogendran Syncfusion Team October 20, 2017 07:10 AM UTC

Hi Julian,

Thank you for contacting Syncfusion support.

The Word document is a flow document in which contents will not be preserved page by page; instead the contents will be preserved sequentially section by section. Each section may extend to various pages based on its contents like table, text, images etc.

Word viewer/editor renders the contents of the Word document page by page dynamically when opened for viewing or editing and this page wise rendered information will not be preserved in the document level as per the Microsoft Word file format specification. Whereas Essential DocIO is a non-UI component that provides a full-fledged document object model to manipulate the Word document contents.

Please refer the below KB article which explains the same:
http://www.syncfusion.com/kb/3989/why-it-is-not-possible-to-access-the-word-document-contents-page-by-page

Hence it is not directly possible to access the Word document contents page by page, the same holds in Essential DocIO. As a workaround, you can split the contents of each page as separate section in the Word document and access the contents by sections instead of pages.

If you want to have unique headers/footers on each and every page then you shall insert separate sections for each and every pages and insert your headers/footers content in the corresponding sections. We have prepared a sample to illustrate the same. Please find it from below link, and let us know if this helps you.

Sample link:
http://www.syncfusion.com/downloads/support/forum/113821/ze/GenerateWord_F113821-2092759102.zip
Note: Please find the documents from input and output folder inside the application.

Kindly refer the below UG documentation and online sample links to know more about Header and Footers with Essential DocIO.
UG link:
https://help.syncfusion.com/file-formats/docio/working-with-sections#working-with-headers-and-footers

Online sample link:
http://asp.syncfusion.com/demos/web/docio/headerandfooter.aspx

If we misunderstood any of your requirement, then kindly provide us sample or modified sample of above along with input used at your end and screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution at the earliest.

Please let us know if you have any other questions.

Regards,
Sethumanikkam.Y



MA Matthew October 22, 2021 08:19 AM UTC

Hi, is it possible to extract the header and footer sections from one Word document and insert them into the first page of another existing document?

So effectively using the first Word document as a reusable template for the second.


Any help would be much appreciated, Thanks



MR Manikandan Ravichandran Syncfusion Team October 25, 2021 11:28 AM UTC

Hi Matthew,

Thank you for your update.

From the given details, we have found that your requirement to copy the header and footer from one Word document and insert them into the first page header and footer of another existing document using DocIO. We have attached the sample application to achieve your requirement and it can be downloaded from the below link.
https://www.syncfusion.com/downloads/support/forum/113821/ze/HeaderAndFooterSample-1662858452

In above sample, we have done the following things,
1. Loaded the documents (Template_1 and Template_2).
2. Extracted the header and footer items from the first document (Template_1) and then inserted into the second document (Template_2) of first page header and first page footer.
3. Enabled DifferentFirstPage property to true for inserting header and footer text.
4. Saved the second document (Template_2).

Please find the output Word document which generated at our end from the below link:
https://www.syncfusion.com/downloads/support/forum/113821/doc/Sample1457627464

Please refer the below UG documentation to know working with headers and footers using DocIO..
https://help.syncfusion.com/file-formats/docio/working-with-sections#working-with-headers-and-footers

Please let us know if you have any other
queries.

Regards,
Manikandan Ravichandran
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon