Profile Picture

Different Header and Footer

Posted By Gustaw Wronski 11 Years Ago

Different Header and Footer

Author
Message
Gustaw Wronski
Question Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 1, Visits: 1
Hi there,
How do I create a document with Different Header but same footer across different sections?
What I want to accomplish is a report where the footer stays the same, and the header has different title / page number.

Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)Supreme Being (4,437 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 3,055, Visits: 4,055
Hi Gustaw,

Each section in the control document uses the header / footer of the section preceding it, unless it does not provide its own header footer. More information about sections can be found here:
http://helpopenvision.nevron.com/ProgrammingModel_Sections.html

The following code snippet shows how to accomplish the configuration you want:

   NDocumentBlock document = m_RichText.Content;
   document.Sections.Clear();
   
   for (int i = 0; i < 3; i++)
   {
    NSection section = new NSection();

    section.DifferentFirstHeaderAndFooter = false;
    section.DifferentLeftRightHeadersAndFooters = false;
    section.BreakType = ENSectionBreakType.NextPage;

    if (i == 0)
    {
     NHeaderFooter footer =new NHeaderFooter();
     footer.Blocks.Add(new NParagraph("Footer For Section 1"));
     section.Footer = footer;
    }

    NHeaderFooter header = new NHeaderFooter();
    NParagraph headerParagraph = new NParagraph();

    headerParagraph.Inlines.Add(new NTextInline("Header for Section " + (i + 1).ToString() + ", Page "));
    headerParagraph.Inlines.Add(new NFieldInline(ENNumericFieldName.PageNumber));

    header.Blocks.Add(headerParagraph);
    section.Header = header;

    section.Blocks.Add(new NParagraph("Section " + (i + 1).ToString()));

    document.Sections.Add(section);
   }

Note that in the code above only the first section specifies a footer - the other sections do not define a footer explicitly and will therefore use the footer of the preceding (the first) section. Hope this helps - let us know if you have any questions or meet any problems.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic

2 active, 2 guests, 0 members, 0 anonymous.
No members currently viewing this topic!