This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: XML data to MS-Excel??
- To: <xsl-list at lists dot mulberrytech dot com>, <mmalviya at optechsolutions dot com>
- Subject: RE: [xsl] XML data to MS-Excel??
- From: "Robert C. Lyons" <boblyons at unidex dot com>
- Date: Thu, 1 Feb 2001 09:54:17 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
Manisha wrote:
> Hello friends,
> I want to convert my xml data to Ms-Excel can
> some one suggest me how to start?
> Thanks in advance.
You can use an XSLT stylesheet to transform the XML into
one of the following data formats, all of which can be
imported into an Excel spreadsheet:
1) Tab delimited data - This works well if you know that
none of the cell values will contain tab characters
or end of line characters. However, the tab delimited
data won't contain any information about fonts, colors,
borders, formulas, etc. (In other words, the spreadsheets
will be quite dull.)
2) Comma Separated Values (CSV) - This works well even if
some cell values contain commas and/or end of line
characters, since you can enclose each cell value in
quotes. However, if a cell value contains a quote
character, then you must escape the quote char with
an additional quote char. This is doable in XSLT, but
it's not easy. Also, the CSV file won't contain any information
about fonts, colors, borders, formulas, etc.
3) HTML table - Excel 97+ can import (and export) an HTML
table. Excel will honor the HTML attributes that control
text size, color, etc. However, I believe that Excel will
ignore any attributes that are defined in a CSS.
The HTML can even contain some Microsoft-proprietary
attributes that control number formatting. I don't think
the HTML table can contain spreadsheet formulas. To learn more
about importing HTML tables into Excel, you can export a
variety of Excel spreadsheets to HTML and examine the
resulting HTML.
4) Office 2000's HTML+XML format - Excel 2000 can import (and export)
HTML+XML documents. These HTML+XML documents contain XML islands,
which encode spreadsheet information that can't be expressed in HTML.
I've heard that Excel 2000 can convert between binary spreadsheets
and HTML+XML spreadsheets without loss of information.
To learn more about this, you might want to read the
"Microsoft Office HTML and XML Reference", which is available at
http://msdn.microsoft.com/library/officedev/ofxml2k/ofxml2k.htm.
5) SYLK (Symbolic Link) - If some of your users have spreadsheet
software that can't import/open an HTML table but that can
open a SYLK file, then you can transform the XML into SYLK.
SYLK is a text-based interchange format for spreadsheets;
it supports formulas, borders, fonts, point sizes, etc.
SYLK is supported by Excel and other spreadsheet packages.
SYLK is the RTF of spreadsheets. The problem with SYLK is
that it is not well documented. You can find some links and
references to some terse SYLK documents in section 14 of the
comp.apps.spreadsheets FAQ at http://www.faqs.org/faqs/spreadsheets/faq/.
You can also learn SYLK by creating a variety of simple
spreadsheets, exporting each of them to a SYLK file and
analyzing the resulting SYLK.
Best regards,
Bob
<sig name = 'Bob Lyons'
title = 'E-Commerce Consultant'
company = 'Unidex, Inc.'
phone = '+1-732-975-9877'
email = 'boblyons@unidex.com'
url = 'http://www.unidex.com/'
product = 'XML Convert: transforms flat files to XML and vice versa' />
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list