Example #1
0
textdoc = OpenDocumentSpreadsheet()
# Create a style for the table content. One we can modify
# later in the spreadsheet.
tablecontents = Style(name="Large number", family="table-cell")
tablecontents.addElement(TextProperties(fontfamily="Arial", fontsize="15pt"))
textdoc.styles.addElement(tablecontents)

# Create automatic styles for the column widths.
widewidth = Style(name="co1", family="table-column")
widewidth.addElement(
    TableColumnProperties(columnwidth="2.8cm", breakbefore="auto"))
textdoc.automaticstyles.addElement(widewidth)

# Create the styles for $AUD format currency values
ns1 = CurrencyStyle(name="positive-AUD", volatile="true")
ns1.addElement(CurrencySymbol(language="en", country="AU", text=u"$"))
ns1.addElement(Number(decimalplaces="2", minintegerdigits="1",
                      grouping="true"))
textdoc.styles.addElement(ns1)

# Create the main style.
ns2 = CurrencyStyle(name="main-AUD")
ns2.addElement(TextProperties(color="#ff0000"))
ns2.addElement(Text(text=u"-"))
ns2.addElement(CurrencySymbol(language="en", country="AU", text=u"$"))
ns2.addElement(Number(decimalplaces="2", minintegerdigits="1",
                      grouping="true"))
ns2.addElement(Map(condition="value()>=0", applystylename="positive-AUD"))
textdoc.styles.addElement(ns2)