FEDPOL #76 - Section break in paragraph

  • WPTools displays "helloworld" on the first page when it should display "hello" on the first page and "world" on the second page. If I add "\sbkpage" after "\sectd" then WPTools displays the document correctly. According to the RTF specs "sbkpage" is the default. No problem in Word 97, which was used to create the document.

    Code
    {\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f19\froman\fcharset238\fprq2 Times New Roman CE;}{\f20\froman\fcharset204\fprq2 Times New Roman Cyr;}
    {\f22\froman\fcharset161\fprq2 Times New Roman Greek;}{\f23\froman\fcharset162\fprq2 Times New Roman Tur;}{\f24\froman\fcharset186\fprq2 Times New Roman Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
    \red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
    \red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\lang2057\cgrid \snext0 Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title hello}{\author Tim Schuerewegen}{\operator Tim Schuerewegen}
    {\creatim\yr2007\mo4\dy10\hr14\min33}{\revtim\yr2007\mo4\dy10\hr14\min33}{\version1}{\edmins0}{\nofpages2}{\nofwords1}{\nofchars10}{\*\company Federal Police}{\nofcharsws12}{\vern113}}\paperw11906\paperh16838 
    \widowctrl\ftnbj\aenddoc\formshade\viewkind1\viewscale130\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2
    \pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6
    \pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
    {\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \fs20\lang2057\cgrid {hello\sect }\sectd \linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl \pard\plain \widctlpar\adjustright \fs20\lang2057\cgrid {world
    \par }}
  • Zitat von wpsupport

    Section and page breaks always come before a paragraph. This also applies to column breaks.


    According to the RTF specifications "\sect" means "end of section and paragraph". WPTools does not treat "\sect" as end of paragraph.

  • I tested it with the original document (not the "hello world" example from my initial post) and your fix does not have any effect. I think your fix expects a "}" after "\sect" which is not always the case.

    Here is an example without the "}" after "\sect" and Word 97 displays it ok.

    Zitat

    {\rtf1\ansi a\par b\par c\sect d\par e\par f\par}

  • Why not immediately close the current paragraph and start a new one when "\sect" is encountered? After all, "\sect" means "end of section and pararaph". If you delay the creation of the paragraph, like you do now, you will never be able handle it correctly and this bug will never go away.

    • Offizieller Beitrag

    Hi,

    I had a case in the past where this caused an unwanted break, but you are welcome to use the code

    NewParagraph;
    CreateImplizitPar;

    after ipropSectionBreakMode - of course FStack.FHasDefaultSectionBreak := TRUE and also the NewParagraph after ipropSectionBreakMode is not required.

    Maybe the handling of \sect is too complicated indeed - anybody has a file wher a section does not start a paragraph ?