Has anyone generated Open Office Calc XML files from python

Discussion in 'Python' started by vj, Nov 16, 2006.

  1. vj

    vj Guest

    I have a program which generates xml files for excel but these files
    are not recognized by open office calc. I looked at the OO uno library,
    but it seems like an over kill.

    In my experience, for simpler documents, it is much faster to directly
    write to underlying XML format. Has anyone done this? Any idea on the
    XML format used by Open Office Calc?

    VJ
     
    vj, Nov 16, 2006
    #1
    1. Advertising

  2. vj

    vj Guest

    vj, Nov 16, 2006
    #2
    1. Advertising

  3. vj

    vasudevram Guest

    Re: Has anyone generated Open Office Calc XML files from python

    vj wrote:
    > I just found something in perl:
    >
    > http://tools.openoffice.org/profiling/pod/LogFile/XML.html
    >
    > Will try and reverse engineer this, unless something like this exists
    > in python.
    >
    > VJ


    Isn't generating CSV output suitable to your needs?
    Python's CSV module makes that very simple - unless you want to include
    images, etc. in the XLS file?

    Vasudev
    ~~~~~~~~~~~~~~~~~~~~~~
    Vasudev Ram
    Dancing Bison Enterprises
    Software consulting and training,
    custom software development
    http://www.dancingbison.com
    http://sourceforge.net/projects/xtopdf
    ~~~~~~~~~~~~~~~~~~~~~~
     
    vasudevram, Nov 16, 2006
    #3
  4. vj wrote:

    > I have a program which generates xml files for excel but these files
    > are not recognized by open office calc. I looked at the OO uno library,
    > but it seems like an over kill.


    this could be a start:

    http://ooopy.sourceforge.net/

    </F>
     
    Fredrik Lundh, Nov 16, 2006
    #4
  5. vj

    vj Guest

    Re: Has anyone generated Open Office Calc XML files from python


    > http://ooopy.sourceforge.net/


    I downloaded the package. unfortunately there are no examples that come
    with. I found another python package which is more geared to creating
    simple calc objects from python at. Apparently it is a port of the perl
    library.

    http://sourceforge.net/project/showfiles.php?group_id=87437

    Here is one of the examples from the library. Seems pretty simple and
    exactly what I was looking for:

    -----------------------------------------------------------------------
    import ooolib

    # Create your document
    doc = ooolib.Calc()

    # Set values. The values are set in column, row order, but the values
    are
    # not in the traditional "A5" style format. Instead we require two
    integers.
    # set_cell_value(col, row, datatype, value)
    for row in range(1, 9):
    for col in range(1, 9):
    doc.set_cell_value(col, row, "float", col * row)

    # Save the document to the file you want to create
    doc.save("calc-example01.ods")

    -----------------------------------------------------------------------
    VJ
     
    vj, Nov 16, 2006
    #5
  6. vj

    vj Guest

    Re: Has anyone generated Open Office Calc XML files from python

    > Isn't generating CSV output suitable to your needs?
    > Python's CSV module makes that very simple - unless you want to include
    > images, etc. in the XLS file?


    You cannot create multiple worksheets using this method, or apply any
    other form of formatting.

    VJ
     
    vj, Nov 16, 2006
    #6
  7. vj

    vasudevram Guest

    Re: Has anyone generated Open Office Calc XML files from python

    vj wrote:
    > > Isn't generating CSV output suitable to your needs?
    > > Python's CSV module makes that very simple - unless you want to include
    > > images, etc. in the XLS file?

    >
    > You cannot create multiple worksheets using this method, or apply any
    > other form of formatting.
    >
    > VJ


    Ok, got it.
     
    vasudevram, Nov 18, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stan Accrington
    Replies:
    1
    Views:
    985
    Michael Borgwardt
    May 13, 2004
  2. John Kotuby
    Replies:
    9
    Views:
    317
    Mark Rae
    May 17, 2007
  3. rtilley
    Replies:
    9
    Views:
    134
    rtilley
    Mar 19, 2006
  4. Roman Hausner
    Replies:
    4
    Views:
    194
    Hannes Wyss
    May 21, 2007
  5. Kaye Ng

    ruby calc.rb or just calc.rb

    Kaye Ng, Jul 26, 2010, in forum: Ruby
    Replies:
    7
    Views:
    432
    Kaye Ng
    Jul 28, 2010
Loading...

Share This Page