Page 1 of 1

List index out of bounds calling rvPrint.format

Posted: Sat Dec 10, 2005 1:57 pm
by motoplex
Dear Mr,

I'm using a registered Trichview v1.9 with D7.
In my application I encounter trouble when adding headers and/or footers
to RVprint.
Using : richview1 with rvStyle1
richeditfooter with rvStyleFooter
richeditheader with rvStyleHeader
rvPrint1
rvPrintPreview with rvPrint1


related parts of code:

Code: Select all

.....
RichviewEditHeader.Clear;
//RichviewEditHeader.DeleteUnusedStyles(True,True,True);
RichView1.RTFReadProperties.SetHeader(RichViewEditHeader.RVData);
RichviewEditHeader.LoadRTF(path1);
RichviewEditHeader.Format;
.....
RichviewEditFooter.Clear;
//RichviewEditFooter.DeleteUnusedStyles(True,True,True);
RichView1.RTFReadProperties.SetHeader(RichViewEditFooter.RVData);
RichviewEditFooter.LoadRTF(path2);
RichviewEditFooter.Format;
.....
Richview1.Clear; 
//RichView1.DeleteUnusedStyles(True,True,True);  
RichView1.Format;  // uit voorbeeld headers-footers demo
Richview1.BackGroundStyle:=bsTiled; //bsStretched,bsTiledAndScrolled;
Richview1.BackGroundBitmap:=BGbitmap1;
Richview1.Style:=RVStyle1;
.....
Richview1.Clear;
//RichView1.DeleteUnusedStyles(True,True,True);  // uit voorbeeld 
RichView1.Format;
.....
Richview1.AddPicture(MFile2resized);
Richview1.Format;
.....
Richview1.format;                      
rvPrint1.StartAt := MaxHeight;          
rvPrint1.AssignSource(Richview1);       
.....
rvPrint1.SetHeader(RichViewEditHeader.RVData);
.....
rvPrint1.SetFooter(RichViewEditFooter.RVData);
.....
All this executes (well?) and does not cause problems if I leave out the
commands rvPrint1.SetHeader() and rvPrint.SetFooter().

With these commands (wanting headers and footers) the
following line causes a list index out of bounds :

Code: Select all

.....
NofPages := RVPrint1.FormatPages(rvdoAll);
.....
I've traced the fault to procedure :

Code: Select all

procedure TCustomMainPtblRVData.FormatNextPage(var i, StartAt, StartY, Y: Integer; var Splitting: Boolean; MaxHeight: Integer);

Code: Select all

pi := GetRVStyle.ParaStyles[GetItemPara(DrawItems[nextnewline-1].ItemNo)];
above line is called with nextnewline=0 ; why ?

Can you give me a Hint for the probable cause ?


regards,
Sander

rvPrint.Format out of bounds error

Posted: Sat Dec 10, 2005 3:51 pm
by motoplex
Dear Sir,

Solved the problem ...... excact cause (not yet) known but my
presentation of the order of execution of listed code lines was
not as presented !

p.s. I should have checked this earlyer instead of 'assuming' ...

Regards,
Sander

Posted: Sun Dec 11, 2005 7:41 pm
by Sergey Tkachenko
Probably RVStyles were not assigned to RichViews representing header and footer.