1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 def get_sheet_from_doc(document
, index
=None, name
=None):
9 """ Returns a sheet object for a Spreadsheet document
12 index -- the 0-based index of the sheet (may not be used together with name)
13 name -- the name of the sheet (may not be used together with index)
15 return document
.getSheets()[index
]
17 def get_cell_by_position(document
, tab
, column
, row
):
18 """ Get the cell object through its position in a document
21 document -- The document that should be used
22 tab -- The 0-based sheet number
23 column -- The 0-based column number
24 row -- The 0-based row number
26 sheet
= get_sheet_from_doc(document
, tab
)
27 return sheet
[row
,column
]
29 def get_column(document
, column
, tab
= 0):
30 """ Get the column object through the column index
33 document -- The document that should be used
34 tab -- The 0-based sheet number
35 column -- The 0-based column number
37 sheet
= get_sheet_from_doc(document
, tab
)
38 return sheet
.getColumns()[column
]
40 def get_row(document
, row
, tab
= 0):
41 """ Get the row object through the row index
44 document -- The document that should be used
45 tab -- The 0-based sheet number
46 column -- The 0-based row number
48 sheet
= get_sheet_from_doc(document
, tab
)
49 return sheet
.getRows()[row
]
51 def is_row_hidden(document
, row
, tab
= 0):
52 """ Check whether a row object is hidden
55 document -- The document that should be used
56 tab -- The 0-based sheet number
57 column -- The 0-based row number
59 xRow
= get_row(document
, row
, tab
)
60 bVisible
= xRow
.getPropertyValue("IsVisible")
63 # vim: set shiftwidth=4 softtabstop=4 expandtab: