Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

XML to WORD or EXCEL

what is the easiest way to take XML to Excel or a Transformed (w/ XSL) XML
file into
word? can i do this programatically in VB6?
thank you
Vinny
[170 byte] By [Vinny] at [2007-11-9 15:22:32]
# 1 Re: XML to WORD or EXCEL
Hi vinny,
we can always transform xml data in to word or exel, i do'nt abt
VB but i've done it using java where in i've used a package provided ny sun
called as "Jacob"...if u want details abt the package i'can mail the details
to u....

"Vinny" <vad@stgroup.net> wrote:
>what is the easiest way to take XML to Excel or a Transformed (w/ XSL) XML
>file into
>word? can i do this programatically in VB6?
>
>thank you
>
>Vinny
>
>
>
Ravikanth at 2007-11-11 23:30:20 >
# 2 Re: XML to WORD or EXCEL
In case you can't use Java (we all don't get to use the best tools :)) here
is a link. I haven't pursued it. Just a quick web search. --
http://www.google.com/search?q=cache:o4-cqUUi168C:lists.xml.org/archives/xml-dev/200112/msg00289.html+word+to+xml+vb&hl=en

Mark

"Ravikanth" <ravikanth@narumanchi.com> wrote:
>
>Hi vinny,
> we can always transform xml data in to word or exel, i do'nt abt
>VB but i've done it using java where in i've used a package provided ny
sun
>called as "Jacob"...if u want details abt the package i'can mail the details
>to u....
>
>
>
>"Vinny" <vad@stgroup.net> wrote:
>>what is the easiest way to take XML to Excel or a Transformed (w/ XSL)
XML
>>file into
>>word? can i do this programatically in VB6?
>>
>>thank you
>>
>>Vinny
>>
>>
>>
>
markn at 2007-11-11 23:31:21 >
# 3 Re: XML to WORD or EXCEL
you can even make it more simple :
save a excel file as html, look at the code, remove what is not needed, and
you'll get what is called : Office html

then you just have to create a XSLT file that will transform your xml into
office html... i put here a sample i made (as you can see it also specify
if it's a number so that the tags contents will be understood by excel as
Number and not as String

<?xml version="1.0"?>
<!--
File: excel.xsl
Purpose: XSLT EXCELVersion of reporting tool
Author: Elise Dupont 03/01/2002
Desc: Transform xml into a MS Office HTML that will be read by
Excel
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/*">
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
<meta name="ProgId" content="Excel.Sheet"/>
<meta name="Generator" content="Microsoft Excel 9"/>

<style>
table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;}
col
{mso-width-source:auto;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:bottom;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
mso-pattern:auto;
color:windowtext;
font-size:10.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Arial;
mso-generic-font-family:auto;
mso-font-charset:0;
border:none;
mso-protection:locked visible;
mso-style-name:Normal;
mso-style-id:0;}
td
{mso-style-parent:style0;
padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:windowtext;
font-size:10.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Arial;
mso-generic-font-family:auto;
mso-font-charset:0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
.xl1
{mso-style-parent:style0;
color:white;
font-weight:700;
font-family:Verdana, sans-serif;
mso-font-charset:0;
border-top:.5pt solid windowtext;
border-right:.5pt solid windowtext;
border-bottom:.5pt solid windowtext;
border-left:none;
background:#99CCFF;
mso-pattern:auto none;}
.xl2
{mso-style-parent:style0;
border-top:none;
border-right:.5pt solid windowtext;
border-bottom:.5pt solid windowtext;
border-left:none;
white-space:normal;}
</style>

</head>
<body>
<table x:str="" border="0" cellpadding="0" cellspacing="0" style='border-collapse:collapse;table-layout:fixed;width:467pt'>
<xsl:for-each select="./*[1]">
<tr>
<xsl:for-each select="./*">
<td class="xl1" ><xsl:value-of select="@name"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
<xsl:for-each select="./*" >
<tr>
<xsl:for-each select="./*">
<xsl:if test= "string(number(.))='NaN'">
<td class="xl2" ><xsl:value-of select="."/></td>
</xsl:if>
<xsl:if test = "string(number(.))!='NaN'">
<td class="xl2" x:num=""><xsl:value-of select="."/></td>
</xsl:if>
</xsl:for-each>
</tr>
</xsl:for-each>

</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

"Vinny" <vad@stgroup.net> wrote:
>what is the easiest way to take XML to Excel or a Transformed (w/ XSL) XML
>file into
>word? can i do this programatically in VB6?
>
>thank you
>
>Vinny
>
>
>
tyris at 2007-11-11 23:32:25 >
# 4 Re: XML to WORD or EXCEL
you simply save this file as myfile.xls and not myfile.html and excel opens
it and understands it correclty ! (i did it in java : transformation and
file name + extension)

regards
elise, xml girl
tyris at 2007-11-11 23:33:24 >
# 5 Re: XML to WORD or EXCEL
Not a very 'pure' way of doing it, and costs money, but ...

We use Data Dynamics Active Reports 2.0. It allows you to create reports
bound to XML data and export these to Excel, PDF, HTML, etc...

It has a designer for VB6 and can be controlled programatically.

Mark

"Vinny" <vad@stgroup.net> wrote:
>what is the easiest way to take XML to Excel or a Transformed (w/ XSL) XML
>file into
>word? can i do this programatically in VB6?
>
>thank you
>
>Vinny
>
>
>
mark smithson at 2007-11-11 23:34:29 >