Hi !
I wrote some little procedures to get a simple way adding text und horizontal line by code.
Code
procedure TForm1.AddText(
NewPage: Boolean; // Insert new Page bevor text add
FontName: String; // Font for text
FontSize: Integer; // Size for text
FontBold: Boolean; //
FontItalic: Boolean; //
FontUnderline: Boolean; //
Color: TColor; // Color of the text
Text: String // Text to Add ...
);
begin
if NewPage = True then RTF.InputString(#12); // New Page
RTF.WritingAttr.Clear;
RTF.WritingAttr.SetColor(Color);
RTF.WritingAttr.SetFontName(FontName);
RTF.WritingAttr.SetFontSize(FontSize);
if FontBold then RTF.WritingAttr.IncludeStyle(afsBold);
if FontItalic then RTF.WritingAttr.IncludeStyle(afsItalic);
if FontUnderline then RTF.WritingAttr.IncludeStyle(afsUnderline);
RTF.InputString(Text);
end;
procedure TForm1.AddHorizLine;
begin
with rtf.TextObjects.InsertNewObject(
wpobjHorizontalLine, false, false) do
begin
Height := 10;
iParam := clPurple ;
end;
end;
Alles anzeigen
If I want to add text / line / text:
ZitatAddText(False,'Verdana',14,True,True,False,clBlue,'Some little Tests ...');
AddHorizLine;
AddText(False,'Verdana',10,False,False,False,clBlack,
'Dies ist dann einfach nur ein schnöder Text!');
The result is:
Some little Tests
... *)
-------------------------------
Dies ist dann einfach nur ein schnöder Text!
*) What is the reason for this new line??
Is here something missing in general?