Strange exception of TSRichViewEdit.SubDocuments
Posted: Wed Mar 11, 2020 1:03 pm
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;
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;