Home » excel » How do I change the indenting for Excel's XML Data Export?

How do I change the indenting for Excel's XML Data Export?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am using Excel 2003’s XML Data Source and exporting the data using the menu option Data -> XML -> Export. The data exports fine, but the resulting elements are indenting using tabs. This may sound trivial, but is there a way I can set the formatting of the indents to spaces?

How to&Answers:

I don’t believe there’s anyway to modify the indent character (or XML-writer formatting) of Excel’s XmlMap export logic. If you can, consider writing a simple macro to perform the export yourself to a string variable via the XmlMap object’s ExportXml method, then perform a simple Replace of vbTab with Space(2) or whatever in the resulting string before writing it yourself to a file.

Good luck!

Answer:

If all else fails, you can always run it through Tidy afterwards.