使用dotnetzip 套件來打包多筆word
直接將byte存進zip並存在記憶體匯出檔案
// 測試用匯出zip 多筆word var bytes = exportSvc.Export(ID); var bytes2 = exportSvc.Export(ID); // 打包多筆Word using (var zip = new ZipFile()) { zip.AddEntry("name_of_the_file.docx", bytes); zip.AddEntry("name_of_the_file2.docx", bytes2); // 存記憶體並匯出 using (MemoryStream output = new MemoryStream()) { zip.Save(output); return File(output.ToArray(), "application/zip", "sample.zip"); } }