I implement at least a ViewOptionEx2 for this - to hide the lines for "soft" page breaks.
Beiträge von wpsupport
-
-
Thanks for finding wpdrawfineunderlines, it was specially implemented for that reason. It is a matter of taste if you want to adapt the line thickness to the font height. WPTools is not using the fsUnderline style for text output internally, since that will not draw continues lines with text of different sizes.
-
WPTools always creates its virtual pages when formatting the text and right now they have a certain height. Since there can be also header and footer it would also be pretty difficult to do otherwise so it actually creates those breaks.
But why not simply make the pages really height? You can use the event OnMeasurePageHeight to do this without having to mess with the setup of the RTF page information.
-
Windows always pains at least a hair line, even when the Pen.Width = 0, so this is not the problem.
But when the lines become very small it is possible that the following line paints over the previous after the scaling has taken place.
Scaling is internally done because WPTools is resolution independent. It always calculates a defined dpi setting.
Please see chapter "Programming/Introduction/WYSIWYG" in the manual for more information.
You can set the flag wpfAlwaysFormatWithScreenRes in the property FormatOptions of the TWPRichText if you do not need WYSIWYG.
-
You will see a font change only of the text in the paragraph (or cell) does not use a character attribute on its own.
You can use ClearCharAttributes(false) to reset the attributes of the text.
-
You can use LoadFromFile and SaveToFile. But of course the DOCX unit have to be linked in.
-
It happens often that despite calling Invalidate the control is not painted.
This is usually the case when the Invalidate routine is called in the context of user input.
To solve the issue you need to set a flag in "Invalidate" and as soon as the application is idle call Invalidate.
This code can be used to create a procedure which is called when the application is Idle:
Code
Alles anzeigenTWPCustomTool = class(TControl) private FIdleMessageId : Integer; protected FNeedInvalidate : Boolean; .... constructor TCustomTool.Create(AOwner: TComponent); begin inherited Create(AOwner); FIdleMessageId:=TMessageManager.DefaultManager.SubscribeToMessage(TIdleMessage, IdleMessageHandler); end; destructor TCustomTool.Destroy; begin TMessageManager.DefaultManager.Unsubscribe(TIdleMessage, FIdleMessageId); inherited; end; procedure TCustomToolCtrl.Invalidate; begin FNeedInvalidate := true; end;
This is the message handler which is called when in the Idle cycle:Codeprocedure TCustomTool.IdleMessageHandler(const Sender: TObject; const Msg: System.Messaging.TMessage); begin if FNeedInvalidate then begin FNeedInvalidate := false; InvalidateRect(RectF(0,0,Width,Height)); end; end;
I hope this is helpful,
Julian
-
-
Die TWPToolbar hat eine property ButtonHeight welche man an die aktuelle Auflösung anpassen kann.
Wenn Sie dann auch die erneuerte TWPImageList verwenden die teil von WPTools 9.1 ist, dann können automatisch Icons in höherer Auflöung geladen werden.
Bei WPTools 9.1 reicht es oft bereits aus, die unit WPICONS dem Projekt hinzuzufügen. Dann werden die Icons als Resource geladen. Eine WPImageList instanz wird dann automatisch erstellt.
-
Nach dem laden/ändern der Dialog Sprache muss die globale Funktion
WPSpell_LoadVCLStrings
aus unit WPSpell_Language aufgerufen werden.
-
TWPRichText1.Header.PageHeight,
PageMarginLeft etc.
-
Hi,
if you have a linked image this effect is normal. The images are linked to a file and stay that way.
You get around this by using the OnRequestHTTPImage event and there set the image Filename and Streamname to ''
You can also use SaveToFile( filename, false, 'RTF-AlwaysEmbed')
or
TWPRichText.AsANSIString('RTF-nobinary,-alwaysembed');
-
-
-
-
Ein TWPRichText ist nie "echt" transparent. Die Transparenz wird simuliert indem der Hintergrund zwischengespeichert wird und vor der Ausgabe des Textes ausgegeben. Mit ViewOptionsEx := [wpDontClearPageBackground] wird der Seitenhintergrund nicht gezeichnet, sofern man einen solchen mittels LayoutMode ausgewählt hat. Aus technischen Gründen führt die Wahl von Transparenz dazu, dass auch die Scrollbar verschwindet. Aus diesem Grund kann es sinnvoll sein, anstatt Transparenz zu verwenden, selber einen passenden Hintergrund in das TWPRichText zu zeichnen. Dafür bietet sich das Event OnPaintDesktopBackground an.
Code
Alles anzeigenprocedure TTransparentForm.chTransparentClick(Sender: TObject); begin WPRichText1.Transparent := chTransparent.Checked; end; procedure TTransparentForm.FormCreate(Sender: TObject); begin WPRichTextLabel1.Transparent := true; WPRichTextLabel1.ViewOptionsEx := [wpDontClearPageBackground]; WPRichText1.Transparent := chTransparent.Checked; WPRichText1.ViewOptionsEx := [wpDontClearPageBackground]; WPRichText1.BorderStyle := bsNone; end; procedure TTransparentForm.PaintOnControl( ctrl : TControl; Canvas : TCanvas; offx, offy : Integer ); var x, y : Integer; p : TPoint; begin p := ctrl.ClientOrigin; Dec(p.X, ClientOrigin.X); Dec(p.Y, ClientOrigin.Y); Canvas.Pen.Color := clBlack; Canvas.Pen.Width := 0; y := p.x mod 10+offy; while y<ctrl.Height do begin Canvas.MoveTo(0,y); Canvas.LineTo(ctrl.Width,y); inc(y,10); end; x := p.y mod 10+offx; while x<ctrl.Width do begin Canvas.MoveTo(x,0); Canvas.LineTo(x,ctrl.Height); inc(x,10); end; end; procedure TTransparentForm.PaintBox1Paint(Sender: TObject); begin PaintOnControl( PaintBox1, PaintBox1.Canvas,0,0 ); end; procedure TTransparentForm.WPRichText1Change(Sender: TObject); begin WPRichTextLabel1.Assign(WPRichText1); end; procedure TTransparentForm.WPRichText1PaintDesktopBackground(Sender: TObject; Canvas: TCanvas; R: TRect); begin Canvas.Brush.Color := Color; Canvas.FillRect(R); PaintOnControl( WPRichText1, Canvas, 0, -1 ); end;
Ein TWPRichText label hat kein Fenster und ist daher schon von Natur aus "echt" transparent. Allerdings kann es dadurch nicht den Focus erhalten und bekommt keine Windows messages. Ist daher nicht vergleichbar.
-
Sie müssen command aufrufen mit dieser command id:
COMPDF_RenderDrawobjects = 522; // Renders the objects. IntPar is the mode.
// Returns the number of rendered objects. (Use IntPar=128 to count only)
// This are the bits:
// 1 : RenderAnnotations - Render the annotations which are not widgets and not Popups
// 2 : RenderWidgets - Render widgets annotations/
// 4 : RenderPopups - Render popup annotations
// 8 : DeleteRenderedObjects and Annotations
// 16 : UseOriginalDataForRendering (use originla field values for widgets)
// 32 : UnderPageLayer - Render the draw objects under the page
// 64 : OverPageLayer - Render the draw objects over the page (or document draw objects)
// 128: Do not render or delete. Just count how many objects would be affected
-
Thanks for your input.
There is now a new version which also solves most of the issues you reported so far.
Now the toolbar icons are updated when the user moves the cursor and double- and tripple click are working. There is now a popup menu fur regular text a different one for embedded graphics, just as in the VCL edition.
The setup now also includes an executable for OSX.
-
-
Please note that the 3. and 4. COMPDF_GetTextFilterRect parameters are X1 and Y1 values, not Width and Height.
I used this code to test:
Code
Alles anzeigenprocedure TForm1.SelRectEventToDrawrectangleandextracttext( Sender: TObject; const PageNr: Integer; R: TRect); var WPViewPDF : TWPViewPDF; s : string; begin WPViewPDF:= (Sender as TWPViewPDF); WPViewPDF.OnSelRectEvent := nil; try WPViewPDF.command(COMPDF_GetTextSetOptions, 4+2); // Activate the filter WPViewPDF.command(COMPDF_GetTextFilterRectX , r.Left ); WPViewPDF.command(COMPDF_GetTextFilterRectY , r.Top ); WPViewPDF.command(COMPDF_GetTextFilterRectX1, r.Right ); WPViewPDF.command(COMPDF_GetTextFilterRectY1, r.Bottom ); s := WPViewPDF.GetPageText(PageNr); ShowMessage( s ); finally WPViewPDF.command(COMPDF_GetTextSetOptions, 2); // DE-Activate the filter end; end; procedure TForm1.Drawrectangleandextracttext1Click(Sender: TObject); begin if pdf<>nil then // "pdf" is the current WPViewPDF instance begin pdf.OnSelRectEvent := SelRectEventToDrawrectangleandextracttext; pdf.CommandEx(COMPDF_SelectMode, 2); // let the user draw ... end; end;