Footnotes - transferring, numbering

General TRichView support forum. Please post your questions here
Post Reply
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Footnotes - transferring, numbering

Post by Jim Knopf »

In Patchwork - application where I use RichView - a novel is a collection of a lot of rtf files, one for each scene. To print I transfer all the single files in one document which is saved as rtf document to be printed, published and what else.

1. problem: in style1 belonging to the writing window, footnotes are TextStyle 16. The transfer to the complete doc is realized via stream. How can I tell the second TextStyle of the TRichViewEdit, responsible for export, which TextStyle is the associated for footnote (because of superscript)? Same numer doesn't work, same name of style not as well

2. problem: Footnote numbers in the text are shown well but there is no number in front of the text of the footnote. So it's not possible to assign footnotes and numbers in the text
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1. Do you use a fixed collection of TextStyles? If not ("allow adding styles dynamically" option is set), allow TRichView to map styles automatically.
Use a code like this:

Code: Select all

procedure AddDoc(Stream: TStream; rv: TCustomRichView); 
var ItemCount: Integer; 
begin 
  ItemCount := rv.ItemCount; 
  Stream.Position := 0; 
  rv.InsertRVFFromStream(Stream, rv.ItemCount); 
end; 

rv.Clear; 
rv.DeleteUnusedStyles(True, True, True); 
// streams contain RVF documents
AddDoc(Stream1, rv); 
AddDoc(Stream2, rv); 
AddDoc(Stream3, rv);
rv.Format;
The source RichView and the target RichView (rv in this example) are linked to different RVStyles.
If rv.Style already contains a text style having all necessary properties, it will be used. If not, a new text style will be added.

2. Initially, documents of notes are empty. You need to insert a "note reference" item in it. This item displays a number of the parent note.
If you use RichViewActions, the actions for note insertions add "note reference" and a space character in documents of new notes. And, when a footnote document is being edited, "Insert Footnote" action actually inserts not a footnote, but a "note reference".
If you do not use RichViewActions, you can find examples:
- in the help file: http://www.trichview.com/help/idh_class ... minfo.html
- in the demo project Demos\DelphiUnicode\Editors\Notes
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

Thank you, the first problem I could solve. Although the logic is a bit confusing.

But #2 is dogged. As I implemented footnotes I did it as described in your demo example you mentioned. I checked it now once more. It always worked fine because I used footnotes for internal to dos. But now I need footnotes alternatively for real footnotes too.
And now I can't find any footnote reference in the footnote text of the exported rtf file. If I open it in Word, the footnote number is shown in the text properly, the footnote text at the bottom of the page too but without the necessary leading number. So you don't know which text belongs to which footnote.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

Maybe a problem of an elder version of Word. With Word 2013 it works, numbering of footnote appears in front of text at bottom of page.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

Strange. I don't think that it is Words problem. If I enter a footnote in old Word it works. If I enter footnote in RVEdit it doesn't.

Thies code works - input in word:

Code: Select all

{\f28\lang0\langfe1031\langnp0 Mir war nicht wohl in meiner Haut, als ich die ausladende Treppe in den ersten Stock der Zentrale hoch stieg. }{\cs16\f28\lang0\langfe1031\super\langnp0 \chftn 
{\footnote \pard\plain \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 {\cs16\super \chftn }{ Allererste Fu\'dfnote}}}
this one doesn't work: doesn't generate numbering, comes from RVEdit:

Code: Select all

{\f28\lang0\langfe1031\langnp0  
Probleme auf der sachlichen Ebene war ich gewohnt zu l\'f6sen. Da gab es selten Schwierigkeiten. Und wenn, wurden diese mit ebenfalls sachlichen Argumenten ausdiskutiert, und dann ein logisch nach vollziehbarer L\'f6sungsweg eingeschlagen. }{
\f28\cf7\lang0\langfe1031\super\chshdng0\chcfpat0\chcbpat6\langnp0 \chftn {\footnote \pard\plain \ql \fi150\li0\ri0\sb120\sl300\slmult1\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 {
\f28\lang0\langfe1031\langnp0 1 Fu\'dfnote Nummer einssss}}
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The second RTF code really does not contain a note reference in the footnote text (i.e. inside {\footnote ... })
This reference is \chftn (used both for a footnote and for a note reference).

But these codes do not look like generated by TRichView; for example, TRichView never writes \nowidctlpar or \langfe.
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

This moment I generated this text with tRichView. No other program touched it. And if opened it in Word there was not numbering in front of the text at pages bottom.

Code: Select all

{\rtf1\fbidis\ansi\ansicpg0\uc1\deff0\deflang0\deflangfe0\fet2{\*\ftnsep\pard\plain\chftnsep }{\*\ftnsepc\pard\plain\chftnsepc}{\fonttbl{\f0\fnil Verdana;}}{\colortbl;\red128\green255\blue128;\red255\green255\blue193;\red0\green128\blue0;\red255\green255\blue0;\red255\green0\blue0;\red0\green128\blue192;\red255\green176\blue225;\red237\green236\blue228;}{\*\listtable{\list\listtemplateid1794670078
\listid533328379}
}
{\*\listoverridetable
{\listoverride\listid533328379\listoverridecount0\ls1}
}


\pard\sl300\slmult1\fi150\li0\ql\ri0\sb120\sa0\itap0 \plain \f0\fs24 A new Text written in this moment. Footnote inerted here: \plain \f0\fs24\chcbpat5\cf4 \chftn{\footnote{}
\pard\sl300\slmult1\fi150\li0\ql\ri0\sb120\sa0\itap0 \plain \f0\fs24 Footnote text}
\par \plain \f0\fs24 And now saved.\par}
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, this RTF does not contain a reference to footnote.
Please send me the original RVF document to richviewgmailcom
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Post by Jim Knopf »

now, after very good assistance of Sergey I won't conseal the reason of this adventurous problem:

1. RichViewSettings of both RVEdits should be identical
2. Both RVEdits should use the same RVStyle component

Otherwise everything works but there is no footnote number in the footnote text
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

A small correction: the same RVStyle component must be used if the editors use a fixed set of text and paragraph styles.
Post Reply