Page 1 of 1
insert text!
Posted: Mon Jan 20, 2014 6:27 am
by mohsen24000
Hi Dear
I want insert my content of Richview to dbase such as SQLite.
and I want detect my footnotes in document on dbase with "[F]"
for example:
in richview:
"If you do not want to add a poll to your topic1, leave the fields blank."
in dbase:
"If you do not want to add a poll to your topic[F], leave the fields blank."
also, I want insert document on dbase to Richview with replacement '[F]'
and it's footnote that saved in dbase.
thanks a lot.
Posted: Fri Jan 24, 2014 12:56 pm
by Sergey Tkachenko
Sorry, I do not completely understand the question.
Do you want to save documents as they are, with all available formatting, but save text "[F]" instead of footnotes?
What saving format do you use, RTF or RVF?
Is it really necessary to replace footnotes and then inserting them back? What if the user will type "[F]" in the document itself?
You can, for example, save a document with empty footnotes, then fill them from DB when necessary.
Posted: Wed Jan 29, 2014 8:22 am
by mohsen24000
for example:
Code: Select all
var ItemNo: integer;
ctext: TStringList;
begin
for ItemNo := 0 to R_Q.ItemCount - 1 do begin
if R_Q.GetItem(ItemNo) is TCustomRVNoteItemInfo then
begin
R_Q.SetSelectionBounds(ItemNo, R_Q.GetOffsBeforeItem(ItemNo),
ItemNo, R_Q.GetOffsBeforeItem(ItemNo));
R_Q.inserttext('[F]');
end;
end;
R_Q.BeginUpdate;
R_Q.SelectAll;
try
ctext:= TStringList.Create;
ctext.Text:= Trim(R_Q.GetSelTextW);
R_Q.Deselect;
R_Q.EndUpdate;
...
insert ctext items into dbase
...
finally
freeandnil(ctext);
end;
end;
Posted: Wed Jan 29, 2014 1:56 pm
by Sergey Tkachenko
You can use OnSaveItemToFile event to save footnotes as '[F]' in text:
Code: Select all
uses RVUni;
procedure TForm3.RichViewEdit1SaveItemToFile(Sender: TCustomRichView;
const Path: string; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; Unicode: Boolean; var OutStr: TRVRawByteString;
var DoDefault: Boolean);
begin
if (SaveFormat=rvsfText) and (RVData.GetItemStyle(ItemNo)=rvsFootnote) then begin
OutStr := '[F]';
if Unicode then
OutStr := RVU_AnsiToUnicode(CP_ACP, OutStr);
DoDefault := False;
end;
end;