/usr/share/doc/python-ooolib/examples/calc-example08.py is in python-ooolib 0.0.17-2.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/usr/bin/python
import sys
sys.path.append('..')
import ooolib
# Create your document
doc = ooolib.Calc()
# Set values. The values are set in column, row order, but the values are
# not in the traditional "A5" style format. Instead we require two integers.
# set_cell_value(col, row, datatype, value)
doc.set_cell_value(1, 1, "string", 'Alignment')
# Set Bold
doc.set_cell_property('bold', True)
doc.set_row_property(3, 'height', '0.5in')
doc.set_row_property(4, 'height', '0.5in')
doc.set_row_property(5, 'height', '0.5in')
# valign Labels
doc.set_cell_value(1, 3, "string", 'top')
doc.set_cell_value(1, 4, "string", 'middle')
doc.set_cell_value(1, 5, "string", 'bottom')
# halign Labels
doc.set_cell_value(2, 2, "string", 'left')
doc.set_cell_value(3, 2, "string", 'center')
doc.set_cell_value(4, 2, "string", 'right')
doc.set_cell_value(5, 2, "string", 'justify')
doc.set_cell_value(6, 2, "string", 'filled')
# Unset Bold
doc.set_cell_property('bold', False)
# Fill in aligned properties
# Vertical Align top
doc.set_cell_property('valign', 'top')
doc.set_cell_property('halign', 'left')
doc.set_cell_value(2, 3, "string", 'x')
doc.set_cell_property('halign', 'center')
doc.set_cell_value(3, 3, "string", 'x')
doc.set_cell_property('halign', 'right')
doc.set_cell_value(4, 3, "string", 'x')
doc.set_cell_property('halign', 'justify')
doc.set_cell_value(5, 3, "string", 'x')
doc.set_cell_property('halign', 'filled')
doc.set_cell_value(6, 3, "string", 'x')
# Vertical Align middle
doc.set_cell_property('valign', 'middle')
doc.set_cell_property('halign', 'left')
doc.set_cell_value(2, 4, "string", 'x')
doc.set_cell_property('halign', 'center')
doc.set_cell_value(3, 4, "string", 'x')
doc.set_cell_property('halign', 'right')
doc.set_cell_value(4, 4, "string", 'x')
doc.set_cell_property('halign', 'justify')
doc.set_cell_value(5, 4, "string", 'x')
doc.set_cell_property('halign', 'filled')
doc.set_cell_value(6, 4, "string", 'x')
# Vertical Align bottom
doc.set_cell_property('valign', 'bottom')
doc.set_cell_property('halign', 'left')
doc.set_cell_value(2, 5, "string", 'x')
doc.set_cell_property('halign', 'center')
doc.set_cell_value(3, 5, "string", 'x')
doc.set_cell_property('halign', 'right')
doc.set_cell_value(4, 5, "string", 'x')
doc.set_cell_property('halign', 'justify')
doc.set_cell_value(5, 5, "string", 'x')
doc.set_cell_property('halign', 'filled')
doc.set_cell_value(6, 5, "string", 'x')
# Set Default Alignments
doc.set_cell_property('valign', 'default')
doc.set_cell_property('halign', 'default')
# Save the document to the file you want to create
doc.save("calc-example08.ods")
|