I have a program that allows a user to type in some content and save the content into the database. I then load that content with some other data into a separate RichView and display it back to the user. The data is loading underlined with inserting it into a separate RichView despite the original content not being underlined.
Is there a way to prevent this behavior?
Thank you.
InsertRVFFromStream loads the content underlined
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
O assu
Possible reasons:
1) RVF is stored without styles.
Solution: Make sure that rvfoSaveTextStyles and rvfoSaveParaStyles are included in RVFOptions of the source editor.
2) RVF is stored with styles, but they are not loaded.
Solution: Make sure that RVFTextStylesReadMode=RVFParaStylesReadMode=rvf_sInsertMerge for the target editor.
3) RVF is loaded correctly, but later some other operation changes styles in the target editor's RVStyle.
Solution: The fist thing to check: make sure that each TRichViewEdit is linked with it's own TRVStyle (no TRVStyles are shared between different editors)
4) StyleTemplates are applied to the loaded content, and the target editor's styletemplate defines underlined text. It may happen if UserStyleTemplates=True for the target editor.
Possible reasons:
1) RVF is stored without styles.
Solution: Make sure that rvfoSaveTextStyles and rvfoSaveParaStyles are included in RVFOptions of the source editor.
2) RVF is stored with styles, but they are not loaded.
Solution: Make sure that RVFTextStylesReadMode=RVFParaStylesReadMode=rvf_sInsertMerge for the target editor.
3) RVF is loaded correctly, but later some other operation changes styles in the target editor's RVStyle.
Solution: The fist thing to check: make sure that each TRichViewEdit is linked with it's own TRVStyle (no TRVStyles are shared between different editors)
4) StyleTemplates are applied to the loaded content, and the target editor's styletemplate defines underlined text. It may happen if UserStyleTemplates=True for the target editor.
They are.Sergey Tkachenko wrote:1) RVF is stored without styles.
Solution: Make sure that rvfoSaveTextStyles and rvfoSaveParaStyles are included in RVFOptions of the source editor.
Both are set to rvf_sInsertMerge, and I tried setting the StyleTemplateInsertMode of the target SRichViewEdit to rvstimUseSourceFormatting. I am still seeing the erroneous result.Sergey Tkachenko wrote:2) RVF is stored with styles, but they are not loaded.
Solution: Make sure that RVFTextStylesReadMode=RVFParaStylesReadMode=rvf_sInsertMerge for the target editor.
This is already being done.Sergey Tkachenko wrote:3) RVF is loaded correctly, but later some other operation changes styles in the target editor's RVStyle.
Solution: The fist thing to check: make sure that each TRichViewEdit is linked with it's own TRVStyle (no TRVStyles are shared between different editors)
UserStyleTemplates is set to false.Sergey Tkachenko wrote:4) StyleTemplates are applied to the loaded content, and the target editor's styletemplate defines underlined text. It may happen if UserStyleTemplates=True for the target editor.
I have confirmed that the RVF content is formatted correctly from the stream, but once the content is completely entered, the content that was inserted from the stream is not in the format I expected.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Sorry for the triple post, but I think I have some more information.
Just before inserting the questionable RVF content from stream. I am doing another insert of different content from stream. The difference is that this content is being inserted into a table via the TRVtableItemInfo.InsertRVFFromStream.
Prior to that insert, I tried saving the content into hidden richview form for formatting purposes. That block of code looks like this:
the dummy values are unassigned, and the table object is a 3 row, 1 col table.
veLoadSave.Clear();
rveLoadSave.Format();
FNoteMemoryStream.Position := 0;
rveLoadSave.LoadRVFFromStream(FNoteMemoryStream);
ms := TMemoryStream.Create();
try
ms.Clear();
rveLoadSave.SaveRVFToStream(ms, False);
ms.Position := 0;
table.Cells[2, 0].InsertRVFFromStream(ms, 0, Dummy1, Dummy2, Dummy3, False, nil);
FNoteMemoryStream.Clear();
table.MergeCells(1, 0, 1, 2, True);
finally
ms.Free();
end;
Just before inserting the questionable RVF content from stream. I am doing another insert of different content from stream. The difference is that this content is being inserted into a table via the TRVtableItemInfo.InsertRVFFromStream.
Prior to that insert, I tried saving the content into hidden richview form for formatting purposes. That block of code looks like this:
the dummy values are unassigned, and the table object is a 3 row, 1 col table.
veLoadSave.Clear();
rveLoadSave.Format();
FNoteMemoryStream.Position := 0;
rveLoadSave.LoadRVFFromStream(FNoteMemoryStream);
ms := TMemoryStream.Create();
try
ms.Clear();
rveLoadSave.SaveRVFToStream(ms, False);
ms.Position := 0;
table.Cells[2, 0].InsertRVFFromStream(ms, 0, Dummy1, Dummy2, Dummy3, False, nil);
FNoteMemoryStream.Clear();
table.MergeCells(1, 0, 1, 2, True);
finally
ms.Free();
end;
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Sorry for the delay.
1) In your project, RVStyle1 was assigned not only with RichViewEdit1.Style, but also with all SRV.ExternalRVStyle* properties.
Do not assign the same RVStyle to several editors (unless you restrict styles to some predefined set), and do not assign the same RVStyle to different editors in SRV.
When I cleared SRV.ExternalRVStyle* properties, a text was formatted as expected.
2) Cell.InsertRVFromStream does not support loading text and paragraph styles.
Workaround:
- create hidden trichview, link it to the same RVStyle as the editor containing the table
- load RVF in this hidden trichview
- save RVF from trichview, excluding rvfoSaveTextStyles and rvfoSaveParaStyles from RVFOptions
- load this RVF in cell.
You can find an example in Demos\RVDemos\Assorted\Fields\MailMerge2.*
1) In your project, RVStyle1 was assigned not only with RichViewEdit1.Style, but also with all SRV.ExternalRVStyle* properties.
Do not assign the same RVStyle to several editors (unless you restrict styles to some predefined set), and do not assign the same RVStyle to different editors in SRV.
When I cleared SRV.ExternalRVStyle* properties, a text was formatted as expected.
2) Cell.InsertRVFromStream does not support loading text and paragraph styles.
Workaround:
- create hidden trichview, link it to the same RVStyle as the editor containing the table
- load RVF in this hidden trichview
- save RVF from trichview, excluding rvfoSaveTextStyles and rvfoSaveParaStyles from RVFOptions
- load this RVF in cell.
You can find an example in Demos\RVDemos\Assorted\Fields\MailMerge2.*