ppRichTx to be justified
?hello would like to know as to make ppRichTx to be justified
grateful
--- posted by geoForum on http://delphi.newswhat.com
grateful
--- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.
Comments
newsgroups.
The build-in RichText editor does not support full justification. Take a
look a the following article on using a third party RichText component to
enhance this.
----------------------------------------------
Article: ReportBuilder's RichText architecture
----------------------------------------------
The RichText in ReportBuilder is a wrapper around Delphi's TRichEdit which
in turn relies on Windows. There are two versions of Windows richedit -
RichEd32.dll is the older one and RichEd20.dll is a newer one (RichEd32 is
being phased out). Delphi by default relies on RichEd32 - the older version.
To use some of the more advanced features of Windows RichEdit, see the topic
on InfoPower RichEdit Support below.
In general Windows RichEdit supports the type of formatting that you can do
using WordPad.
InfoPower RichEdit Support
---------------------------
InfoPower from Woll2Woll Software is a popular database add-on product for
Delphi. InfoPower's TwwRichEdit components support the Windows RichEdit2
format. This format allows the rich text data to contain embedded bitmaps
and OLE objects. For more information please see http:\\www.Woll2Woll.com.
ReportBuilder includes a component that enables the TppRichText and
TppDBRichText controls in ReportBuilder to use the formatting capabilities
of InfoPower's TwwRichEdit when rendering RTF data. The ppWWRichEd.pas unit
located in the ..\RBuilder\InfoPower directory defines a TwwDBRichEdit
descendant and then registers the class with ReportBuilder. This enables the
TppRichText and TppDBRichText controls in ReportBuilder to use the
formatting capabilities of TwwDBRichEidt when rendering data.
WPTools Support
----------------
WPTools is a collection of components used to edit and print formatted text.
With its own RTF engine, WPTools offers numerous features not supported by
the standard Windows RichEd20.dll. This control lets you use tables,
paragraph frames, headers and footers etc. Using the optional ReportBuilder
support units for WPTools 2.x, you can print the enhanced WPTools features
(justified text, tables, graphics...) within your ReportBuilder reports. For
more information please see http:\\www.wptools.de.
TRichView
----------
TRichView is a suite of native Delphi components for displaying, editing,
and printing hypertext documents. Documents can contain tables, pictures,
and images. TRichView is available from www.trichview.com. There is a
wrapper for available for using TRichView inside ReportBuilder, see
http://www.digital-metaphors.com/Subpages/Downloads/CompanionRCL.html or
http://www.trichview.com/resources/
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
No need to install components from third parties
TppRTFToolbar = class(TppToolbar)
private
....
FJustificado: TppTBXItem;
...
public
property Justificado: TppTBXItem read FJustificado;
....
++++++
procedure TppRTFToolbar.CreateItems;
begin
.....
FJustificado := AddButton();
FJustificado.GroupIndex := 20;
FJustificado.Tag := 3;
FJustificado.ImageIndex := ToolImageList.AddIcon('PPJUSTIFY');
FJustificado.OnClick := ehItem_Click;
...
++++++++
procedure TppRTFToolbar.ehItem_Click(Sender: TObject);
begin
.....
else if (Sender = FJustificado) then
FRTFEditor.ehAlignButtonClick(Sender)
.....
++++
procedure TppRTFEditor.ehAlignButtonClick(Sender: TObject)
procedure Justify(editor: TRichEdit);
const
WM_USER = $400;
EM_EXSETSEL = (WM_USER + 55);
EM_SETTYPOGRAPHYOPTIONS = (WM_USER + 202);
EM_GETTYPOGRAPHYOPTIONS = (WM_USER + 203);
TO_ADVANCEDTYPOGRAPHY = $1;
mZERO = $0;
var x: tparaformat;
L: LongInt;
cp: charrange;
begin
x.cbSize := sizeof(x);
if Editor.SelLength = 0 then
begin
cp.cpMin := 0;
cp.cpMax := length(Editor.Text);
SendMessage(Editor.Handle, EM_EXSETSEL, mZERO, LPARAM(@cp));
end;
L := SendMessageA(Editor.Handle, EM_SETTYPOGRAPHYOPTIONS,
TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);
if L = 1 then
begin
SendMessageA(Editor.Handle, EM_GETTYPOGRAPHYOPTIONS, mZERO, mZERO);
SendMessage(Editor.Handle, EM_GETPARAFORMAT, mZERO, LPARAM(@x));
x.dwMask := PFM_ALIGNMENT;
x.wAlignment := PFA_JUSTIFY;
SendMessage(Editor.Handle, EM_SETPARAFORMAT, mZERO, lparam(@x));
end;
cp.cpMin := 0;
cp.cpMax := 0;
SendMessage(Editor.Handle, EM_EXSETSEL, mZERO, lparam(@cp));
Editor.WordWrap := true;
end;
begin
...
if TControl(Sender).tag = 3 then
Justify(TRichEdit(editor))
else
Editor.Paragraph.Alignment := TAlignment(TControl(Sender).Tag);
.....
[]s
these
a
to
which
is
version.
topic
do
for
bitmaps
http:||www.Woll2Woll.com.
capabilities
unit
the
text.
by
ReportBuilder
features
For
editing,
pictures,
--- posted by geoForum on http://delphi.newswhat.com