Steaming with Table Cells

General TRichView support forum. Please post your questions here
Post Reply
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Steaming with Table Cells

Post by jwkerns »

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
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

Post by Michel »

There are some code snippets (and discussion) here: www.trichview.com/forums/viewtopic.php?t=236
HTH,
Michel
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Not RTF

Post by jwkerns »

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.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

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.
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Post by jwkerns »

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
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

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.
jwkerns
Posts: 15
Joined: Sun Mar 05, 2006 11:17 pm

Post by jwkerns »

Thanks for the Response.
I will try the rft then.
I tried exactly what you suggested for the RVF and it does not appear to work. Is this a suggestion or have you verified it will work. If you have it working could I see a code sample. Thanks.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

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.
Post Reply