https://dotblogs.com.tw/yc421206/archive/2012/03/09/70624.aspx
http://blog.darkthread.net/post-2013-05-14-excel-interop-notes.aspx
搜尋許多方案,果然微軟推出的東西更新很頻繁
1..net方案:https://www.e-iceblue.com/
針對office作編輯
2..net/Java方案閱讀所有文件API:https://www.aspose.com/ (貴松松.....)
所有文件的編輯、讀取
3.Microsoft Office primary interop assemblies (PIAs):
早期版本,現在看起來像是使用Microsoft Office Developer Tools
網路上又說是:"Embed Interop Types"
http://shaurong.blogspot.tw/2016/11/com-interopoffice-pia.html
4.Microsoft Office Developer Tools:
5.NetOffice offers solutions for Office Developers in .NET:
https://netoffice.codeplex.com/
與1、2相同,唯一差別是MIT授權
後續應該會使用方案1免費版、方案5測試,還有方案4來練習看看
結論:
如果不匯出為PDF ,使用closedxml
如果要excel另存PDF,微軟的excel還是正解
範例程式如下:
using ClosedXML.Excel;
XLWorkbook workBook = new XLWorkbook(filePath + @"\purchaseListSAMPLE.xlsx");
IXLWorksheet sheet = workBook.Worksheet("SHEET1");
sheet.Cells("A" + (rowStartLine + Recordcounter)).Value = q.採購單;
sheet.Cells("B" + (rowStartLine + Recordcounter)).Value = q.確認碼;
workBook.SaveAs(savefilePath);