5.12 Page count explodes

  • I've just converted from 5.10 to 5.12 and now when using LoadFromFile I'm getting 1,242,437 pages created in TWPToolsEditor.

    It was working 5.10

    I'm creating the editor in a DLL, here is my code:
    ---------------------------------------------------------------------------

    library WCEditor;

    uses
    SysUtils, Controls,
    Forms, WPRTEDefs,
    Classes,
    wpDefEditor;

    var
    DocEditor : TWPToolsEditor;

    function ShowPreview(AHandle: THandle; ACaption, FileName: pchar; GetVal, SetVal: pointer): Longint; stdcall;
    begin
    Application.Handle := AHandle;
    if DocEditor = nil then
    DocEditor := TWPToolsEditor.Create(nil);
    with DocEditor do begin
    Caption := ACaption;
    WPRichText.LoadFromFile(FileName, true);
    WPRichText.ClickableCodes := [wpobjMergeField];
    ShowModal;
    Application.Handle := 0;
    end;
    end;

    exports
    ShowPreview;

    begin
    end.

    While debugging, the file load up quickly but on the ShowModal command it pauses and creates the 1mil+ pages.

    Can someone give me an idea of where to start looking?

    Thanks!
    Mike

  • Julian,

    I'm using the DLL in my app only and am the only developer. It's a large app so I'm breaking functionality out in DLL's.

    PageWidth = 15840
    PageHeight = 12240

    Pages look properly sized when viewing. First page contains the proper text, all other pages are blank but include the footer if one has been defined.

    Loading the first RTF usually works fine, when I load the second RTF that's usually when the problems start. I've traced it down to:

    in:
    WPRTEDefs / TWPRTFdatablock.getpagecount:

    FPageList.Count returns 671 which then becomes the page count

    I still need your help!

    Mike

  • Julian,

    I just compiled mini.exe and did a file / load with one of my test rtf documents. It also produces many pages (complete with footers) every time I load the file.

    I ran the same rtf using WPT5TBXDemo and could not get it to produce the same results..

    Strange..

    • Offizieller Beitrag

    Hi,

    thanks for sending the file. I do not have the problem, neither with the MINI exe dated 30.1.2005 or with my current code (I in fact optimized the footers)

    I would not revert to 5.10 since there are many many improvements in R12. I recently had a page exploding problem I am now tracking down.

    You can also switch off SpeedReformat in the FormatOptions. I am not sure but this might still cause some problems.

    If you have a demo which reproduces the problem everytime please send me source AND exe.

    Julian Ziersch

  • Julian,

    I have built and forwarded you Mini.exe / source / map, along with several sample rtf files that show the issue everytime (for me).

    It will be interesting to find out what the problem is. I have uninstalled and totally re-installed WPTools 5.12 just to make sure it was nothing I introduced.

    Good Luck!

    Mike

    • Offizieller Beitrag

    Hi,

    I traced the problem to a bug which was only visible when debugging was off (no define WPDEBUG) and fixed it.

    R5.12.1 is now online:

    - fixed bug in format routine which was only visible when optimation was off
    - fixed bug with SpeedReformat when paragraph at page break wrapped.
    - fixed bug in reformat routine which caused wrong positioning of movable images which were too large
    * improvement of scroll function: Scroll to selected object instead of anchor
    * The footer now always starts at the bottom of the page with MarginFooter distance.
    If you need the old behavior with the footer to start at the beginning of the footer
    use FormatOption wpFooterMinimumDistanceToText
    + option: "-nobinary" to save RTF code with hex encoded data
    * the RTF writer interpreted OptOnlyBody incorrectly and so didn't write some RTF tags
    - fixed problem with KeepTableOnPage and movable images
    * improvement to EditOption wpAutoDetectHyperlinks to automatically exit a link when
    space or ')' is typed.
    - fixed problem with seletion of textobjects or codes with mouse
    * started implementation of character styles
    + save binary RTF variables
    - fixed bug when reading WPTools 4 mail merge fields
    - removed problems which occured when cursor was at the end of a line

    Julian