Hi,
I would like to create and fill a document or TRichViewEdit at runtime with CB6 and save it without showing it in the gui.
Something like:
TRichViewEdit *rve = new TRichViewEdit(NULL);
TRVStyle* style = new TRVStyle(NULL);
rve->Style = style;
rve->InsertText("test");
TMemoryStream*Stream = new TMemoryStream;
rve->SaveRVFToStream(Stream, false);
But I can't get that working, I only get lots of runtime errors.
Thanks for help!
Usch
How to create a TRichView at runtime
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
In the current version, TRichViewEdit must have a parent:
TRichViewEdit *rve = new TRichViewEdit(NULL);
rve->Visible = false;
rve->Parent = Form1;
TRVStyle* style = new TRVStyle(NULL);
rve->Style = style;
rve->Format();
rve->InsertText("test");
Besides, initial values of TRichViewEdit created at runtime are not the same as for components placed on form at designtime (for the latter, settings from the component editor are used).
Specifically, you may wish to add:
TRVFOptions RVFOptions = rve->RVFOptions;
RVFOptions << rvfoSaveTextStyles;
RVFOptions << rvfoSaveParaStyles;
rve->RVFOptions = RVFOptions;
TRichViewEdit *rve = new TRichViewEdit(NULL);
rve->Visible = false;
rve->Parent = Form1;
TRVStyle* style = new TRVStyle(NULL);
rve->Style = style;
rve->Format();
rve->InsertText("test");
Besides, initial values of TRichViewEdit created at runtime are not the same as for components placed on form at designtime (for the latter, settings from the component editor are used).
Specifically, you may wish to add:
TRVFOptions RVFOptions = rve->RVFOptions;
RVFOptions << rvfoSaveTextStyles;
RVFOptions << rvfoSaveParaStyles;
rve->RVFOptions = RVFOptions;