List index out of bounds calling rvPrint.format

General TRichView support forum. Please post your questions here
Post Reply
motoplex
Posts: 2
Joined: Thu Dec 08, 2005 9:39 pm
Location: The Netherlands

List index out of bounds calling rvPrint.format

Post 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
motoplex
Posts: 2
Joined: Thu Dec 08, 2005 9:39 pm
Location: The Netherlands

rvPrint.Format out of bounds error

Post 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
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Probably RVStyles were not assigned to RichViews representing header and footer.
Post Reply