summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorBradley M. Kuhn <bkuhn@ebb.org>2013-01-03 13:36:38 -0500
committerBradley M. Kuhn <bkuhn@ebb.org>2013-01-03 13:36:38 -0500
commitfbd6c309031393950ac387b9de5f07214c5fa3cf (patch)
tree968ad5d712ebf9a61bc2b3d2c23a857f457703f7 /contrib
parentb939bbe8c61a819e413b3e2a24d223f6232bd0d9 (diff)
downloadfork-ledger-fbd6c309031393950ac387b9de5f07214c5fa3cf.tar.gz
fork-ledger-fbd6c309031393950ac387b9de5f07214c5fa3cf.tar.bz2
fork-ledger-fbd6c309031393950ac387b9de5f07214c5fa3cf.zip
Add option to skip generating the page breaks.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/non-profit-audit-reports/csv2ods.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/non-profit-audit-reports/csv2ods.py b/contrib/non-profit-audit-reports/csv2ods.py
index 2b3024d4..aded8e65 100755
--- a/contrib/non-profit-audit-reports/csv2ods.py
+++ b/contrib/non-profit-audit-reports/csv2ods.py
@@ -2,8 +2,8 @@
# csv2ods.py
# Convert example csv file to ods
#
-# Copyright (c) 2012 Tom Marble
-# Copyright (c) 2012 Bradley M. Kuhn
+# Copyright (c) 2012 Tom Marble
+# Copyright (c) 2012, 2013 Bradley M. Kuhn
#
# This program gives you software freedom; you can copy, modify, convey,
# and/or redistribute it under the terms of the GNU General Public License
@@ -31,7 +31,7 @@ def err(msg):
print 'error: %s' % msg
sys.exit(1)
-def csv2ods(csvname, odsname, encoding='', verbose = False):
+def csv2ods(csvname, odsname, encoding='', verbose = False, skip_page_break = False):
if verbose:
print 'converting from %s to %s' % (csvname, odsname)
doc = ooolib2.Calc()
@@ -77,7 +77,8 @@ def csv2ods(csvname, odsname, encoding='', verbose = False):
# enter an empty string for blank lines
doc.set_cell_value(1, row, 'string', '')
# put a pagebreak here
- doc.sheets[doc.sheet_index].set_sheet_config(('row', row), style_pagebreak)
+ if not skip_page_break:
+ doc.sheets[doc.sheet_index].set_sheet_config(('row', row), style_pagebreak)
row += 1
# save the file
doc.save(odsname)
@@ -96,6 +97,9 @@ def main():
help='ods output filename')
parser.add_option('-e', '--encoding', action='store',
help='unicode character encoding type')
+ parser.add_option('-s', '--skip-page-break', action='store_true',
+ dest='skip_page_break',
+ help='do not add any page breaks')
(options, args) = parser.parse_args()
if len(args) != 0:
parser.error("not expecting extra args")
@@ -109,7 +113,7 @@ def main():
print 'csv:', options.csv
print 'ods:', options.ods
print 'ods:', options.encoding
- csv2ods(options.csv, options.ods, options.verbose, options.encoding)
+ csv2ods(options.csv, options.ods, options.verbose, options.encoding, options.skip_page_break)
if __name__ == '__main__':
main()