Page 1 of 1
Move DBRichviedEdit(rve) contenets to DBRichEdit field
Posted: Wed Feb 16, 2011 11:30 pm
by agent86
I have a DBRichViewEdit, called 'rve' and I want to transfer the content to a DBRichEdit called 'FindingRTF'.
RVE is in RichView format, and I want the contents converted to RTF format and stored in a DBRichEdit called FindingRTF.
So I guess I want to convert the contents in a RichViewEdit and put them in a RichEdit.
I have now asked it 3 times so I will shut up and await an answer.
Posted: Thu Feb 17, 2011 10:11 am
by Sergey Tkachenko
Do you want to store data in the same field, or in another field?
1) If you want to store data in the same field (rve and FindingRTF are linked to the same field), you need to convert data from RVF to RTF.
The simplest way to do it is assigning rve.FieldFormat=rvdbRTF and calling this code (assuming that the field is in Table1):
Code: Select all
table1.First;
while not table1.Eof do begin
table1.Edit;
rve.Change;
table1.Post;
table1.Next;
end;
This code resaves rve content to all records. Since FieldFormat=rvdbRTF, it will be resaved as RTF.
2) If you do not want to modify the original data, you can save them as RTF using SaveRTFToStream.
Code: Select all
var Stream: TStream;
table2.Edit;
Stream := Table2.CreateBlobStream(Table2.FieldByName(FieldName2), bmWrite);
rve.SaveRTFToStream(Stream);
Stream.Free;
table2.Post;
The code above saves the content of rve to the field FieldName2 of the table2 as RTF (I assume that FindingRTF is linked to this field)
PS: I did not receive your previous questions about this problem
A misunderstanding...my apology to you...
Posted: Thu Feb 17, 2011 3:21 pm
by agent86
I apologize for your misunderstanding the last sentence of my post. I wanted to convey that I had stated the problem 3 different ways in this post. I did it 3 ways to make sure you understood what I was trying to ask. You did. Thanks
You did not ignore my question. There was only one post You are always prompt answering questions.
Sorry for the misunderstanding.
Donald
Posted: Thu Feb 17, 2011 5:05 pm
by Sergey Tkachenko
Ok. Does my answer help you? If you need additional information, let me know.