0

How do I create a Template for the XSLT transformation from XML file to Excel 2010 file or Word 2010 ?

This is our Template for the Transformation in Execel 2003. But now I need it for 2010 ? Thanks for Help !

    <xsl:stylesheet xmlns="urn:schemas-microsoft-com:office:spreadsheet"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xslex="urn:XsltExtension"
                xmlns:html="http://www.w3.org/TR/REC-html40"
                xmlns:o="urn:schemas-microsoft-com:office:office"
                xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
                xmlns:x="urn:schemas-microsoft-com:office:excel"
                version="2.0">
  <xsl:output method="xml" indent="yes" />
   <xsl:output method="xml" version="1.0"/>
   <xsl:template match="/NewDataSet">
      <xsl:variable name="elements"          select="xs:schema/xs:element/xs:complexType/xs:choice/xs:element/xs:complexType/xs:sequence/*" />

      <xsl:variable name="columnAppearances" select="ColumnAppearances/*" />

      <xsl:processing-instruction name="mso-application">
         <xsl:text>progid="Excel.Sheet"</xsl:text>
      </xsl:processing-instruction>
      <Workbook>
     <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office" />
     <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
        <ProtectStructure>False</ProtectStructure>
        <ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
    </xsl:styleshee>
xargs
  • 2,741
  • 2
  • 21
  • 33
  • possible duplicate of [How to convert xml to excel file programmatically](http://stackoverflow.com/questions/2494967/how-to-convert-xml-to-excel-file-programmatically) – puretppc Jan 21 '14 at 16:36
  • you are right I saw that but I need it for Excel 2010, and it is not the same unfortunately – xargs Jan 21 '14 at 16:38

1 Answers1

1

The open XML format used by Excel 2007+ consists of many XML's inside a ZIP package. The overall format is very different than the single-file XML format you mention. If you have a working solution now, I suggest you leave it as is, and use interop to convert it to a newer format. If you want to avoid interop, then you should use the OpenXML SDK instead. Doing it with XSLT would be very painful, if not impossible, and it is certainly off-topic here because it's a vast amount of work.

fejesjoco
  • 11,763
  • 3
  • 35
  • 65