2017年8月24日 星期四

使用 epplus 產生檔案後轉成 PDF

使用 FreeSpire.XLS
...
ep.Save();
using (var workbook = new Workbook())
using (var memStream = new MemoryStream()) {
workbook.LoadFromStream(ep.Stream as MemoryStream);
workbook.SaveToStream(memStream, Spire.Xls.FileFormat.PDF);
...
}

※FreeSpire.Office 包含 FreeSpire.XLS 和其他相關套件,可以操作 word,excel,... 並轉為PDF

沒有留言:

Entity Framework 建立新物件並儲存後馬上取得關聯資料

使用 CreateProxy 建立物件,不要直接 new var newmodel = _contextXXX.CreateProxy<yyy>(); ... _contextXXX.yyy.Add(newmodel); await _contextXXX.SaveC...