readme.txt 2.79 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
OOo Template

  An Zope object class to generate OOo documents dynamically.

  OOo Template derives from Zope Page Templates. Simply define the content.xml
  part of an OOo document in the edit tab. Then create a new File and upload
  an existing OOo document (ex. default_ooo_template). Then set the stylesheet
  property to the id of the uploaded OOo document (ex. default_ooo_template in this case).

  Rendering consists in replacing content.xml of the original OOo document
  with the content.xml generated by the OOo Template.

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
  Special tags for including content:

    - <office:include>
        Allow you to include another document in the current template (as an OLE attachment)
        You must specify at least the path (can be either a single name or a path name using "/")
        and the type of the document (generally calc or writer), the default is zope's content-type.
        The size is always specified in centimeters (with attached "cm" suffix or not).
        You can specify the style (defined in the sylesheet) with the "style" option.
        You can also pass "x" and "y" attributes for positioning, it's mainly useful for draw documents.

       Example:
           <office:include type="calc" width="10.100cm" height="16.000cm" path="agenda" />
           <office:include width="15" height="20" path="/reports/my_report" />
           <office:include path="foo" />

    - <office:include_img>
        Not unlike <office:include>, allows you to include a picture document, refer to
        the <office:include> part for details.
        The optional "type" attribute specifies the picture format ; you can either
        pass a full value ("image/jpeg") or the short version ("jpeg").
        You can also pass position parameters with "x" and "y" attributes.
        The maxwidth and maxheight parameters are useful to set constraints.
        The aspect ratio information try to be kept (if you set only one size
        or if a constraint is applied).

       Example:
           <office:include x="5cm" y="1cm" path="foo" />

41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
  Tips:

    - it is possible to embed images by calling oo_builder.addImage(image)
      where oo_builder is a handle to OOo Template internals and
      addImage a method to embed an image in the resulting document.

      Example:

      <draw:image draw:style-name="fr1" draw:name="Image1" text:anchor-type="as-char"
              draw:z-index="0" xlink:href="#Pictures/0001.png"
              xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"
              tal:attributes="xlink:href python:request.oo_builder.addImage(image.index_html(None,None,display='medium'))"/>

  Known Issues:

    - content type must be set to text/html

    - remove any dtd declaration such as:

    <!DOCTYPE office:document-content PUBLIC "-//OpenOffice.org//DTD OfficeDocument
1.0//EN" "office.dtd">