WPCubed Product Support

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.

{\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 }}
#1 ♥ 0
10.2k Views 2 users read 4 min
support

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

#2 ♥ 0

@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.

#3 ♥ 0
support

wrong, \sect means "New section" from "Microsoft Office Word 2003 Rich Text Format (RTF) Specification" page 36. It is not a synonym for \par

#4 ♥ 0

Check page 85 (give or take a few pages)

\par     end of paragraph
\sect    end of section AND PARAGRAPH
#5 ♥ 0
support

Hi,

I have posted V5.24.1 which integrates a small change in WPIOReadRTF. The problem was that your RTF file does not specify the section break mode.

Julian

#7 ♥ 0

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.

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

#9 ♥ 0
support

Hi,

expects a "}" after "\sect" which is not always the case

Yes, it does. But I have not much possibilities here since that break mode is really missing. I cannot assume a breaking section when I read \sect since there are plenty of documents which use \sect as a non breaking section marker.

Julian

#10 ♥ 0

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.

#11 ♥ 0
support

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 ?

#12 ♥ 0
This category is archived. No new posts are possible.