Could I get an example of SaveRTFToStream() from a table cell
Ex
Cells[iRow,0].SaveRTFToStream(....)
Also, is there a demo or some example code makeing use of streaming with the table ?
John
Steaming with Table Cells
There are some code snippets (and discussion) here: www.trichview.com/forums/viewtopic.php?t=236
HTH,
Michel
HTH,
Michel
Not RTF
Thanks for the reponse. I've already read this post.
It's on streaming with RVF not RTF which has quite a few more arguments that wasn't sure how to fill in. Also I tried streaming from a cell back to a TRichView which appears to work. Then I stream from that TRichView back to my database which does not save the style. In RVF that is, not RTF. The question remains can a cell be used the same as a RichView when streaming out. I able to stream in without losing anything so why not stream out. There needs to be better documentation or demos on this.
It's on streaming with RVF not RTF which has quite a few more arguments that wasn't sure how to fill in. Also I tried streaming from a cell back to a TRichView which appears to work. Then I stream from that TRichView back to my database which does not save the style. In RVF that is, not RTF. The question remains can a cell be used the same as a RichView when streaming out. I able to stream in without losing anything so why not stream out. There needs to be better documentation or demos on this.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
RTF
Saving:
Cell.GetRVData.SaveRTFToStream(Stream, '', False, clNone, nil, nil, nil, nil, nil, nil, 0.0);
Loading:
Cell.GetRVData.Clear;
Cell.GetRVData.LoadRTFFromStream(Stream);
This is not an editing operation, it should not be used in editor (only when generating a new document, or inserting a new table with data).
Call rv.Format when finished.
RVF
As it was discussed in the topic mentioned above, cells cannot save RVF containing styles (without a workaround).
Actually, these methods were planned as private, what's why they have so many unclear parameters.
But it's very unlikely that they will be changed, so you can use them safely.
Saving:
Cell.GetRVData.SaveRTFToStream(Stream, '', False, clNone, nil, nil, nil, nil, nil, nil, 0.0);
Loading:
Cell.GetRVData.Clear;
Cell.GetRVData.LoadRTFFromStream(Stream);
This is not an editing operation, it should not be used in editor (only when generating a new document, or inserting a new table with data).
Call rv.Format when finished.
RVF
As it was discussed in the topic mentioned above, cells cannot save RVF containing styles (without a workaround).
Actually, these methods were planned as private, what's why they have so many unclear parameters.
But it's very unlikely that they will be changed, so you can use them safely.
Thanks for the response.
Let me make sure I'm clear. Because this is what I'm trying to do.
I'm going to load a series of saved richviews to a database. Then load these back into a table with cells assigned to another richview. I want the user to be able to make changes for whatever: bold, Italic, Color etc.. and then save these changes back to the database from the cells. If I understand you correctly this cannot be done using either RVF or RTF? Even if I funnel the cell back to a RichView and then save that back to the database?
John
Let me make sure I'm clear. Because this is what I'm trying to do.
I'm going to load a series of saved richviews to a database. Then load these back into a table with cells assigned to another richview. I want the user to be able to make changes for whatever: bold, Italic, Color etc.. and then save these changes back to the database from the cells. If I understand you correctly this cannot be done using either RVF or RTF? Even if I funnel the cell back to a RichView and then save that back to the database?
John
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
No problems with RTF.
Using Cell.SaveRTFToStream produces exactly the same output as saving from the main editor, so you can use RTF in your application.
If you want to use RVF for this task, it slightly more difficult.
You need to do it in several steps:
1) Save RVF from cell to Stream
2) Load this RVF in a hidden TRichView linked to the same RVStyle as the editor containing this table.
3) Saving from this hidden TRichView to database.
Even with using these 3 steps, saving in RVF may be faster than in RTF.
Using Cell.SaveRTFToStream produces exactly the same output as saving from the main editor, so you can use RTF in your application.
If you want to use RVF for this task, it slightly more difficult.
You need to do it in several steps:
1) Save RVF from cell to Stream
2) Load this RVF in a hidden TRichView linked to the same RVStyle as the editor containing this table.
3) Saving from this hidden TRichView to database.
Even with using these 3 steps, saving in RVF may be faster than in RTF.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
http://www.trichview.com/support/files/copyfromcell.zip
May be it looks a bit complicated, but the file/stream saving methods of cells were not planned initially as public methods.
You can simply copy the main procedures from this project to yours.
May be it looks a bit complicated, but the file/stream saving methods of cells were not planned initially as public methods.
You can simply copy the main procedures from this project to yours.