Ask Your Question
0

Generate XML from XLS using macro

asked 2017-02-27 13:14:57 +0200

Anish gravatar image

Hi ,

Could anyone guide me to create macro which generate XML from XLS ....

Thanks

edit retag flag offensive close merge delete

Comments

What is "XML"? Do you mean one of XML-based formats, like ODF or OOXML? Or maybe MS Excel 2003 XML format? Or .FODS? Or something completely different?

What is "macro"? Do you need a LibreOffice macro (that may be assigned to a button in LO UI), say, in StarBasic? Or do you mean a shell script (like .BAT file on Windows, or Bash script for *nix)?

Mike Kaganski gravatar imageMike Kaganski ( 2017-02-27 14:38:46 +0200 )edit

Why'd you wanna do that, anyway ? If none of the other XML documents satisfy, you have to be very specific and know what you're doing, cuz you're talking about a different, custom, XML-based data format which'd have to be made. Last time I read, XLS is XML, just in binary form, inside a ZIP file.

rautamiekka gravatar imagerautamiekka ( 2017-02-27 15:07:03 +0200 )edit

Not quite true, XLS isn't XML-based. XLSX is.

Mike Kaganski gravatar imageMike Kaganski ( 2017-02-27 15:10:46 +0200 )edit

^ Another case of corrupted memory.

rautamiekka gravatar imagerautamiekka ( 2017-02-27 17:24:41 +0200 )edit

I have an excel template , when the excel is saved data from each cell should be exported to a .xml file with specific schema.

Anish gravatar imageAnish ( 2017-02-28 06:57:21 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2017-02-28 08:54:57 +0200

updated 2017-02-28 12:16:12 +0200

This resource may be of some help.

EDIT: Given that you've created and installed an export XSLT filter, you may use this (recorded) macro to export an open Calc file using it:

sub ExportToXML(outFileName)
  rem outFileName is in format "file:///path/to/filename.xml"

  dim args(0) as new com.sun.star.beans.PropertyValue
  args(0).Name = "FilterName"
  args(0).Value = "YOUR XSLT FILTER NAME" ' like existing "XHTML Calc File"

  ThisComponent.storeToURL(outFileName, args)
end sub
edit flag offensive delete link more

Comments

Thanks for your reply. But sorry am not looking in XML filtering using XSLT..I would like to use macros for generating .xml file

Anish gravatar imageAnish ( 2017-02-28 11:35:43 +0200 )edit

Ok, just wanted to notice that there are both filters for import and export.

Mike Kaganski gravatar imageMike Kaganski ( 2017-02-28 11:38:37 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-02-27 13:14:57 +0200

Seen: 574 times

Last updated: Feb 28 '17