ExcelExtendWriteExcelT(Stream, ListT, String, Boolean, Boolean) Method
將物件寫入Excel文件
Namespace: eBizprise.UtilityAssembly: eBizprise.Utility.ExcelHelper (in eBizprise.Utility.ExcelHelper.dll) Version: 25.0.1.0+9af286275430f5cdff066120a88db0d7edbaef7c
public static bool WriteExcel<T>(
this Stream stream,
List<T> datas,
string sheetName,
bool isOldVersion,
bool includeHeader
)
- stream Stream
- 資料流
- datas ListT
- 資料
- sheetName String
- 頁籤名稱
- isOldVersion Boolean
- 是否為2003前舊版Excel
- includeHeader Boolean
- 是否包含標題列
- T
- 物件
BooleanboolIn Visual Basic and C#, you can call this method as an instance method on any object of type
Stream. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
List<Employee> writeEmployees = new List<Employee>();
writeEmployees.Add(new Employee() { Account = "TestAccount1", EffectiveDate = DateTime.Now, EmployeeId = Guid.NewGuid(), EmployeeNo = "99999" });
writeEmployees.Add(new Employee() { Account = "TestAccount2", EffectiveDate = DateTime.Now, EmployeeId = Guid.NewGuid(), EmployeeNo = "99998" });
using (FileStream fileStream = new FileStream("ExcelHelperTest.xlsx", FileMode.OpenOrCreate))
fileStream.WriteExcel(writeEmployees, "Sheet1", false, true);
| Date | Version | Description |
|---|
| 2020/02/07 | 1.0.0.0 | 初版 |
| 2025/09/19 | 25.0.0.0 | 彙整2025年度初版 |