last and final attempt to search for python ods library.

Terry Reedy tjreedy at
Mon Mar 9 20:55:53 CET 2009

Krishnakant wrote:
> Hi Terry,
> Well, You did reply i know, but seems i lost that mail some where,
> My mail client must have messed up the mail.
> any ways thanks for your reply,
> Right now I am stuck very badly.
> The problem is that I am trying python-ooolib and did find the library
> pritty good.
> But the problem is that library is missing a major feature from my
> requirement context.
> I need to merge cells in a spreadsheet and this library won't do that.

I think you are confusing process and result.  The result is a cell that 
spans more than one column or row *when displayed*, thus hiding the 
cells that would otherwise be displayed. This is, I am 99.9% sure, 
controlled by an attribute of the visually expanded cell.

In OOCalc, the process is to mark a block of cells and select Format / 
Merge Cells.  But still, the result will be a change in the upper left 
attribute.  Thus I suggested you make a .ods file with expanded cells 
and then read the xml to see what cell element attribute is set thereby. 
Any decent odf library will be able to set element attributes.

If the about-to-be hidden cells are not empty, OOCcalc gives you the 
option of converting all cell contents to strings and joining them into 
one string in the expanded cell.  If you create .ods from scratch, you 
should never need to do this.  If you edit an existing .ods, something like
   ' '.join(str(cell.contents for cell in merge_group))
possibly in a function that also sets the attribute, should be easy 
enough to write.  And, of course, you will be able to do things other 
than the one option OOCalc gives you.

In other words, I do not think you *need* an existing cell-merge function.

> Do you know how I can work around this?

See above.

> I tryed searching for py2odf but did ont find any results.

Whoops. odfpy at

but I strongly suspect you can do what you want with python-ooolib.

Terry Jan Reedy

More information about the Python-list mailing list