I handled subdocuments with the following procedure ,sRveExport is a TSRichviewEdit, it worked perfect until today. Exception message is : list index out of bounds(-1),exception only occured on the header file's loading when "loadRVF",the footer file's loading is right,what I missed?
procedure TfrmQuestionExport.HandleSubDocuments;
var
c: TColor;
begin
sRveExport.PageProperty.TitlePage := True;
sRveExport.PageProperty.HeaderVisible := True;
sRveExport.PageProperty.FooterVisible := True;
sRveExport.PageProperty.TitlePage := True;
c := clWhite;
if FileExists(myPath + HeaderFN0) then
sRveExport.SubDocuments.Items[srvhftFirstPageHeader]
.LoadRVF(myPath + HeaderFN0, c, nil, nil);
if FileExists(myPath + HeaderFN) then
sRveExport.SubDocuments.Items[srvhftNormalHeader].LoadRVF(myPath + HeaderFN,
c, nil, nil);
if FileExists(myPath + FooterFN) then
begin
sRveExport.SubDocuments.Items[srvhftFirstPageFooter]
.LoadRVF(myPath + FooterFN, c, nil, nil);
sRveExport.SubDocuments.Items[srvhftNormalFooter].LoadRVF(myPath + FooterFN,
c, nil, nil);
end
else
sRveExport.PageProperty.PageNoVisible := True;
sRveExport.Format;
end;
Strange exception of TSRichViewEdit.SubDocuments
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Strange exception of TSRichViewEdit.SubDocuments
Can you create a simple project reproducing this problem?
Re: Strange exception of TSRichViewEdit.SubDocuments
Sorry,I forgot the NewItemAction event.
Then,how can I determine if the item is in the subdocuments,or it is in the TSRichviewEdit.RichviewEdit's content?
Then,how can I determine if the item is in the subdocuments,or it is in the TSRichviewEdit.RichviewEdit's content?
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Strange exception of TSRichViewEdit.SubDocuments
It's not very trivial.
OnItemAction has Sender and RVData parameters.
1) Sender may be SRV.RichViewEdit, SRV.RVHeader, SRV.RVFooter, SRV.RVNote, or a temporal editor used to draw inactive notes and text boxes.
But for SubDocuments, Sender = SRV.RichViewEdit, like for items in the main documents.
2) RVData is a document that contains this item.
It may be:
a) either RVData of the editors listed above (like SRV.RichViewEdit.RVData)
b) or one of SubDocuments[]
c) or a it may be a table cell or a note/textbox document; in this case, you can check RVData.GetAbsoluteParentData (or RVData.GetAbsoluteParentData.GetAbsoluteParentData and so on), until it will be one of (a) or (b).
OnItemAction has Sender and RVData parameters.
1) Sender may be SRV.RichViewEdit, SRV.RVHeader, SRV.RVFooter, SRV.RVNote, or a temporal editor used to draw inactive notes and text boxes.
But for SubDocuments, Sender = SRV.RichViewEdit, like for items in the main documents.
2) RVData is a document that contains this item.
It may be:
a) either RVData of the editors listed above (like SRV.RichViewEdit.RVData)
b) or one of SubDocuments[]
c) or a it may be a table cell or a note/textbox document; in this case, you can check RVData.GetAbsoluteParentData (or RVData.GetAbsoluteParentData.GetAbsoluteParentData and so on), until it will be one of (a) or (b).
Re: Strange exception of TSRichViewEdit.SubDocuments
Copy it ! thanks a lot:)