Beiträge von cps

    I use the following code to export a TBitmap image to PDF file.

    The code works fine except a blank page is added to resulting document every time. How to get rid of that?
    Component versions are WPTools 6 and WPDF 2

    TableCell.ASet(WPAT_BorderColor, colorindex)

    Setting a border for every cell means a lot of code overhead.
    Do any more global settings exist?
    Is this possible to set a table grid color for whole table or whole document in single code statement?

    Since by default it is black may be there are some means to change that default?

    I have a similar problem with WPTool 6 for D2010, not sure about the build number but there is no wpMarginMirrorBookPrint property in FormatOptionsEx2.

    I've made a global search on my source text *.pas files and didn't find wpMarginMirrorBookPrint there as well.

    How to make mirror margin settings to work normally?

    In my case wp.CPMoveNext() helped but it is not a general solution.

    The question is:
    How to navigate between the tables and select a specific cell in specific table?

    Can I get something similar to table handle and thereafter refer to it if I need apply, for instance, TableColNumber, TableRowNumber to any table in the document, not just to laste created/focused?

    P.S.
    It would be nice to have wptblPlaceCursorInFirstCell option to complement wptblPlaceCursorInLastCell flag.

    Thank you, the code really works.

    The only problem remains, I can't get back to parent table to insert another embedded table into other cell.
    TableColNumber, TableRowNumber are apply now to newly inserted table but not to top level one.

    // create parent 2x2 table
    tbl:=TableAdd(2, 2, [wptblActivateBorders, wptblPlaceCursorInLastCell]);

    // set cell of the parent table
    TableColNumber:= 0; TableRowNumber:= 0;

    // insert a first embedded table
    TableAdd(2,2, [wptblActivateBorders, wptblAllowNestedTables, wptblPlaceCursorInLastCell]);

    // set another cell of the parent table
    TableColNumber:= 1; TableRowNumber:= 0;

    // insert a second embedded table
    TableAdd(2,2, [wptblActivateBorders, wptblAllowNestedTables, wptblPlaceCursorInLastCell]);

    The last statement inserts a third table into inserted one, not into a top-level table.
    How to get a handle of the top-level (parent) table to manipulate with current row and column for that?

    I've tried to set a current cell of the parent by inputting a text to target cell, but it doesn't work, i.e. doesn't change a current paragraph.

    tbl.Rows[0].Cols[1].SetText('right table cell');

    Spammer would use this extensively to link in illegal content

    A strict new users evaluation and pre-moderation of their first messages may be a solution.

    You can make the font working on screen with
    WP.FormatOptionsEx2 := WP.FormatOptionsEx2 + [wpfUseKerning];
    WP.FormatOptions := [wpfAlwaysFormatWithScreenRes];

    Yes, those options make document looking almost the same as WP4 original. It seems everything works as it should now.

    Your customer support is still very good, you have saved many hours of my labor. Thank you much.

    The bitmap font does not scale correctly and the FontMetric method does not provide the correct values for it.

    But it worked correctly in WPTools 4.11d. May be you have lost some functionality during version 5 development.

    You will need a new font as replacement

    It's our own font used for more than 10 years in all versions of our products and there is no source to get a "new font" from. Actually, it is a set of 5 bitmap fonts and it is simpler for us to replace an WPTools with another component than to get rid of this font.

    This "bug" could have been checked quicker with more information about the application.

    The application is planet ephemeris. The program calculates planetary positions and displays those in table form. What additional information you need?

    BTW: The code ... works, but with Delphi 2010

    Yes, it is specially built for D2010. In D7 I used WP.Text= S where S is a string of raw programmatically generated RTF text.

    You have an unnecessary conversion to unicode string and back to ANSI.

    I don't make any conversion, I guess. TString L is used as a container to load raw RTF text from file. In real application S AnsiString used as such a container.

    The problem here is solely the font. That is no TTF font - in fact it is a bitmap font and it does not scale correctly.

    Yes, it's not a TTF font but a bitmap one and there was no such problem in previous WPTools versions.
    BTW any small to medium size font we see on a screen of MS Word is actually a bitmap font. I am using a special TTF font for printing only. This is only a way to make both screen view and printed paper documents sharp and crisp.


    TTF vector fonts look on a screen acceptably only in case of very big size. Verdana TTF you see in MS Word screen actually one of MS Sans Serif bitmap fonts. Automatic rendition of TTF into bitmap screen image makes font jigged as you might see on the above screenshot.

    Anyway, thank you for your help, many things are clear now.

    P.S.
    It would be convenient if you allow forum attachments or inline images. Upgrade to phpbb3, it is much, much better and also is free.

    Yes, the document on a link is unreadable with external editors but this is exactly an S string that is loaded into TWPRichText component and worked with older versions fine.
    ===========
    WPText.Text:= S;
    AddFooterHeader(WPText);
    WPText.ReformatAll();
    WPText.Show();
    ===========


    In case an RTF document is created in usual way with WPTools means (AddTable, InputString) it also look different and it is not design time issues because page orientation, font size and margins are defined programmatically at runtime like this:
    ===========
    LayoutMode:= TWPLayoutMode(kw.LayOutMode);
    MemoryFormat:= fmRichText; WP.TextLoadFormat:= 'AUTO';

    Header.DefaultMarginHeader:= ppref.HeaderMargin;
    Header.DefaultMarginFooter:= ppref.FooterMargin;

    DefaultPageSize:= wp_Letter;

    DefaultLeftMargin:= InchToTwip(http://ppref.lft/100);
    DefaultTopMargin:= InchToTwip(http://ppref.upp/100);
    DefaultRightMargin:= InchToTwip(http://ppref.rgt/100);
    DefaultBottomMargin:=InchToTwip(http://ppref.bot/100);
    DefaultPageWidth:= PixToTwip(ppref.PWIDTH, ppref.DPI);
    DefaultPageHeight:= PixToTwip(ppref.PHEIGHT, ppref.DPI);

    PrintParameter.PrintHeaderFooter:= wprOnAllPages;
    WP.Header.Landscape:= GetDocOrientation(kw.ActRep)<> poLandscape;
    ======================

    Yes, I was wrong about previously used version, it is not 5 but 4.11d

    This is how document looked before migration to 6th version


    and this is how it looks now


    1. Incorrect font display in table title
    2. Incorrect table cells size
    3. No page number in a header
    4. Incorrect paper size/appearance in component window

    Thank you, AsString really allows to load a raw RTF code but there is a lot of misformatted text elements (fonts, tables, margins) now in document and it looks awful.

    Is there any way to switch engine into version 5 compatible mode or I must redo all my text generators source code to comply with WPTools 6 requirements?