Table margins not restored properly if indented

  • This is hard to explain, but if a table is indented, the right margins do not restore properly when saved and reloaded.

    1. Create several paragraphs, and indent about 1 inch or so.
    2. Create a 1x1 table on one of those indented paragraphs
    3. Note that the table's left edge does not honor the paragraph's indent (unexpected but not important for this example)
    4. Drag left edge of table to the margin we had indented, i.e. 1 inch or so.
    5. Place text cursor inside table cell and make a note of the right margin and the table's right margin indicators in the ruler (looks to be about the same position)
    6. SaveToFile and restore it via LoadFromFile
    7. Place cursor in the table cell once again
    8. Note that the right margin has moved left by the indent amount, yet the table right margin indicator is still at the position it should be.

    This gets worse if you moved the left edge of the table more than the right margin amount (i.e. if the right margin as half an inch and you then moved the left edge of the table one inch to the right)... example:

    1. Create several paragraphs, and indent about 2 inches or so (more than whatever the right margin is... say for example the right margin is 1 inch).
    2. Create a 1x1 table on one of those indented paragraphs
    3. Note that the table's left edge does not honor the paragraphs indent (unexpected but not important for this example)
    4. Drag left edge of table to the margin we had indented, i.e. 2 inches or so.
    5. Place text cursor inside table cell and make a note of the right margin and the table's right margin indicators in the ruler (the right margin is at the page right edge, and the table's right margin is off the page... unexpected).
    6. Drag the right edge of the table back onto the page and note the right margin and table's right margin indicators on the toolbar (should be about the same)
    7. SaveToFile and restore it via LoadFromFile
    8. Place cursor in the table cell once again
    9. Note that the right margin has moved left by the indent amount, yet the table right margin indicator is still at the position it should be.

    Now when you key in text, it wraps at the page margin not the table margin (text only partially fills the cell) because the page margin is not corrrect.


    In any event, the save and reload does not produce the table in the state is was before the save.


    WPTools 5.19.1
    Delphi 7

    Eric

    • Offizieller Beitrag

    Hi,

    tested with V5.19.0 and the latest in my case the table stays 100% where it was. I tried load&save in RTF and WPT format.

    The fact that the inserted table does not respect the indent is a matter of the implementation of th CreateTable action. It would be possible to have it start at the current indent - but I do not think that would be what the user expects.

    Julian

  • Still a serious issue with table sizing, even with wpDisableAutosizeTables enabled or disabled.

    If the table is indented, it does not set the width properly when reloading.

    See below for the original RTF, then the RTF after saving and reloading. The reloaded table is very narrow

    Original:

    After save/reload:

    Saving/Loading using LoadFromFile/SaveToFile seems to work fine, it is only when saving to a database field as type ftBlob where I appear to have problems. Using Advantage Local Database SQL like this:

    Code
    SQL.Add( Format( 'UPDATE ReportComments' +                 ' SET Comment = :memoData' +                 ', CheckboxesChecked = ''%s''' +                 ' WHERE ReportID = ''%s''' +                 ' AND CommentID = ''%s''',                 [ cbCheckedList.Text,                   curReport.ReportID,                   curComment.CommentID ] ) );ParamByName( 'memodata' ).DataType := ftBlob;ParamByName( 'memoData' ).AsBlob := WPRichText_Cmt.AsString;ExecSQL;

    And read it back in using:

    Code
    WPRichText_Cmt.AsString := FieldByName( 'Comment' ).AsString;

    WPTools 5.19.4
    Delphi 7

    Eric

  • I found a temporary get-around that appears to get me going again. I first read in the rtf from the database into a temp WPRichText then assign it to the real WPRichText using AsANSIString as follows:

    Code
    WPRichText1.AsString := FieldByName( 'Comment' ).AsString;
    WPRichText_Cmt.AsString := WPRichText1.AsANSIString( 'WPTOOLS' );

    Must be something I'm doing wrong?

    Eric