PyUNO usability improvements
Michael Stahl
mstahl at redhat.com
Tue Jun 16 03:34:15 PDT 2015
On 14.06.2015 15:26, Matthew J. Francis wrote:
> Hi,
>
> For the past few weeks I've been working on some upgrades to PyUNO,
> which have now reached (what I hope is) a sufficient level of sanity and
> stability. I've pushed the changes to:
wow, this all looks really nice!
> 2. Cell ranges
> ==============
>
> A custom behaviour is applied to objects which implement
> com::sun::star::table::XCellRange to allow their cells and cell
> ranges to be addressed by subscript, in the style of a Python list
> or dict (read-only). This is applicable to Calc spreadsheet sheets,
> Writer text tables and cell ranges created upon these.
> cell = cellrange[0,0] # Access cell by indices
> rng = cellrange[0,1:2] # Access cell range by index,slice
> rng = cellrange[1:2,0] # Access cell range by slice,index
> rng = cellrange[0:1,2:3] # Access cell range by slices
> rng = cellrange['A1:B2'] # Access cell range by descriptor
> rng = cellrange['Name'] # Access cell range by name
>
> Note that the indices used are in Python/C order, and differ from
> the arguments to methods provided by XCellRange.
> - The statement cellrange[r,c], which returns the cell from row r
> and column c, is equivalent to calling
> XCellRange::getCellByPosition(c,r)
> - The statement cellrange[t:b,l:r], which returns a cell range
> covering rows t to b(non-inclusive) and columns l to r(non-
> inclusive), is equivalent to calling
> XCellRange::getCellRangeByPosition(l,t,r-1,b-1).
i'm not sure if using a different order for row and column here is a
good idea or a bad idea. maybe some Calc developer has an opinion on it?
More information about the LibreOffice
mailing list