我有一个要求,我需要构建一个XSLT文件,该文件基本上将按照this link中的教程保存为XML Spreadsheet 2003格式(MS Excel),大致如下所示:
<?xml version="1.0"?>
<?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">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Version>16.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>9600</WindowHeight>
<WindowWidth>24000</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62" ss:Name="Normal 2">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s63">
<Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
</Style>
<Style ss:ID="s66" ss:Parent="s62">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<Worksheet ss:Name="Plan Comparison">
<Table ss:ExpandedColumnCount="3" ss:ExpandedRowCount="22" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="232.5" ss:DefaultRowHeight="15" ss:DefaultColumnHeight="15">
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"> QUOTE ID: </Data></Cell>
<Cell><Data ss:Type="String"> ZIPCODE OF BUSINESS: </Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"> EMPLOYER NAME: </Data></Cell>
<Cell><Data ss:Type="String"> COUNTY: </Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"> EFFECTIVE DATE: 04/15/2017</Data></Cell>
<Cell><Data ss:Type="String"> PRODUCER: </Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"> NUMBER OF EMPLOYEES: 8</Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"></Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String"></Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String"></Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"></Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String">TEST</Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String">TEST</Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String">STD</Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"> EligibleEmployees</Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String">8</Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String">8</Data></Cell>
</Row>
<Row ss:StyleID="s63">
<Cell ss:StyleID="Default"><Data ss:Type="String"> EstimatedVolume</Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String">$1,152.00</Data></Cell>
<Cell ss:StyleID="s66"><Data ss:Type="String">$1,152.00</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>13</ActiveRow>
<ActiveCol>2</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
在MS Excel中打开的文件的屏幕截图:
面临的问题: 我尝试使用HSSF,XSSF以及OpenXml打开生成的XML文件,但没有运气。
问题:
我需要在屏幕截图中以黄色标记的空格中添加图像,我该怎么做? 如果使用此方法无法实现,如何使用NPOI打开生成的XML / XLS文件,添加图像并使用该框架下载纯.xls文件?