Beiträge von dekkert

    Hello Julian,

    I changed my approach to use your format information. I work now with table and columns. I have set the columns that there is no line break, and everthing is disiplayed in one line.

    I believe I work in pts (1/1440 inch)

    But the results are crazy:

    First a picture:
    [Blockierte Grafik: http://www.autopoll.de/files/wptools.jpg]

    a=1014 is my internal size of the column, if I add all these values for the columns I have exakt the place between left and right margin. Therfore, that's ok.

    After showing the editor, I have for test purposal, a doubleclick event, than I search recursivly for the cell/paragraph and have a look.

    Code
    procedure TtgBaseWPReport.FindPar(par:TParagraph);...begin  while par <> nil do    begin    s := par.GetText();    b := par.TextAreaWidth; //Soll-Breite, der Zelle, Section oder Zeile    c := 0;    for i:=1 to length(s) do      c := c + par.CharPos[i-1].Width;    if c > b then      ...    FindPar(par.ChildPar);    par := par.NextPar;    end;end;

    b = 931 is the textwidth of the cell, ok a little bit smaller than a, because of margin, border or padding.

    but c = 542 can't be true. Because you can see in the picture, the text is to long.

    I have tried to work with a resolution of 600, your wrote in your last reply.

    Code
    c := c + Round(par.CharPos[i-1].Width * (1400/600))


    But then also c is to large.

    How can I calculate c?

    Thanks for your help.

    Zitat von wpsupport

    The paragraphs have an Array CharPos - that contains w elements which represent the width in Pixels measured in render resolution - Memo.CurrentXPixelsPerInch.

    I need the width before I put the text to the document.
    I can't format the whole document after each piece of text.

    Therefor I have a format Paragraph:

    Code
    cha := FWorkItem.rtf.AttrHelper;    cha.Clear;    cha.SetFontName('Arial');    cha.SetFontSize(8);    FWorkItem.formatPar := FWorkItem.rtf.ActiveText.AppendNewPar;    FWorkItem.formatPar.SetText('<undef>',cha.CharAttr);

    I use this to cut the text, in the place cw calculated before:

    Code
    FWorkItem.formatPar.setText(s);  w := 0; i:=1;  while (w<cw) and (i <= length(s)) do    begin    w := w + FWorkItem.formatPar.CharPos[i-1].width;  //(1)    i := i + 1;    end;  Result := Copy(s,1,i-1);

    After all I delete the Paragraph:

    Code
    FWorkItem.formatPar.DeleteParagraph;


    The problem is now: CharPos is empty LOW(CharPos) = 0, High(CharPos) = -1 and a GeneralProtectionFault in (1).

    Thanks for your help.

    Best Regards Andreas

    Hello

    I'm working now with WPTools 7, the problem was in WPTools 5 also.

    I have to print tables, with different sum-rows and I optimize the place between the columns. Because of that I have since many years a own algorithm with word wrapping.

    All I need is a accurate text with.

    I have a cell or a paragraph, and the Font is set
    Now I want to know the textwith in twips.
    The only way I found was:

    Code
    mywidth := MulDiv(MyRichText.Canvas.TextWidth(s),1440,Screen.PixelsPerInch); //Twips;

    But than I have differences from 39% [/] to 20% [%] to my own measures. A normal C has 10% difference.

    I have tested with 40times a charater in a string, something like CCCC....CCCC (40ty C's).

    I cannot format the whole text, to caluclate one value.
    Is the anywhere a correct with, if I format only my paragraph/cell?

    Thanks for any help.

    Andreas

    Hello Julian,

    1) the pdf solution is one possibility I thougt about.

    2) Now I have put the address out of the header, on the first page (of each invoice). With OnGetSpecial Text I supress the header on this page. Work fine.

    3) But now, I have problem (also if I deactivate the solution from 2) with the page size. In my WORKRTF, where I create a single invoice, all is fine A4. But the SHOWALLRTF where I concatanate all the invoices, the page size is lost. (And by that the formatting goes wrong).

    Any idea?

    Thanks.

    Andreas

    Hello

    in http://wpcubed.com/forum/viewtopic.php?t=5065 you recommend:

    >> I would recommend to create named header and footer and activate them in the OnGetSpecalText event according to the needs.

    Is there a example with the details. I have the problem that with serial letters (invoices) a the Adress is on the First Page (Header). Now we want to put all invoices in one Document.

    I know the solutions with AppendAsSection, but by this the first-Page header goes lost.

    OnGetSpecialText should be a solution, but how to store named headers and find them. Return in the Event is easy then.

    Thanks for your help

    Andreas

    edit: some typo errors

    Hallo

    (Der Sachverhalt ist mir jetzt auf Englisch zu komplex)

    Also, wir drucken ein Buchungsjournal bei dem festgehalten wird welcher Datensatz auf welcher Seite gedruckt wird. Damit wir erstens fortlaufende Seiten drucken können und zweitens bei Wiederholungen die Seiten gleich aussehen.

    Bei meinem alten Reporting Tool, war Ausgabe und Formatierung eines, so daß ich beim Seitenwechsel reagieren konnte, da ich da noch im Datenstrom war.

    Nun setze ich WpTools 5 VCL ein (was seine guten Gründe hat) und versuche den Mechanismus nachzubauen.

    Wenn ich aber nun im ersten Schritte die Tabelle aufbaue, so ist sie noch unformatiert und ich finden keinen Weg an die Seitennummern ranzukommen.

    Nach der Formatierung erscheint es mir reichlich komplex mich durch die Strukturen zu hangeln, um festzustellen welche Zeile wurde auf welche Seite gedruckt.

    Welchen Weg schlage ich am besten ein, wonach muss ich in der Dokumentation schauen, ich bin noch nicht so richtig fündig geworden.

    Vielen Dank schon einmal.

    Grüße
    Andreas
    ---
    Nachtrag
    OnMeasureObject könnte eine Lösung sein, oder?

    Da erfahre ich auf welche Seite welcher Paragraph kommt. Gibt es eine Möglichkeit an den Paragraphen eine Integer Markierung zu hinterlassen also wie das TAG der Komponten.

    Hello,

    I have set the height and width of a table cell successfully.

    Now is my text to long for this cell. I want to clip the text, to the possible space.

    Is there a automatic clipping in WPTools 5 VCL (I using) or VCL 6 (than I have to update).

    Or is there a possibility to get the witdh of the text, to do the clipping by my own.

    Best Regards
    Andreas

    Hello Julian,

    here ist a typical rtf fprint header like we use it.

    What must I convert?
    Is there a version in the old or new format?
    Or have I to look for old elements to detect a old version?
    What look hidden text like (for an own version tag)?

    Thx

    Andreas

    Hello,

    I (will) upgrade from Version 3.11 to 5.18.6. I use OnTextFieldGetText and I have many RTF-texts stored in database outside by hundreds of customers.

    I can change my source code to handle with OnMailMergeGetText,
    but how can i change the rtf-texts? Is there a procedure ready to use? How can i evaluate the version of the rtf-text stored in the database?

    Thanks.

    Andreas