2015-09-04 72 views
0

我想從xslt創建一個包含多個工作表的Excel。但我不能創建多個工作表。下面的代碼:從xslt在Excel中創建多個工作表

<?xml version="1.0" encoding="ISO-8859-1"?> 

<xsl:stylesheet version="1.0" xmlns="urn:schemas-microsoft-com:office:spreadsheet" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
xmlns:user="urn:my-scripts" xmlns:o="urn:schemas-microsoft-com:office:office" 
xmlns:x="urn:schemas-microsoft-com:office:excel" 
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> 

<xsl:output method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" omit-xml-declaration="yes"/> 

<xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/> 

<xsl:template match="/"> 

<Worksheet ss:Protected="0" ss:Name="OBB Datos básicos"> 
<table border="1"> 
<tr> 
<th align="center" bgcolor="grey" colspan="6" ><font color="black">Detalle de la OBB</font></th> 
</tr> 
</table> 
<table> 
<tr> 
<th align="left" bgcolor="white" colspan="1">Clase de operación:</th> 
</tr> 
</table> 
</Worksheet> 

<Worksheet ss:Protected="0" ss:Name="Conceptos"> 
<table border="1"> 
<tr> 
<th align="center" bgcolor="grey" colspan="6" ><font color="black">Concepto</font></th> 
</tr> 
</table> 
</Worksheet> 

</xsl:template> 
</xsl:stylesheet> 

此代碼生成它:

enter image description here

任何想法如何在Excel中創建多個工作表?

回答

1

你似乎錯過了根元素,我很驚訝它顯示。

在您的案例中添加ss:WorkBook(或WorkBook),這可能已經足夠,或者檢查this tutorial for more help您的結構中缺少的零件。

相關問題