导出 C1List 到 Excel
有时,一些的需求是十分棘手的。例如,C1List 没有提供到出到 Excel 的接口。这篇文章就讲述如何将 C1List 导出到 Excel。
这个实现方法是结合 C1List 和 C1Excel 来导出 C1List 到 Excel。我们只需要把 C1List 的 Items 的 Values 属性到 C1Excel 下 Sheet。
C1.C1Excel.XLSheet excelSheet = this.c1XLBook1.Sheets[0]; if (excelSheet != null) { for (int i = 0; i < c1List1.Columns.Count; i++) { for (int j = 0; j < c1List1.ListCount; j++) { excelSheet[j, i].Value = this.c1List1.Columns[i].CellText(0); } } } this.c1XLBook1.Save("filename"); 复制代码
Demo 下载:
测试环境:C1 Studio for Windows && VS 2010
- ExportC1ListToExcel.zip (1.02 M, 下载次数:26)