Recent

Author Topic: How to create a table using RtfDoc.pas  (Read 2545 times)

pasquale

  • Sr. Member
  • ****
  • Posts: 267
    • Esposito Software
How to create a table using RtfDoc.pas
« on: March 14, 2012, 07:53:57 am »
Hello, I'm new here and I'am a Lazarus newbie.

I'm playing around with the xdev_toolkit component and I'm trying to come up with a Rich Text Format file containing a table (2 columns and 2 rows would suffice).

The only code that is provided in https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/xdev_toolkit/TestRtfDoc.pas is the following:

Code: [Select]
uses
  SysUtils,
  RtfPars,  {Free Pascal unit with TRtfParser class and rtf constants}
  RtfDoc;   {Descendant class used in this program}
 
begin

  with TRtfDoc.Create do  {Create TRtfDoc object}
    begin
    try
 
      try
        Start('test.rtf');  {Create RTF file}
      except
        on EInOutError do  {File read-only or some other I/O error}
          begin
          WriteLn('Can''t create file');
          Exit;
          end;
        end;

      OutDefaultFontTable(2);  {Select font 2 (Arial) as default} 

      OutCtrl(rtfParAttr, rtfQuadCenter, rtfNoParam);  {Center line}
      OutCtrl(rtfCharAttr, rtfBold, 1);  {Turn on bolding}
      OutText('Hello');  {Output some text}
      OutCtrl(rtfCharAttr, rtfBold, 0);  {Turn off bolding}
      OutText(' there!');  {Output some more text}
      OutCtrl(rtfSpecialChar, rtfPar, rtfNoParam);  {End of paragraph}

      Done;  {Close RTF file}
 
    finally
      Free;  {Free TRtfDoc object}
      end;
    end;

end.

Do you know where I can get information about how to create a table?

Thanks in advance.

Pasquale
Perugia, Italy
Apple loves breaking backward compatibility to make money. If you want to be sure that your apps will never stop working, use Windows and trash macOS!

 

TinyPortal © 2005-2018