WPAT_ParIsOutline (toc1) missing after an AppendAsSection??

  • Very odd... the toc1 tag gets lost when using AppendAsSection:

    Code
    WPRichText_Rpt.HeaderFooter.AppendAsSection( WPRichText1.HeaderFooter );

    If I look at WPRichText1.AsString just before the AppendAsSection, the toc1 tag from an earlier ASet(WPAT_ParIsOutline,1) is there, but if I look at the resulting WPRichText_Rpt.AsString, the toc1 is not there.

    Any idea what might have happened to it???? Does it not get copied?

    The first couple of my TOC entries were missing until I removed the wptocUseParIsOutline flag in the createTableOfContents call... that's when I noticed that it was the ones after the AppendAsSection.

    WPTools 5.20.5
    Delphi 7

    • Offizieller Beitrag

    Hi,

    WPAT_ParIsOutline will not be applied to an inserted or append paragraph, this means if you press enter WPAT_ParIsOutline will not be copied.

    TWPTextStyle.Assign does copy the WPAT_ParIsOutline flag. And that is what is used by AppendAsSection. But it is possible tthat the first paragraph looses the attribute.

    Julian

  • I noticed the first two AppendAsSection don't keep the WPAT_ParIsOutline flag, but the 3rd one did.

    I think you hit on the issue with it being the first paragraph because if I add:

    Code
    WPRichText1.FastAppendParagraph;

    just before doing the ASet, it works (the first two Appended Sections had no text ahead of them, but the 3rd did... i.e. first two ended up being on the first par).

    So, is that a bug or do I have to find a way to add the WPAT_parIsOutline back in under these circumstances?

  • I added the following code to add the WPAT_ParIsOutline back in after an AppendAsSection if it goes missing:

    Code
    outlinePar := WPRichText_Rpt.LastPar;
              WPRichText_Rpt.HeaderFooter.AppendAsSection( WPRichText1.HeaderFooter );
              if outlinePar.NextPar <> nil then
                outlinePar := outlinePar.NextPar;
              if not outlinePar.AGetInherited(WPAT_ParIsOutline, outl) then
                outlinePar.ASet( WPAT_ParIsOutline, 1 );


    Seem reasonable? It does seem to work since the first par in the new section at this stage would have had the WPAT_ParIsOutline.