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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

add section in the middle of document without header

Thread ID:

Created:

Updated:

Platform:

Replies:

145101 Jun 6,2019 03:50 PM UTC Jun 19,2019 09:25 AM UTC WinForms 5
loading
Tags: DocIO
AtliDev
Asked On June 6, 2019 03:50 PM UTC

hi,
i have a document with two type of header, the first is in the first page and the second header in the other page.
i want to add section in a specific emplacement.
and the section added don't contain any header.
thanks.

AtliDev
Replied On June 7, 2019 09:40 AM UTC

hi,
i want to delete my header from my current section.

Dim header As DLS.HeaderFooter = a.Sections(1).HeadersFooters.Header
        For i = 0 To header.ChildEntities.Count - 1
            header.ChildEntities.RemoveAt(0)
Next

this code is not working at the seconde section

thanks

Vijayasurya Anandhan [Syncfusion]
Replied On June 7, 2019 02:02 PM UTC

Hi AtliDev,

Thank you for contacting Syncfusion support.

To meet your requirement, we have prepared a sample. Please find the sample from the below link:
http://www.syncfusion.com/downloads/support/forum/145101/ze/Sample1869621340.zip

In this sample, we have done the following things:
1. Created a new Word document.
2. Add new section to the document.
3. Add new paragraph to the section.
4. Add header and footer to the section with page break.
5. Created new section to the document.
6. Add new paragraph to the second section.
7. Add header and footer to the second section with page break.
8. Iterated the section to get the current section
9. Removed the child entities of the header in the second section.
10. Saved the document.

If you are facing any problem while using this scenario at your end. We request you to share the input word document used in your end and the expeted output Word document. Thereby, we will check on your problem and will provide you the appropriate solution at the earliest.

Note: If you have any confidential data in your Word document, please replace with some dummy data and provide us the same. We just need your document to achieve your end requirements. 


Regards,
Vijayasurya A


AtliDev
Replied On June 18, 2019 02:59 PM UTC

hi,
a.Sections(0).PageSetup.DifferentOddAndEvenPages is not working when i have 4 or more section , the other section have a different header then the first one
for my case i have a document , in the attach , contains 3 sections and i just want to delete the header in the second section.

the code you give me , you create a new worddocument , is not the same.

the code i use it, but is not working !!

       Dim a As WordDocument = New WordDocument(chemin + "\testword\Template123.doc", FormatType.Doc)

        For i As Integer = 0 To a.Sections(1).HeadersFooters.EvenHeader.ChildEntities.Count - 1
            a.Sections(1).HeadersFooters.Header.ChildEntities.RemoveAt(0)
        Next

        For i As Integer = 0 To a.Sections(1).HeadersFooters.FirstPageHeader.ChildEntities.Count - 1
            a.Sections(1).HeadersFooters.Header.ChildEntities.RemoveAt(0)
        Next

        For i As Integer = 0 To a.Sections(1).HeadersFooters.Header.ChildEntities.Count - 1
            a.Sections(1).HeadersFooters.Header.ChildEntities.RemoveAt(0)
        Next

        For i As Integer = 0 To a.Sections(1).HeadersFooters.OddHeader.ChildEntities.Count - 1
            a.Sections(1).HeadersFooters.Header.ChildEntities.RemoveAt(0)
        Next

thanks for help


Attachment: sample_b9ea9141.zip

Mohanaselvam  Jothi [Syncfusion]
Replied On June 19, 2019 09:09 AM UTC

Hi AtliDev,

Thank you for your update.

From the given details, we have found that your requirement is to set different header and footer for first page and to remove header and footer for particular section in the Word document. To set different header and footer for first page, we suggest you to add header and footer contents in FirstPageHeader and FirstPageFooter. To remove header and footer for the particular section, we suggest you to set empty paragraph in the headers and footer of section. We have prepared the sample for the same and it can be downloaded from the below link:
http://www.syncfusion.com/downloads/support/forum/145101/ze/Sample-1683304921

Please let us know if you have any other questions.

Regards,
Mohanaselvam J 


AtliDev
Replied On June 19, 2019 09:25 AM UTC

thanks,
the same solution i found yesterday,
i clear my header and i insert paragraph in

     a.Sections(1).HeadersFooters.Header.ChildEntities.Clear()
     a.Sections(1).HeadersFooters.Header.AddParagraph()

thanks for help.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon