Image Header only on template (not on joined documents )

Hello,
I’ve inserted a image into header template.
And in the code, One or more annex documents will be joined on the template :

private void Joindre(Document dstDoc, Document srcDoc)
{
    while (srcDoc.Sections.Count > 0)
    {
        Section section = srcDoc.Sections[0];
        srcDoc.Sections.RemoveAt(0);
        dstDoc.Sections.Add(section);
    }
}

But Image is also inserted into headers of annexes (documents joined by Joindre function ) .
How can I do insert header only on template doc.

Others documents concatenated to template by code must not have headers.

Please help

Hi,

Copying content of the headers only is not supported at the moment, please see here:

https://forum.aspose.com/t/128106

hello,
Here is my problem.
- I have a template document ( page 1,2 and 3) and I’ve inserted an image header (GUITTET ).

- I’ve also a document name RECOMMANDATIONS GENERALES that have no header. This document will be concatenate on template by code.

But when I generate my document, A header will be insert on
RECOMMANDATIONS GENERALES ( image Seigneurie ). (page 4)

I want my joined document to have GUITTET as header or any header !!!

I don’t know where image Seigneurie comes from !!!

Regards

Well I’m not sure where this image comes from too… Anyway, if you need to avoid copying headers/footers at all, you should use Section.AppendContent instead of Sections.Add. If nothing helps, please attach both the original documents, not the resulting one.

The method doc.Section.AppendContent is not available !!!
Error at red line.

I’ve attached template report that causes problem.

private void JoindreAnnexe(Document dstDoc, Document srcDoc)
{
    while (srcDoc.Sections.Count > 0)
    {
        Section section = srcDoc.Sections[0];
        srcDoc.Sections.RemoveAt(0);
        dstDoc.Sections(1).AppendContent(section);
    }
}

The annexe that I add to report

The other template that we sometimes.

Sometimes we use template Guittet and add the annexe (ANNRECOGEN.doc).

Sometimes we use template SEIGNEURIE and add the same annexe(ANNRECOGEN.doc ).

But the annexe appear always with the logo of Seigneurie.

In MS Word, open your destination (not annexes) document. Go to File | Page Setup. Choose the Layout tab. On Headers and Footers, check Different first page. You will see that “phantom image”. Delete it everywhere.

Thank you very much !!!
it works.