在winrt中使用syncfusion从已经创建的excel中创建epdf
本文关键字:创建 excel epdf winrt syncfusion | 更新日期: 2023-09-27 18:18:45
我正在使用syncfusion的方式来创建excel表格。现在我想创建相同格式的pdf。我看了一下syncfusion的示例代码,它非常复杂。那么有没有办法使用已经创建的excel来生成pdf呢?
我使用下面的代码创建excelAssembly executingAssembly = typeof(MainPage).GetTypeInfo().Assembly;
Stream inputStream = executingAssembly.GetManifestResourceStream("CRICKIT.Assets.TVM.xlsx");
IWorkbook book = await this.excelEngine.Excel.Workbooks.OpenAsync(inputStream);
inputStream.Dispose();
//Create Template Marker Processor
ITemplateMarkersProcessor marker = book.CreateTemplateMarkersProcessor();
//Binding the business object with the marker.
marker.AddVariable("TVMManager", App.ViewModel.TVMManager);
//Applies the marker.
marker.ApplyMarkers(UnknownVariableAction.Skip);
return book;
SyncFusion本身提供了一种将Excel电子表格转换为PDF的方法,如果您有Essential Studio的PDF部分。
如何进行转换的示例如下:
http://asp.syncfusion.com/Windows/demos/reporting/pdf/Import%20to%20PDF/Excel%20to%20PDF/Sample.aspx最简单的形式是这样的:
//Open the Excel document to convert
ExcelToPdfConverter converter=new ExcelToPdfConverter("Sample.xlsx");
//Convert Excel document into PDF document
PdfDocument pdfDoc = converter.Convert();
pdfDoc.Save("ExceltoPDF.pdf");
目前,In Syncfusion Essential XlsIO WINRT控件不支持将excel工作表转换为PDF文档。
谢谢,bloom。S