错误:通过XSLT导出Excel [英] Error : Exporting excel through XSLT

查看:89
本文介绍了错误:通过XSLT导出Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过xmlxslt导出excel文件并收到此错误..当尝试打开此文件时...这是日志文件

i'm exporting excel file through xml and xslt and getting this error..when trying to open this file...this is the log file

XML ERROR in Table
REASON: Bad Value
FILE:   C:\Documents and Settings\mayankp\Desktop\PrintCheckList.xls
GROUP:  Row
TAG:    Cell
ATTRIB: Index
VALUE:  0

XML ERROR in Table
REASON: Bad Value
FILE:   C:\Documents and Settings\mayankp\Desktop\PrintCheckList.xls
GROUP:  Row
TAG:    Cell
ATTRIB: Index
VALUE:  1

XML ERROR in Table
REASON: Bad Value
FILE:   C:\Documents and Settings\mayankp\Desktop\PrintCheckList.xls
GROUP:  Row
TAG:    Cell
ATTRIB: Index
VALUE:  2

XML ERROR in Table
REASON: Bad Value
FILE:   C:\Documents and Settings\mayankp\Desktop\PrintCheckList.xls
GROUP:  Row
TAG:    Cell
ATTRIB: Index
VALUE:  0

XML ERROR in Table
REASON: Bad Value
FILE:   C:\Documents and Settings\mayankp\Desktop\PrintCheckList.xls
GROUP:  Row
TAG:    Cell
ATTRIB: Index
VALUE:  1

XML ERROR in Table
REASON: Bad Value
FILE:   C:\Documents and Settings\mayankp\Desktop\PrintCheckList.xls
GROUP:  Row
TAG:    Cell
ATTRIB: Index
VALUE:  2

感谢您的帮助.

编辑:在此处

推荐答案

XML示例尚不完整,但从外观上看,问题可能出在第二行

The XML sample isn't complete, but looking at it, the issues may lie with your second row

     <Row ss:Height="15.75" ss:StyleID="s62">
        <Cell ss:MergeDown="2" ss:StyleID="m57097196">
           <Data ss:Type="String">S/N</Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097216">
           <Data ss:Type="String">PRIORITY</Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097076">
           <Data ss:Type="String">ITEM </Data>
        </Cell>
        <Cell ss:MergeAcross="2" ss:StyleID="m57097176">
           <Data ss:Type="String">AUDIT TYPE </Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097236">
           <Data ss:Type="String">STATUS </Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097280">
           <Data ss:Type="String">REFERENCE </Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097056">
           <Data ss:Type="String">AUDIT REMARKS</Data>
        </Cell>
     </Row>

尤其是 ss:MergeDown ss:MergeAcross 属性.如果您查看 Microsoft Xml电子表格参考,您会看到 ss:MergeAcross 内容如下:

In particular the ss:MergeDown and ss:MergeAcross attributes. If you look at the Microsoft Xml Spreadsheet Reference you will see for ss:MergeAcross it says the following:

指定跨越的相邻单元格的数量(正确的除非在 从右到左模式)从当前单元格合并.如之前提到 以上,索引不得重叠.如果存在重复,则行为是 未指定,则XML电子表格文档被视为无效.

Specifies the number of adjacent cells across (right unless in right-to-left mode) from the current cell to merge. As mentioned above, indices must not overlap. If duplicates exist, the behavior is unspecified and the XML Spreadsheet document is considered invalid.

因此,您可能会遇到错误,因为以下单元格位于第5列中,并且与第4列中的Cell重叠,而第4列中的Cell分布在以下两个单元格中.您需要将第五个单元格的索引显式设置为第7列.(请注意,第五个单元格中使用ss:Index ="7").

So, you may be getting the error because the following Cell is positioned in column 5, and this overlaps Cell in column 4, which spreads across the following two cells. You need to explicitly set the index of the fifth cell to be in column 7. (Note the use of ss:Index="7" in the fifth cell).

     <Row ss:Height="15.75" ss:StyleID="s62">
        <Cell ss:MergeDown="2" ss:StyleID="m57097196">
           <Data ss:Type="String">S/N</Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097216">
           <Data ss:Type="String">PRIORITY</Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097076">
           <Data ss:Type="String">ITEM </Data>
        </Cell>
        <Cell ss:MergeAcross="2" ss:StyleID="m57097176">
           <Data ss:Type="String">AUDIT TYPE </Data>
        </Cell>
        <Cell ss:Index="7" ss:MergeDown="2" ss:StyleID="m57097236">
           <Data ss:Type="String">STATUS </Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097280">
           <Data ss:Type="String">REFERENCE </Data>
        </Cell>
        <Cell ss:MergeDown="2" ss:StyleID="m57097056">
           <Data ss:Type="String">AUDIT REMARKS</Data>
        </Cell>
     </Row>

此外,由于使用了 ss:Mergedown ,因此将单元格设置为2,这意味着接下来的两行将被占用.因此,应更改xml中的下一个Row元素,以将索引显式设置为5,以免重叠.

Additionallly, because of the use of ss:Mergedown, set to 2 for the cells, this means the next two rows are taken up. Therefore the next Row element in your xml should be changed to explicitly set the index to 5 so as not to overlap.

     <Row ss:Index="5" ss:Height="30">
        <Cell ss:StyleID="s76">
           <Data ss:Type="String">1</Data>
        </Cell>

这有望解决您的问题.

这篇关于错误:通过XSLT导出Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆