PageNumberOffset, HideInsertPoints

    • Offizieller Beitrag
    Zitat

    I had found, I mean, didn´t find two properties and one event that I was
    using. Is there any workaround for these?

    Properties:
    - PageNumberOffset (I was using to allow the user to define a "start
    page number")
    - HideInsertPoints (It was part of the "mailmerge" process. I don´t
    know if it is needed anymore, maybe it´s the "default behavior")

    PageNumberOffset is not supported anymore since the new algorithm is much more complicated in taking care that multiple documents printed in one printing cue get correct numbers (BeginPrint/EndPrint)

    You can modify the page numbering on the fly using the OnTextObjGetTextEx event. You will need to read the precalculated the value and modify it acording to your needs.

    HideInsertPoints did not only hide the mailmerge fields, it also deletes them when the file was saved. To hide them use
    InsertPointTextAttr.Hidden := TRUE;
    to delete them save the document with the format string
    'RTF-nomergefields'; Of course procedure DeleteFields can also be used.

    Zitat

    Event:
    OnParagraphAttrChange (It was used to update a toolbutton that shows
    the active "space between" value. I could use OnChangeCursorPos, but it is fired for each character change, not paragraph change.

    Since this event is triggered in idle times it shgould not slow your application down, please use OnChangeCursorPos

    Zitat

    Also, about the "NumberOfCopies" property. Do you intend to add it to the next releases?

    Not decided yet. Printer.Copies worked pretty well.

  • I'm trying to use your example using OnTextObjGetTextEx to adjust the page number since I might like to have a new section start page numbering at "1". For example, I'd like to have a two page cover page included, where physical page 3 starts numbering with "1 of 8". (i.e. total physical page count of 10 due to the two page cover page).

    However, when the TXTObject.Name= 'PAGE' as in your example, PrintString is always empty when using your WPPreviewDlg. Has a new page numbering technique been implemented?

    I tried the OnCalcPageNr event, and had the following code in it:

    Code
    ShowMessage( Format( 'Obj=%s, RTFPage=%d, PaintPage=%d, PrintedPage=%d',
                           [ TextObject.Name, RTFPageNr, PaintPageNr, PrintedPageNr ] ) );

    But the only time the sequence of messages made any sense was when I exported to a PDF file (i.e. PAGE/NUMPAGES cycled from 1 to number of pages as expected). When doing a Print Preview with WPPreviewDlg, it did not seem to fire.

    WPTools 5.20.2
    Delphi 7

    • Offizieller Beitrag

    You can use OnCalcPageNr - you have to use PaintPageNr (param #4) to calculate PageNr (param #5)

    When using TextObjGetTextEx PrintStr has to be empty at first (since a few releases.) Setting it to a certain value overrides the intern logic.

    Use the variable WPRichText.Memo._CurrPaintedObjPageNumber to calculate yor page number.

    Julian

  • OK... I'm back revisiting this and I can now adjust the pagenumber in TextObjGetTextEx when the text object is 'PAGE', but for the life of me, I can't figure out how to adjust the page count for Text Object 'NUMPAGES' since I don't know what page I'm on when getting the 'NUMPAGES' text object (WPRichText.Memo._CurrPaintedObjPageNumber seems to be meaningless during this event)

    For example, the whole doc might be 10 pages, but I want the pages numbered like this in both print preview, printed and when exported to PDF:
    1 of 1
    1 of 5
    2 of 5
    3 of 5
    4 of 5
    5 of 5
    1 of 4
    2 of 4
    3 of 4
    4 of 4

    I hope it is something simple that I'm just not seeing.

    WPTools 5.202
    Delphi 7

    As always, thanks!

  • Sorry, but I'm not sure I understand how that answers my question as to what page i'm on in order to modify the NUMPAGES in OnTextObjGetTextEx so that I can adjust NUMPAGES on the fly depending on what physical page is being printed.

    Or I'm just way out in left field and have to look at this problem in another light.

    • Offizieller Beitrag

    Hi,

    >>Sorry, but I'm not sure I understand how that answers my question as to what page i'm on in order to modify the NUMPAGES in OnTextObjGetTextEx so that I can adjust NUMPAGES on the fly depending on what physical page is being printed. <<

    _CurrPaintedObjPageNumber is always defined - as long as the function is called within the paint routine. It can be undefined when called by the initialzation routine, but that does not do any harm.

    Julian