分享个c#的excel, pdf,word,PowerPoint第三方Syncfusion操作程序集DocIO/xlsIO...
By
admin
at 2023-01-12 • 0人收藏 • 1026人看过
File Format library | Description |
---|---|
Essential PDF | .NET Class library used to create, read, and write PDF files in .NET Framework [Windows Forms, WPF, ASP.NET MVC, ASP.NET], .NET Core, UWP and Xamarin applications. |
Essential XlsIO | .NET Class library used to create, read, edit, write, and convert Microsoft Excel files in .NET Framework [Windows Forms, WPF, ASP.NET MVC, ASP.NET], .NET Core, UWP, and Xamarin applications. |
Essential DocIO | .NET Class library used to create, read, edit, and convert Microsoft Word files in .NET Framework [Windows Forms, WPF, ASP.NET MVC, ASP.NET], .NET Core, UWP, and Xamarin applications. |
Essential Presentation | .NET Class library used to create, read, edit, and convert Microsoft PowerPoint (PPTX) files in .NET Framework [Windows Forms, WPF, ASP.NET MVC, ASP.NET], .NET Core, UWP, and Xamarin applications. |
Create a PDF file in C# without Adobe
Create Excel file in C# without Microsoft Office
Create Word file in C# without Microsoft Office
Create PowerPoint file in C# without Microsoft Office
官方地址:
https://help.syncfusion.com/file-formats/introduction#list-of-file-format-libraries
试用版生成文档会有试用提示.
using Syncfusion.XlsIO; ExcelEngine excelEngine = new ExcelEngine(); //Instantiate the Excel application object IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Excel2013; IWorkbook workbook = application.Workbooks.Create(1); //Access a worksheet from workbook IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range[行, 列].Number = pA; //worksheet.Range["A3"].Number = pA; //Saving the workbook to disk in XLSX format workbook.SaveAs("SampleTest_"+ DateTime.Now.ToString("yyMMddhhmmss") + ".xlsx"); //Closing the workbook workbook.Close(); //Dispose the Excel engine excelEngine.Dispose();
8 个回复 | 最后更新于 2023-01-16
2023-01-15
#4
其实操作excel还是用python方便,现在aardio调用python也比以往更容易了。
import console; console.setTitle("python_openpyxl"); console.open(); import py3.10; py3.appendPath("\py"); openpyxl = py3.import("openpyxl"); wb = openpyxl.Workbook(); wb.create_sheet("Sheet1", index=0); ws = wb.worksheets[0]; ws.append({"col1", "col2"}); ws.append({1,2}); wb.save("test.xlsx"); wb.close(); /** //直接用python代码 pycode = ` import openpyxl as xl wb = xl.Workbook() wb.create_sheet("Sheet1", index=0) ws = wb.worksheets[0] ws.append(["col1", "col2"]) ws.append([1,2]) wb.save('C:\\Users\\Administrator\\Desktop\\test.xlsx') wb.close() ` py3.exec(pycode); **/ console.pause();
注:
需要在py目录下把依赖库(openpyxl和et_xmlfile)复制进去。
2023-01-15
#5
读取也没问题
openpyxl = py3.import("openpyxl"); wb = openpyxl.load_workbook("C:\\Users\\Administrator\\Desktop\\test.xlsx"); ws = wb.worksheets[0]; console.log(ws.cell(1,1).value)
登录后方可回帖
xlsIO 20.3.0.47 的注册版, 可以体验正版的功能了.
链接:https://pan.baidu.com/s/1LzVAogRdL8T3iJ6r7BKADA?pwd=zaku
提取码:zaku
Syncfusion的所有可用程序集,所有的Dll集合
注册Key如下:
MDAxQDMyMzAyRTMzMkUzMFlMdDQ3dXd2M0crb3ZhYi93RjBBaUpESEhwUE1kT05ReW1WcWE3a2ErVUE9
链接:https://pan.baidu.com/s/1qI-UfLSkQNJUnoYWQPEPDA?pwd=8k8h
提取码:8k8h
下面介绍下怎么用:
vs引用了里引用 Syncfusion.XlsIO.Base.dll 和 Syncfusion.Licensing.dll
在工程的program.cs里注册: