2th import of a document returns a list index out of bounds
Posted: Fri Oct 01, 2010 9:54 am
I have the following code :
The first time i use it al is wel and the document is converted and loaded, however if i try to load it a 2th time i get a list index out of bounds. I narowed it down to a table in the document. I think Richview holds some of the formats of the previous document.
How can i make sure all the settings are reset?
if FilterCounter > -1 then
begin
try
Succes := RVOfficeConverter.ImportRTF(F, FilterCounter);
except
Succes := False;
end;
if Succes then
begin
MyStream := TMemoryStream.Create;
MyStream.LoadFromStream(RVOfficeConverter.Stream);
RVOfficeConverter.Stream.Position := 0;
SRVE.RVHeader.Clear;
SRVE.RVFooter.Clear;
SRVE.RichViewEdit.Clear;
SRVE.RichViewEdit.LoadRTFFromStream(MyStream);
SRVE.RVHeader.Format;
SRVE.RVFooter.Format;
SRVE.SetRVMargins;
SRVE.Format;
MyStream.Free;
Break;
end;
end;
The first time i use it al is wel and the document is converted and loaded, however if i try to load it a 2th time i get a list index out of bounds. I narowed it down to a table in the document. I think Richview holds some of the formats of the previous document.
How can i make sure all the settings are reset?
if FilterCounter > -1 then
begin
try
Succes := RVOfficeConverter.ImportRTF(F, FilterCounter);
except
Succes := False;
end;
if Succes then
begin
MyStream := TMemoryStream.Create;
MyStream.LoadFromStream(RVOfficeConverter.Stream);
RVOfficeConverter.Stream.Position := 0;
SRVE.RVHeader.Clear;
SRVE.RVFooter.Clear;
SRVE.RichViewEdit.Clear;
SRVE.RichViewEdit.LoadRTFFromStream(MyStream);
SRVE.RVHeader.Format;
SRVE.RVFooter.Format;
SRVE.SetRVMargins;
SRVE.Format;
MyStream.Free;
Break;
end;
end;