Handling Sections in editor with different header set ups

  • I read the docs about how to handle the different headers in sections in code, but is there any off the shelf editor support for this?

    So in the default editor:
    Build a document
    Add headers (in our case first page and every page)
    add a section, Attempt to edit the header for the first section only and there are no options for this.

    Thanks in advance,
    JAC

    • Offizieller Beitrag

    Hi,

    there is no "off the shelf editor" for this.

    The start of the document is always not a section, it is just the start of the document.

    To insert a section and create a header/footer for this section use this code:

    Code
    var  sec : TWPRTFSectionProps;
    
    
      sec := WPRichText1.ActiveParagraph.StartNewSection;
      sec.Select := [wpsec_SelectHeaderFooter];
      WPRichText1.ActiveText := WPRichText1.HeaderFooter.Get(wpIsHeader,wpraOnFirstPage, sec.SectionID);
      WPRichText1.InputString('Header');
      WPRichText1.ActiveText := WPRichText1.HeaderFooter.Get(wpIsFooter,wpraOnFirstPage, sec.SectionID);
      WPRichText1.InputString('Footer');
  • Thanks for the reply.

    We have a number of letters that are a covering letter + a report and the covering letter has a header and footer and the report has a header and footer, both having different 1st page.

    OK, so I will need to either
    1) make a GUI to handle this.
    2) Build something to concatenate separate files at print time
    3) Wait for you to add a fantastic feature :-)

    Thanks again.
    Jason.

  • I know I can sometimes do things the hard way, so just to check that this is the simplest way of doing this:

    To concatenate an rtf onto another one, maintiain headings etc.
    Load up doc one.
    Select Last para (I would move the cursor to the end)
    Open the other rtf in another wprtf.
    Insert new section into 1st document.
    Read the body of the second into the first document, newly created section
    Read in the headers and footers into the section
    I'll have a go at this unless you tell me I am missing a simple command to do this.

    Regards,