ASHX处理程序中的XML到PDF(C#)

时间:2014-06-19 14:54:21

标签: c# asp.net xml pdf webforms

我好像有点卡住了。

我有一个用于导出到Excel的内容的类,它已经工作得很好。但问题是,现在我们需要PDF文件来获取相同的数据。如果有一种方法可以将原始xml转换为可读的pdf文件,那将会非常有用并节省时间。我目前在ashx处理程序中显示xml,虽然我不知道如何处理数据。

示例XML输入:

    <?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">
<Styles>
<Style ss:ID="linkStyle">
<Font ss:Color="#0000FF" ss:Underline="Single"/>
</Style>
<Style ss:ID="s831920757">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:Rotate="0" ss:WrapText="1"/>
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="10" ss:Color="#000000" ss:Bold="0" ss:Italic="0"/>
<Interior ss:Color="#C4D79B" ss:Pattern="Solid"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
</Borders>
</Style>
<Style ss:ID="s560423649">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:Rotate="0" ss:WrapText="1"/>
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="10" ss:Color="#000000" ss:Bold="0" ss:Italic="0"/>
</Style>
<Style ss:ID="s305706785">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:Rotate="0" ss:WrapText="1"/>
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="10" ss:Color="#ffffff" ss:Bold="1" ss:Italic="0"/>
<Interior ss:Color="#777777" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s-2114824811">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:Rotate="0" ss:WrapText="1"/>
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="10" ss:Color="#000000" ss:Bold="0" ss:Italic="0"/>
<Interior ss:Color="#DDDDDD" ss:Pattern="Solid"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#aaaaaa"/>
</Borders>
</Style>
<Style ss:ID="s-475410841">
<Alignment ss:Horizontal="Left" ss:Vertical="Center" ss:Rotate="0" ss:WrapText="1"/>
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="10" ss:Color="#000000" ss:Bold="0" ss:Italic="0"/>
</Style>
</Styles>
<Names/>
<Worksheet ss:Name="Summary">
<Table DefaultColumnWidth="400">
<Row>
<Cell ss:StyleID="s305706785" ss:MergeAcross="1">
<Data ss:Type="String">Header data</Data>
</Cell>
</Row>
<Row>

0 个答案:

没有答案