last and final attempt to search for python ods library.

Krishnakant hackingkk at gmail.com
Tue Mar 10 04:04:31 EDT 2009


On Mon, 2009-03-09 at 15:55 -0400, Terry Reedy wrote:
> 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.
> 
That might be the case imho, But I tried increasing the width of the
column using python-ooolib and i could not get the effect of a merged
cells.

I am now trying odfpy and hope it will do what I want.


> 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.
> What did you mean by the upper left attribute, are you asuming that the merged cells are in the top row? In my case that's actually the case beacuse  because I want my python script to generate an ods file with the cells in the top row merged from let's say a1 to d1.
Talking about the xml, which file should I look at to see the effect of
merging cells?




> 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.
> 
This is exactly what I was trying to achieve with the python-ooolib
module but could not do it.
The library did have a cet_cell_property function but did not allow for
merging.

> In other words, I do not think you *need* an existing cell-merge function.
> 
But the library I use does not allow me to try the method you suggested.
Seems that I will have to look at the xml and write my own module.

> > 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
> http://opendocumentfellowship.com/development/projects/odfpy
> 
> but I strongly suspect you can do what you want with python-ooolib.
> 
No buddy, I tryed with ooolib but now given up unless some one points
out what I am missing.
happy hacking.
Krishnakant.






More information about the Python-list mailing list