用ComponentOne C1XLBook加载XLS并输出为PDF?
我通常会使用C1Report来生成我在服务器上生成的报告并保存为PDF。 在这种情况下,报告确实需要基于Excel电子表格,所以我使用C1XLBook以所需格式构build数据。 但是,我不能解决如何将其导出为PDF文件。 可能? C1论坛似乎在这个时候完成,所以我不能在那里发表。
谢谢
杰夫
1.使用C1XLBook载入XLS文件:
System.Diagnostics.Process.Start(@"c:\mybook.xls");
要么
c1XLBook1.Load(@"c:\mybook.xls");
2.以PDF格式输出:
C1Excel不提供导出为pdf的function。 看到这里 。
不过, 这里提到了一个解决方法:
You may try using the following approach: 1. Load the excel file in FlexGrid. 2. Capture the image of the displayed flexgrid, please refer to the following link that describes the same: http://our.componentone.com/2011/04/19/control-rendering-in-print-document/ 3. Once, you have the image you can save the same to Pdf by using the DrawImage method of c1PDF. Please refer to the following link that describes the same: http://helpcentral.componentone.com/nethelp/c1pdf/index.html#!XMLDocuments/Reference/html/M_C1_C1Pdf_C1PdfDocument_DrawImage_2_7dee50e8.htm