TXT / HTML Export - Headertext Problem

  • When I export a report to plain ascii text,
    a) The header information does not get transferred. It works ok when previewed/printed from WPtools, but not when exported. The inserted fields (date, time, special static fields etc) are blank.

    b) It seems and extra character is in place after each record (#10/$0A) when exported as TXT.

    c) I have a report which is usually printed, but sometimes exported (and the customer does not want to have to define duplicate reports!). When printed there are 4 pages, and the page count in the footer correctly says 1 of 4, 2 of 4 etc. When exported to HTML, I know there will only be one page, but at the very bottom, where ther footer shows, it says page 6 of 5!! That is clearly a bug in the exporter. Surely it should just say Page 1 of 1!

    Any ideas on what is happening - (a) is the most important bug. Is this supposed to work,is is a known problem, or my fault?! :)

    • Offizieller Beitrag

    a) and c) are connected. In unit WPWrite2 (line 463..) you will find the code which converts the fields into text:
    p := FMemo.TxtObjLst.Data[save_pa^.tag]; // V4.x
    if (p <> nil) and (p^.obj <> nil) and (p^.obj is TWPObjectField) then
    ...

    Here it is possible to add special code to handle fields which are not always known at export time, most important PAGE and NUMPAGES:

    b) I assume each record means 'each page'? The #10#13 codes are written in procedure WriteParagraphEnd and it apperas to be to be the correct way in ANSI mode.

    (Note: I combined your two posts since they were related)

    Julian Ziersch

  • I still have exactly the same problem, if I insert that code you gave (and define that compiler directive).

    a) On HTML reports fields /data inserted into headers DO get replaced (date, time, report title, site address etc)
    On RTF and TXT exports, those extra fields are blank. (Or they do not effectively appear). It is missing the data

    b) In RTF exports, the page numbers or ok (since they are rtf footers with NUMPAGES/dynamically created info). In HTML, I still get Page 6 of 5 (when there is only one footer, so it is only 1 long page).

  • In RTF export, I can see that in the raw file, there are special RTF "field" tags where the actual data for those fields should be.
    Normal data is replaced ok, just these special ones which are static information.
    IN the RTF I still get {\field{\*\fldinst{*UserName}}{\*\fldrslt{*UserName}}} for example, where the logged in username should go. For printing/preview/HTML etc, this works ok - my program picks up the event and gives the field a value. But for RTF exports, only this field tag is inserted, not the data the program gave it.

    In HTML exports this works ok, my program replaces the data and no codes are in the HTML