Posts by wpsupport

    LineData is actually fine to use, it will no change. So you can use the x and y offset parameters stored there.

    Code
     // Attempt to find the last paragraph inside the cell.
                  while Assigned( par ) do
                    begin
                      Param.UseUntilIncludingPar := par;
                      par := par.Next;
                      if not cell.Contains( par ) then
                        par := nil
                    end;

    Note: par := par.Next;

    will loop the entire text and and will skip from cell to cell etc.

    If you want to loop siblings use NextPar. Inside a cell the firest netsted paragraph is cell.ChildPar and

    all others are found by par.NextPar.

    As far as I can see your box is around the bounding box of a line, that should be possible with the event mentioned above. What is not supported is a box around some characters, not to speak with a word wrap.

    If you want to highlight this, I recommend to assign attributes dynamically, possible in even OnInitializeParagraph.

    Of course you can use the linedata and virtpage records in your code. But that is not a documented API.

    Well, this is a word processor. It already has a lot of capabilities.

    Code
    I want to draw a visual marker around the content which can be edited, like an edit box or an input field. The visual marker should only wrap the editable content, not the whole cell.

    I don't see a way this is possible. You can assign a property to the "editable" text, similar to the edit fields and the hyperlinks. But having a rectangle around some part of the text inside a paragraph is not possible.

    This is some code I found here

    What is the pupose to do this?

    Quote

    I want the rectangle to be aligned with the table cell.

    If you want to render custom graphics around lines or paragraphs there are some events to do this the best way.

    Check out OnCustomLinePaintBefore and OnCustomLinePaintAfter - that makes it possible to draw under and over the text. You can use it to change the rendering depending on the contents of the text.

    I do not recommend to access the internal datastructures like in the code mentioned above. GetXYPositionAtRTFT is there to show overlay windows, not to paint.

    This example highlights the current table row:

    procedure TForm1.WPRichText1CustomLinePaintBefore(
      Sender: TObject;
     RTFEngine: TWPRTFEngineBasis; param: TWPVirtPagePaintParam;
     EndOfPageRun: Boolean);
    begin
     if (WPRichText1.TableRow<>nil) and WPRichText1.TableRow.Contains(Param.Par) then
     begin
       Param.Canvas.Brush.Style := bsSolid;
       Param.Canvas.Brush.Color := $eaefea;
       Param.Canvas.FillRect(Param.Rect);
     end;
    end;

    You have access to the relevant source code in WPCtrMemo.pas - I recommend to check that out.

    There are multiple ways to change the clipboard behavior using the ClipboardOptions, for example to only allo plain text.

    You can use the event BeforePaste to preprocess the loaded text before it is being inserted.

    I assume the problem is caused by the text not to be formatted.


    1. I recommend to create a TWPCustomRTFEdit class instead of TWPRichText.

    2. Instead of Create(nil) call CreateDynamic. The latter makes sure the control works without a parent form.

    3. Call ReformatAll twice before Print, not before and not Refresh.


    Use the component in a DLL is a problem? I neep only the PDF convertion then I set visible = False;

    That can be a problem since this also potentially violates the license.

    *** WPTools 9.4.0.1 - 26.4.2025
    + WPReporter AddGroup now knows the mode wpatWrapSelection to wrap text to be inside of a group
    + OptIgnoreEmbeddedImageData for HTML and WPT format reader
    + overlay text painting for images available trhough PaintObject event
    * improved performance in tool bar creation

    *** WPTools 9.4.0.0 - 27.3.2025 *** INITIAL RELEASE 9.4
    1) Much enhanced SVG rendering engine (Only for Delphi 10.1 and later!)
    + SVG Rendering in TWPToolsBar
    + SVG Image object to implement GUI
    + SVG image list style (select glyphs by column/row)
    + SVGColorMap list to update selected colors in the SVG to match theme or state of a control
    + shared SVG resources for different buttons

    2) improved class TWPSvgImage (Only for Delphi 10.1 and later!)
    Displays a whole SVG or just an element. Show shape in background. Supports dynamic changes of SVG
    rendering color on mouse events, not only globally, but also based on a row/col area. (Implement touch controls)

    3) new class TWPSvgButton (Only for Delphi 10.1 and later!)
    Like a TButton but also with a glyph loaded from SVG.

    4) new class TWPSvgStorage (Only for Delphi 10.1 and later!)
    Stores the SVG data for one or more buttons or images.

    5) Improved formatting routine "WPRTEFormatH"
    This formatter can be customized much easier to handle each paragraph, table, row and cell in a certain way.
    It triggers events during formatting, i.e. to manipulate the rectangle where text is placed.
    The formatter makes special formatting logic possible. Please ask us for our offer to do custom enhancements on
    this versatile formatter for reasonable costs.

    6) Improved TWPToolbar
    Better support for Themes. Optionally use SVG rendering.
    Optionally rendered transparently.

    7) Improved HTML support
    + optional read <title>...</title>
    + option "-useCR" - create page breaks when \r\n is read (for lazy encoded HTML)
    + optionally suppress &nbsp; for empty paragraphs
    + optionally suppress style parameters for UL lists
    + suppress WPReporter bands
    + write a special class=... for paragraphs which are empty (const WPHTML_EmptyPInHTML)
    + trigger event BeforeSaveTextObject before a text objects is saved.
    + trigger event AfterSaveTextObject after a text object was saved
    + customize the tags written for text objects through collection WPTextObjectClasses
    + support "class" extra property for TextObjects
    + write mail merge tags using the tag defined in constant WPHTML_MERGEFIELD_TAG
    + read <pre> and create a text object around this section (optionally: $DEFINE HTML_HTML_PRECODEOBJ}
    * some improvements: save image width/height

    8) improvement in RTF-Engine
    - Alignment of bullet paragraph in a table cell
    * Undo in Tables
    * several additions to API
    * handling of Inc/Dec Indent with bulleted paragraphs

    Last Changes in WPTools 9.3 (Service time: 23.6.2022 - 1.3.2025)

    *** WPTools 9.3.9.3' - 1.3.2025 ***
    * changed unit WPUtil.PAS. With certain Delphi Compilers the interfaces used in the code caused Problems.
    We are now using an interface object to aviod this problems.


    *** WPTools 9.3.9.3 - 25.2.2025 ***
    - improve display of style name in style Dialog for styles with numbering
    + new flag wpAlwaysIgnoreAllPadding in WPFormatOptionsEx2 to reduce table cell size
    * some fixes in spellcheck (included with WPTools Premium)

    *** WPTools 9.3.9.2 - 8.12.2024 ***
    + new global variable in unit WPIOReadRTF: wpRTFReadLimitParDepth
    Assign 10 or a higher value to make it possible to load documents with too deep table nesting which would
    break the editor otherwise.
    - fix Display of footnote number
    - In BeforePasteImage ist is possible FreeAndNil the inserted object
    - handle case when an Image has width or heigh = 0
    - new load Option loCallClearSelectionBeforInsert
    * some fixes and API enhancements in unit WPXMLInt

    ....

    The upcoming WPTools 9.4 will have the ability to paint the icons completely as vectors. The vector is loaded from one SVG file which uses SVG glyphs arranged in rows and columns. This makes it eays to change the complete design of a program easily. Forthermore during paint it is possible to replace certain colors with different colors, not only to adapt for dark/light theme but also to show hover evects.

    Do get more out of the prowerful SVG engine there will a new button class TWPSvgButton which is similar to the good old TBitBtn but displays a SVG glyph. The buttons can get their SVG data from a TSVGStorage object which is shared for different elements. They can then just display a part of that data, indentified by row/column.

    Comparision

    Display in WPTools 9.3

    screen_93.png

    The same program compiled with WPTools 9.4

    screen_94.png

    When you work with themes you can now also make the toolbar and buttons transparent. This makes the UI much more attractive.


    screen_94_transparent.png

    WPTools 9.4 is expected soon