GetRichTextRect, as I understand it, will accept your desired TRect printing area, and then return the bottom position that would be reached when printing the given RTF. If the RTF results in no printing (either because the control is empty or, I have discovered, contains "empty RTF lines" - see below) the returned TRect printing area is not changed. I would expect it to return .Bottom equal to .Top, implying a zero-height TRect.
Might I be missing something?
Example of a blank RTF that I have encountered :
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil MS Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\pard\cf1\lang1033\f0\fs16
\par }
Part of my code :
- Code: Select all
rParagraph.Left := iPrnAreaLeft + ppOutput^.ConvertX(tpParagraph.iLeftMM100,mmHiMetric,ppOutput^.Units);
rParagraph.Top := iCurrentYPos;
rParagraph.Right := iPrnAreaRight - ppOutput^.ConvertX(tpParagraph.iRightMM100,mmHiMetric,ppOutput^.Units);
rParagraph.Bottom := iPrnAreaBottom;
iNewCurrentYPos := ppOutput^.GetRichTextRect(rParagraph,creHolder,@iRenderOffset);
bEndOnThisPage := (iRenderOffset = -1);
// Do the actual drawing of the paragraph on the current page
iRenderOffset := iRenderOffsetTemp;
ppOutput^.PaintRichText(rParagraph,creHolder,1,@iRenderOffset);