Creating XML Spreadsheets
There are two basic routes to creating a SpreadsheetML document. The first route is perhaps best described as “start from scratch,” where you assemble a spreadsheet using the XML vocabulary. The other route uses Excel to build a template for the spreadsheets you create, accepting a certain amount of overhead for the convenience of using a familiar GUI (rather than a collection of XML parts) to create a spreadsheet. In general, especially where styles are involved, I strongly recommend using Excel to generate an initial SpreadsheetML file you can use as a model.
Whichever approach you choose, you don’t need to
provide as much information in your SpreadsheetML as Excel provides
when you save information out. Most of the metadata can be discarded,
and Excel can also reconstruct named ranges if necessary from the
NamedCell
elements inside of cells. Some data,
like the ss:ExpandedColumnCount
and
ss:ExpandedRowCount
attributes on the
Table
element, may actually be better left out, as
it takes extra effort to generate and may produce errors when the
spreadsheet is loaded if it’s wrong. For the most
part, you’ll want to focus on creating the basic row
and cell structures, along with styles.
You can use whatever tool you like to generate SpreadsheetML. XSLT, Java, C#, PHP, Perl, Python, Visual Basic, and many more will all work perfectly well. For complex spreadsheets with a lot of cross-references, I recommend working in whatever environment you’re most comfortable ...
Get Office 2003 XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.