problem with footnote

General TRichView support forum. Please post your questions here
Post Reply
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

problem with footnote

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

Post by Sergey Tkachenko »

Are you sure that you insert TRVFootnoteItemInfo, not TRVNoteReferenceItemInfo?
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Post 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]
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Post by alexandreq »

Solved,

thanks
Post Reply