Hello Julian,
CurrentXPixelsPerInch = 600, therefor 600 was the correct idea.
Together with a counter error on my side. It works now.
Thanks.
Andreas
Hello Julian,
CurrentXPixelsPerInch = 600, therefor 600 was the correct idea.
Together with a counter error on my side. It works now.
Thanks.
Andreas
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.
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.
But then also c is to large.
How can I calculate c?
Thanks for your help.
Zitat von wpsupportThe 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:
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:
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:
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:
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,
thanks for the help. Because of the clippings I have solved the problem by using TabStops and Canvas.TextWidth. With your information it can also works in cells,too.
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
{\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Arial;}{\f2\fnil\fcharset0 Arial;}{\f3\fnil\fcharset0 Arial;}{\f4\fnil\fcharset0 Arial;}{\f5\fnil\fcharset0 Arial;}{\f6\fnil\fcharset0 Arial;}{\f7\fnil\fcharset0 Arial;}{\f8\fnil\fcharset0 Arial;}{\f9\fnil\fcharset0 Arial;}{\f10\fnil\fcharset0 Arial;}{\f11\fnil\fcharset0 Arial;}{\f12\fnil\fcharset0 Arial;}{\f13\fnil\fcharset0 Arial;}{\f14\fnil\fcharset0 Arial;}{\f15\fnil\fcharset0 Arial;}{\f16\fnil\fcharset0 Arial;}{\f17\fnil\fcharset0 Arial;}{\f18\fnil\fcharset0 Times New Roman;}{\f19\fnil\fcharset0 SerpentineDBol;}{\f20\fnil\fcharset0 Times New Roman;}{\f21\fnil\fcharset0 Times New Roman;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw10368\paperh15840\margl0\margr0\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}
{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}
{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}
{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}
{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}
{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}
{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}
{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}
{\*\pnseclvl9\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}
\endnhere\sectdefaultcl{\pard{\tqc\tx5130\tqr\tx10260 \ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f17\fs16\cf0 {\field{\*\fldinst{LIZ_NAME }}}\plain\f17\fs16\cf0 \tab \tab Seite \plain\f17\fs16\cf0 {\field{\*\fldinst{REP_PAGE }}}\par
\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f17\fs16\cf0 {\field{\*\fldinst{LIZ_STR }}}\plain\f17\fs16\cf0 - \plain\f17\fs16\cf0 {\field{\*\fldinst{LIZ_ORT }}}\plain\f17\fs16\cf0 \tab \plain\f17\fs20\cf0 {\field{\*\fldinst{REP_TITLE }}}\plain\f17\fs20\cf0 \plain\f17\fs20\cf0 {\field{\*\fldinst{REP_TTLADD }}}\plain\f17\fs16\cf0 \tab \plain\f17\fs16\cf0 {\field{\*\fldinst{SYS_DATE }}}}}
}
Alles anzeigen
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