Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant
Hi John,

I tryed this same library to begin with.

python-ooolib is very good except that it misses a major feature of cell
merging (spanning ).

That is the point from which I started the thread.
I even thought the author of that library will respond back but did not
happen.

Seams it is a very old library and no development happens on it.

happy hacking.
Krishnakant.


On Tue, 2009-03-10 at 23:44 +1100, John Machin wrote:
> On 10/03/2009 10:35 PM, Krishnakant wrote:
> >>> 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.
> >> There's another one called ooolib-python; have you had a look at that?
> >>
> > Can you provide the url?  Actually I think I saw this library but it
> > seems it is not well maintained and the author is no more active.
> > 
> > I think it is supporting old formats if I am talking about the same
> > library.  So please send me the link so that I confirm my doubts.
> 
> http://ooolib.sourceforge.net/ calls it ooolib-python, but in 
> topsy-turvy land 
> (http://packages.debian.org/unstable/python/python-ooolib) it's called 
> python-ooolib but all you need in the end is import ooolib.
> 
> Three are one and one is three :-)
> 
> 

--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-10 Thread John Machin

On 10/03/2009 10:35 PM, Krishnakant wrote:

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.

There's another one called ooolib-python; have you had a look at that?


Can you provide the url?  Actually I think I saw this library but it
seems it is not well maintained and the author is no more active.

I think it is supporting old formats if I am talking about the same
library.  So please send me the link so that I confirm my doubts.


http://ooolib.sourceforge.net/ calls it ooolib-python, but in 
topsy-turvy land 
(http://packages.debian.org/unstable/python/python-ooolib) it's called 
python-ooolib but all you need in the end is import ooolib.


Three are one and one is three :-)


--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant

> > 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.
> 
> There's another one called ooolib-python; have you had a look at that?
> 
Can you provide the url?  Actually I think I saw this library but it
seems it is not well maintained and the author is no more active.

I think it is supporting old formats if I am talking about the same
library.  So please send me the link so that I confirm my doubts.

> > 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.
> >
> > Do you know how I can work around this?
> 
> Here's a radical suggestion: Ask the author directly, or pop a note in
> the suggestion box on the sourceforge tracker [hint: don't use your
> mail client for this].
> 
I did send him a message but did not get any reply for the email.

I will put this request on sourceforge.net as per your suggestion any
how.

> >
> > I tryed searching for py2odf but did ont find any results.
> >
> > Do you want me to continue on the previous thread (I will try and dig
> > that out ).
> 
> Nah, just hijack a third thread :-)
> 
Thanks for that suggestion, I am not that multi threaded *smile*.
I have fixt my mail problem now so every things seems to be fine (untill
i hyjak another thread by accident LOL!).

happy hacking.
Krishnakant.


--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant
On Tue, 2009-03-10 at 00:27 -0400, Terry Reedy wrote:

> In any case, api-for-odfpy.odt has
> 
I am going through the documentation for odfpy but finding it pritty
complex right now.
> 5.17.12 table.CoveredTableCell
> Requires the following attributes: No attribute is required.
> Allows the following attributes: booleanvalue, contentvalidationname, 
> currency, datevalue, formula, numbercolumnsrepeated, protect, 
> stringvalue, stylename, timevalue, value, valuetype.
> These elements contain table.CoveredTableCell: table.TableRow.
> The following elements occur in table.CoveredTableCell: dr3d.Scene, 
> draw.A, draw.Caption, ...
> 
So merged cells are refered to as covered cells is it?
> so odfpy, at least, can create such elements.
> 
Do you have any code sample done in odfpy which I can browse throu and
run it to see the results.

> > 
> > Here's an example of 2 merged ranges: A1:C2 contains the text "foo"
> > and D1:D2 contains "bar"
> > 
> > 
> > -  > table:number-columns-spanned="3" table:number-rows-spanned="2">
> >   foo
> >   
> >   
> > -  > table:number-columns-spanned="1" table:number-rows-spanned="2">
> >   bar
> >   
> >   
> > - 
> >   
> >   
> > 
> > Aside: If you are wondering where the cell addresses (D1 etc) are,
> > they're in the reader's current_row and current_col variables :-)
> > Perhaps this was intended to save space, but what of table:number-
> > columns-repeated="4" ??
> 

I guess I got the point, but still can't figure out how I could actually
implement this because I find the documentation of odfpy pritty complex
and does not have the kind of example which shows what you explained in
the above code.

And the problem is that I got a bit confused in the above code because
my merging happens only in the top row and spanns columns not rows.

I would be very happy if I could get the code wich creates a set of
merged cells in a single row with some data in it.

I managed to do the odt part in the odfpy because the examples were
there and well documented.

happy hacking.
Krishnakant.
 

--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-10 Thread Krishnakant
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.



--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-09 Thread Terry Reedy

John Machin wrote:

On Mar 10, 6:55 am, Terry Reedy  wrote:

Krishnakant wrote:

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.


It doesn't appear to be quite so simple.

ODS uses a  element as usual for the upper left
cell. Attributes set the range e.g. table:number-columns-spanned="3"
table:number-rows-spanned="2"

The gotcha is that it uses a *different* element for the cells covered
by the range. Example:


This is looks like structural amendments are needed to a package like
(python-)?ooolib(-python)? that doesn't grok merged cells -- its
source doesn't contain the string "covered". Doesn't seem like it
could be done just by poking in attributes.


I guess it makes some sense that a cell that gets covered should be 
changed to a covered-cell rather than merely being marked as 'covered' 
or the covering left implicit by position.  This would make it easier 
for display software.


In any case, api-for-odfpy.odt has

5.17.12 table.CoveredTableCell
Requires the following attributes: No attribute is required.
Allows the following attributes: booleanvalue, contentvalidationname, 
currency, datevalue, formula, numbercolumnsrepeated, protect, 
stringvalue, stylename, timevalue, value, valuetype.

These elements contain table.CoveredTableCell: table.TableRow.
The following elements occur in table.CoveredTableCell: dr3d.Scene, 
draw.A, draw.Caption, ...


so odfpy, at least, can create such elements.



Here's an example of 2 merged ranges: A1:C2 contains the text "foo"
and D1:D2 contains "bar"


- 
  foo
  
  
- 
  bar
  
  
- 
  
  

Aside: If you are wondering where the cell addresses (D1 etc) are,
they're in the reader's current_row and current_col variables :-)
Perhaps this was intended to save space, but what of table:number-
columns-repeated="4" ??


Those are the 4 cell covered in the second row -- 3 by 'foo' and 1 by 
'bar'.  I believe there could have been two separate entries, but this 
is more compact, if less clear ;-)


Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-09 Thread John Machin
On Mar 10, 6:55 am, Terry Reedy  wrote:
> Krishnakant wrote:
> > 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.

It doesn't appear to be quite so simple.

ODS uses a  element as usual for the upper left
cell. Attributes set the range e.g. table:number-columns-spanned="3"
table:number-rows-spanned="2"

The gotcha is that it uses a *different* element for the cells covered
by the range. Example:


This is looks like structural amendments are needed to a package like
(python-)?ooolib(-python)? that doesn't grok merged cells -- its
source doesn't contain the string "covered". Doesn't seem like it
could be done just by poking in attributes.

Here's an example of 2 merged ranges: A1:C2 contains the text "foo"
and D1:D2 contains "bar"


- 
  foo
  
  
- 
  bar
  
  
- 
  
  

Aside: If you are wondering where the cell addresses (D1 etc) are,
they're in the reader's current_row and current_col variables :-)
Perhaps this was intended to save space, but what of table:number-
columns-repeated="4" ??

Cheers,
John

--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-09 Thread Terry Reedy

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
http://opendocumentfellowship.com/development/projects/odfpy

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

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-09 Thread John Machin
On Mar 9, 6:40 pm, 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.

It sure messed up when it hijacked two existing threads when sending
messages, so I'm not surprised if it's filing incoming mail in the
wrong place :-)

> 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.

There's another one called ooolib-python; have you had a look at that?

> 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.
>
> Do you know how I can work around this?

Here's a radical suggestion: Ask the author directly, or pop a note in
the suggestion box on the sourceforge tracker [hint: don't use your
mail client for this].

>
> I tryed searching for py2odf but did ont find any results.
>
> Do you want me to continue on the previous thread (I will try and dig
> that out ).

Nah, just hijack a third thread :-)

Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-09 Thread Krishnakant
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.

Do you know how I can work around this?

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

Do you want me to continue on the previous thread (I will try and dig
that out ).


happy hacking.
Krishnakant.

--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-08 Thread Terry Reedy

JanC wrote:

Krishnakant wrote:


This is my last attempt to search for a nice python library for creating
open document spreadsheet.

I tryed python-ooolib but did not find a few features like merging cells
(may be I am missing out some thing stupid ).


You could add that feature to python-ooolib.


I have asked for some help before on this topic but seems there is no
such library in python.


I have answered once or twice but got no reply from you.

--
http://mail.python.org/mailman/listinfo/python-list


Re: last and final attempt to search for python ods library.

2009-03-08 Thread JanC
Krishnakant wrote:

> This is my last attempt to search for a nice python library for creating
> open document spreadsheet.
>
> I tryed python-ooolib but did not find a few features like merging cells
> (may be I am missing out some thing stupid ).

You could add that feature to python-ooolib.

> I have asked for some help before on this topic but seems there is no
> such library in python.
>
> Pritty strange that python can't do this much.

"Python" can do it.  (Maybe nobody using & programming the libraries that
you tried ever needed it, so they didn't implement it, but that's something
different.)

> So please tell me if any one knows of a good solution for my problem
> else I am forced to give up python for my task.

You could use python-uno (it's included with OOo by default, and should be
able to do everything OOo can do.)


-- 
JanC
--
http://mail.python.org/mailman/listinfo/python-list