Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Create XML Spreadsheet ???

Posted on 2004-09-21
10
Medium Priority
?
2,038 Views
Last Modified: 2013-11-19
hello everybody
i have one file XML, import to excel(Excel 2003) without xsl style file ->>OK
but with my xsl file error : Import XML Error

error code: -1072896682
URL : ..\temp\6b1.tmp
Reason: Invalid at the top level of the document.
Line : 1
Column: 22
File Offset :21


Excel 2003
Souce XSL file:
------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD">

<xsl:template match="/">
<xsl:pi name="xml">version="1.0"</xsl:pi>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40"
 xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <LastAuthor>BTC</LastAuthor>
  <Created>2004-09-22T04:26:42Z</Created>
  <Version>11.6360</Version>
 </DocumentProperties>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>9345</WindowHeight>
  <WindowWidth>15135</WindowWidth>
  <WindowTopX>120</WindowTopX>
  <WindowTopY>45</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
  <FutureVer>11</FutureVer>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="VNI-Times"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s22">
   <NumberFormat/>
  </Style>
  <Style ss:ID="s23">
   <NumberFormat ss:Format="@"/>
  </Style>
  <Style ss:ID="s24">
   <Font ss:FontName="VNI-Times" ss:Bold="1"/>
   <Interior ss:Color="#00CCFF" ss:Pattern="Solid"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Names>
   <NamedRange ss:Name="_FilterDatabase" ss:RefersTo="=Sheet1!R4C3:R6C12"
    ss:Hidden="1"/>
  </Names>
  <Table ss:ExpandedColumnCount="12" ss:ExpandedRowCount="6" x:FullColumns="1"
   x:FullRows="1" ss:DefaultRowHeight="14.25">
   <Column ss:Width="27.75"/>
   <Column ss:Width="77.25"/>
   <Column ss:Width="55.5"/>
   <Column ss:Width="96.75"/>
   <Column ss:Width="46.5"/>
   <Column ss:AutoFitWidth="0" ss:Width="86.25"/>
   <Column ss:Width="36.75"/>
   <Column ss:Width="47.25"/>
   <Column ss:Width="52.5"/>
   <Column ss:Width="72.75"/>
   <Column ss:AutoFitWidth="0" ss:Width="64.5"/>
   <Column ss:AutoFitWidth="0" ss:Width="65.25"/>
   <Row ss:Index="4" ss:Height="15.75">
    <Cell ss:Index="3" ss:StyleID="s24"><Data ss:Type="String">ID</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">TenHC</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">MaHC</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">NCC</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">DVT</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">SL</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">DG</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">TT</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">VAT</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String">TONGCONG</Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
   </Row>
<xsl:for-each select="xml/rs:data/z:row">
   <Row ss:AutoFitHeight="0">
    <Cell ss:StyleID="s23"><Data ss:Type="Number"><xsl:value-of select="@ID"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String"><xsl:value-of select="@TenHC"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String"><xsl:value-of select="@MaHC"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String"><xsl:value-of select="@NCC"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s24"><Data ss:Type="String"><xsl:value-of select="@DVT"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><Data ss:Type="Number"><xsl:value-of select="@SL"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><Data ss:Type="Number"><xsl:value-of select="@DG"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><Data ss:Type="Number"><xsl:value-of select="@TT"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><Data ss:Type="Number"><xsl:value-of select="@VAT"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><Data ss:Type="Number"><xsl:value-of select="@TONGCONG"/></Data><NamedCell
      ss:Name="_FilterDatabase"/></Cell>
   </Row>
</xsl:for-each>
   <Row>
    <Cell ss:Index="3" ss:StyleID="s22"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s23"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s22"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s22"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s22"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s22"><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell ss:StyleID="s22"><NamedCell ss:Name="_FilterDatabase"/></Cell>
   </Row>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>5</ActiveRow>
     <ActiveCol>7</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <Worksheet ss:Name="Sheet2">
  <Table ss:ExpandedColumnCount="0" ss:ExpandedRowCount="0" x:FullColumns="1"
   x:FullRows="1" ss:DefaultRowHeight="14.25"/>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <Worksheet ss:Name="Sheet3">
  <Table ss:ExpandedColumnCount="0" ss:ExpandedRowCount="0" x:FullColumns="1"
   x:FullRows="1" ss:DefaultRowHeight="14.25"/>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <x2:MapInfo x2:HideInactiveListBorder="false">
  <x2:Schema x2:ID="Schema1" x2:Namespace=""><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element nillable="true" name="NewDataSet"><xsd:complexType><xsd:sequence minOccurs="0"><xsd:element minOccurs="0" maxOccurs="unbounded" nillable="true" name="TblTONKHO" form="unqualified"><xsd:complexType><xsd:sequence minOccurs="0"><xsd:element minOccurs="0" nillable="true" type="xsd:integer" name="ID" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:string" name="TenHC" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:string" name="MaHC" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:string" name="NCC" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:string" name="DVT" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:integer" name="SL" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:integer" name="DG" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:integer" name="TT" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:double" name="VAT" form="unqualified"></xsd:element><xsd:element minOccurs="0" nillable="true" type="xsd:double" name="TONGCONG" form="unqualified"></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:schema></x2:Schema>
  <x2:Map x2:ID="NewDataSet_Map" x2:SchemaID="Schema1" x2:RootElement="NewDataSet">
   <x2:Entry x2:Type="table" x2:ID="5" x2:ShowTotals="false">
    <x2:Range>Sheet1!R5C3:R6C12</x2:Range>
    <x2:HeaderRange>R4C3</x2:HeaderRange>
    <x:FilterOn>False</x:FilterOn>
    <x2:XPath>/NewDataSet/TblTONKHO</x2:XPath>
    <x2:Field x2:ID="ID">
     <x2:Range>RC</x2:Range>
     <x2:XPath>ID</x2:XPath>
     <x2:XSDType>integer</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="TenHC">
     <x2:Range>RC[1]</x2:Range>
     <x2:XPath>TenHC</x2:XPath>
     <x2:XSDType>string</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="MaHC">
     <x2:Range>RC[2]</x2:Range>
     <x2:XPath>MaHC</x2:XPath>
     <x2:XSDType>string</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="NCC">
     <x2:Range>RC[3]</x2:Range>
     <x2:XPath>NCC</x2:XPath>
     <x2:XSDType>string</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="DVT">
     <x2:Range>RC[4]</x2:Range>
     <x2:XPath>DVT</x2:XPath>
     <x2:XSDType>string</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="SL">
     <x2:Range>RC[5]</x2:Range>
     <x2:XPath>SL</x2:XPath>
     <x2:XSDType>integer</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="DG">
     <x2:Range>RC[6]</x2:Range>
     <x2:XPath>DG</x2:XPath>
     <x2:XSDType>integer</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="TT">
     <x2:Range>RC[7]</x2:Range>
     <x2:XPath>TT</x2:XPath>
     <x2:XSDType>integer</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="VAT">
     <x2:Range>RC[8]</x2:Range>
     <x2:XPath>VAT</x2:XPath>
     <x2:XSDType>double</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
    <x2:Field x2:ID="TONGCONG">
     <x2:Range>RC[9]</x2:Range>
     <x2:XPath>TONGCONG</x2:XPath>
     <x2:XSDType>double</x2:XSDType>
     <ss:Cell>
     </ss:Cell>
     <x2:Aggregate>None</x2:Aggregate>
    </x2:Field>
   </x2:Entry>
  </x2:Map>
 </x2:MapInfo>
 <x2:Binding x2:ID="Binding1" x2:LoadMode="normal">
  <x2:MapID>NewDataSet_Map</x2:MapID>
<udc:DataSource MajorVersion="1" MinorVersion="0" xmlns:udc="http://schemas.microsoft.com/data/udc">
  <udc:Type Type="XMLFile" MajorVersion="1" MinorVersion="0"/>
  <udc:Name>Binding1</udc:Name>
  <udc:ConnectionInfo Purpose="Query">
    <udcxf:File xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile">C:\Customers.xml</udcxf:File>
  </udc:ConnectionInfo>
</udc:DataSource>
 </x2:Binding>
</Workbook>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>


-------------------------
Please help me
0
Comment
Question by:LearnITvn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
10 Comments
 
LVL 7

Expert Comment

by:J_Mak
ID: 12120300
One big problem you have is that you have two <xsl:stylesheet> elements. There should only be one. That is, instead of having:

<xsl:stylesheet>
   <xsl:stylesheet>
   ......
   </xsl:stylesheet>
</xsl:stylesheet>

just leave it like this:

<xsl:stylesheet>
   ......
</xsl:stylesheet>

Also, why are you importing a stylesheet? You only ever import XML files into Excel. Stylesheets are rules which define an XML transformation, they can't be visually represented.
0
 

Author Comment

by:LearnITvn
ID: 12120740
Hi J_Mak
when only one <xsl:stylesheet>, it's don't work, too
above code from : http://support.microsoft.com/default.aspx?scid=kb;EN-US;285891
please port sample code "XSL Style, Open XML with XSL style in Excel " if you have
Thanks
0
 
LVL 15

Expert Comment

by:dualsoul
ID: 12120959
hm...i'm not sure i understand the task you are trying to solve.

but as  J_Mak  said, you have 2 same namespaces with different urls - how you want to distinguish them?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:J_Mak
ID: 12129524
instead of using xmlns:xsl="http://www.w3.org/TR/WD"

try xmlns:xsl="http://www.w3.org/TR/WD-xsl"

But i still don't see the point of importing a stylesheet into Excel.

Cheers.
0
 

Author Comment

by:LearnITvn
ID: 12129910
HI J_Mak  
if try xmlns:xsl="http://www.w3.org/TR/WD-xsl" then
error: The "http://www.w3.org/TR/WD-xsl"  namespace is no longer supported in this version of MSXML

what happen??
0
 
LVL 15

Expert Comment

by:dualsoul
ID: 12131009
LearnITvn , are you able to explain what are you trying to do?
0
 

Author Comment

by:LearnITvn
ID: 12139169
hi dualsoul
I have a XML file, I want open it in excel with XSL style
0
 
LVL 7

Accepted Solution

by:
J_Mak earned 2000 total points
ID: 12140025
You cannot do that. Excel only has the ability to open Excel XMLfiles which have been formatted in properly in XML.

Have a look at this link for more information:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlsmlinss.asp

What you need to do is create a stylesheet which you can use to transform something into ExcelXML format so that you can see it in Excel.

Cheers.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question