Page 1 of 1

problem with footnote

Posted: Fri Feb 03, 2012 7:36 pm
by alexandreq
Hello,

I have a DBSRichViewEdit1 and a TrichViewEdit

When I insert a footnote, in my DBSRichViewEdit1 is added the number 1 and it is ok, but when it is insert into TrichViewEdit (footnote), it is inserting '?' and not the number 1.

Why? What's wrong?

I debugged and all the code is the same of your example.

Thanks

Posted: Sat Feb 04, 2012 5:04 pm
by Sergey Tkachenko
Are you sure that you insert TRVFootnoteItemInfo, not TRVNoteReferenceItemInfo?

Posted: Mon Feb 06, 2012 10:08 am
by alexandreq
Hi, it is correct, take a look at the code:

this is the code:

procedure TFTMNLeitor.insertFootNote;
var
FootNote : TRVFootnoteItemInfo;
NoteRef : TRVNoteReferenceItemInfo;
Editor : TDBSRichViewEdit;
Rvs : TRVStyle;
Begin

Rvs := Editor.ExternalRVStyle;
FootNote := TRVFootnoteItemInfo.CreateEx(DBSRichViewEdit1.RichViewEdit.RVData, RVGetNoteTextStyleNo(Rvs, DBSRichViewEdit1.RichViewEdit.CurTextStyleNo), 1, False);
NoteRef := TRVNoteReferenceItemInfo.CreateEx(FootNote.Document, RVGetNoteTextStyleNo(Rvs,0));
FootNote.Document.AddItem('', NoteRef);
FootNote.Document.AddNL(' ', 0, -1);
if DBSRichViewEdit1.RichViewEdit.InsertItem('', FootNote) then
rveNote.SetFocus;
End;



procedure TFTMNLeitor.EditNote(NoteItem: TCustomRVNoteItemInfo);
var
Stream: TMemoryStream;
begin
if FActiveNoteItem = NoteItem then
exit;
FActiveNoteItem := NoteItem;
rveNote.NoteText := rveNote.NoteText; // this text is displayed in
// TRVNoteReferenceItemInfo items

rveNote.Enabled := True;
rveNote.Color := clWindow;
rveNote.Clear;
Stream := TMemoryStream.Create;
try
NoteItem.Document.SaveRVFToStream(Stream);
Stream.Position := 0;
rveNote.LoadRVFFromStream(Stream);
finally
Stream.Free;
end;
with rveNote do begin
Format;
SetSelectionBounds(ItemCount-1, GetOffsAfterItem(ItemCount-1),
ItemCount-1, GetOffsAfterItem(ItemCount-1));
end;
end;



in my DBSRichViewEdit1, it insert the number correctly but in my footNote, only an exclamation.

Why?[/img]

Posted: Mon Feb 06, 2012 5:24 pm
by alexandreq
Solved,

thanks