Blame view

export/PHPRtfLite-1.3.1/docs/html/_sources/getting-started.txt 1000 Bytes
f90e19c3   Andrea Petta   plugin update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  Getting started
  ***************
  
  Autoloading
  ===============
  
  You can choose if you want to use the PHPRtfLite autoloader or handle loading PHPRtfLite classes on your own. In most cases you are already using a class loading strategy and just need to add PHPRtfLite to it, which is recommended. For a quick start you may use the shipped PHPRtfLite autoloader.
  
  .. code-block:: php
  
      <?php
      require_once '/path/to/your/library/PHPRtfLite.php';
  
      // registers PHPRtfLite autoloader (spl)
      PHPRtfLite::registerAutoloader();
      // rtf document instance
      $rtf = new PHPRtfLite();
  
  
  Hello world example
  ===================
  
  This is a short "Hello world" example:
  
  .. code-block:: php
  
      <?php
      // rtf document instance
      $rtf = new PHPRtfLite();
      // add section
      $sect = $rtf->addSection();
      // write text
      $sect->writeText('Hello world!', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat());
  
      // save rtf document to hello_world.rtf
      $rtf->save('hello_world.rtf');