Ask Your Question
0

import .xml file as calc sheet

asked 2016-06-11 16:55:09 +0200

zenzeromod gravatar image

I want to replace ms excel with libreoffice calc for one of my clients but calc does not display the XML file in the same way as excel do. I wrote a python script that reads the XML file from standard input and sends a csv file to standard output . I want to create an XML file filter to create a spreadsheet to insert inside calc.

I am very interested in programming in python that you can find at: http://digitalimprint.com/misc/oooexp... but to export an XML file to a csv one.

Can you give me some direction to use the python scripts inside libreoffice as the example above?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-06-11 17:24:43 +0200

mauricio gravatar image

I create a simple example for you, see: https://gitlab.com/snippets/20846

image description

Best regards

edit flag offensive delete link more
0

answered 2016-06-11 18:27:54 +0200

zenzeromod gravatar image

updated 2016-06-11 19:53:41 +0200

Hi Mauritio,

I can adapt my code using your example with no problems to create the spreadsheet but I need one more step . I wish that when the user opens with libreoffice calc an xml file launches my python script to get the spreadsheet back. How I can teach libreoffice calc to load the spreadsheet using my script ?

This solution is close to what makes ms excel that does its best to show the xml file as a spreadsheet.

My code is generic enough to handle many xml files without problems , then I would teach libreoffice to open xml files using calc and do not write how it happens. Where can I find the documentation that explains how to do it ?

Thank you very much.

[Added after response to add details] the use case that I would handle is the following:

1) Mary wants to open an XML file with libreoffice but She want to see it as a spreadsheet in cal. 2) She selects the xml file and using the right mouse button and she choose the option " open with libreoffice calc " 3) calc forwards the xml file to my python script that loads the spreadsheet 4) once the spreadsheet is populated with the values ​​coming from the xml file She can save it in csv or xls or ods file.

I hope I explained it better.

edit flag offensive delete link more

Comments

The better documentation that I know, this here: https://wiki.openoffice.org/wiki/ES/M... only spanish

I'm sorry, I'm not understand your question. You ask... how ask to user the file xml?

mauricio gravatar imagemauricio ( 2016-06-11 18:51:44 +0200 )edit
mauricio gravatar imagemauricio ( 2016-06-11 20:23:40 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-06-11 16:55:09 +0200

Seen: 15,204 times

Last updated: Jun 11 '16