I'm creating a TRichView/TRVStyle at runtime, then I added some RTF, then I call Format, finally I Save it to RTF.
I coded these little piece of code grabbing infos from help and this forum.
NOTE: Form1 is minimized.
This is my code:
Code: Select all
TRichView *RV=NULL;
TRVStyle *RVS=NULL;
RV=new TRichView((void *)NULL);
RVS=new TRVStyle(NULL);
RV->Visible=false;
RV->Parent=Form1;
RV->Style=RVS;
RV->RTFReadProperties->TextStyleMode=rvrsAddIfNeeded;
RV->RTFReadProperties->ParaStyleMode=rvrsAddIfNeeded;
for(int i=0;i<3;i++) {
int ItemNo=RV->ItemCount;
TMemoryStream *Str=new TMemoryStream;
Str->LoadFromFile(IntToStr(i)+".rtf");
RV->LoadRTFFromStream(Str);
delete Str;
if(ItemNo>0) {
RV->PageBreaksBeforeItems[ItemNo]=true;
}
}
RV->Format();
RV->SaveRTF("output.rtf", false);
delete RVS;
delete RV;
In this case on the Format method, an EStackOverflow appears.
So I tried also to change:
Code: Select all
RV=new TRichViewEdit((void *)NULL);
Code: Select all
RV=new TRichViewEdit((TComponent *)NULL);
(If Form1 is not minimized, it works).
How could I solve this issue?
Is possible to use TRichView in a sort of non-visual component to merge more than one RTF document in 1 RTF?
Thanks for any help.
Sal