Aspose,如何用一个模板来导出到Excel
2012-04-13 09:53
239 查看
2. Adding Worksheets to a Designer Spreadsheet
The process of adding worksheets to a designer spreadsheet is entirely same as that of the above approach except that the Excel file is already created and we need to open that Excel file first before adding worksheet to it. A designer spreadsheet can be opened by the Workbook class.Example:
[C#]
//Creating a file stream containing the Excel file to be opened FileStream fstream = new FileStream("C:\\book1.xls", FileMode.Open); //Instantiating a Workbook object //Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); //Adding a new worksheet to the Workbook object int i = workbook.Worksheets.Add(); //Obtaining the reference of the newly added worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[i]; //Setting the name of the newly added worksheet worksheet.Name = "My Worksheet"; //Saving the Excel file workbook.Save(saveFileDialog1.FileName); //Closing the file stream to free all resources fstream.Close();
相关文章推荐
- 如何建立一个灵活的、可配置的导出数据到Excel的解决方案。
- 关于Excel操作编写的一个软件设计构思案例[连载] --如何把处理好后的数据导出Excel文件中(含背景\字体颜色设置)
- 一个很好的用C#导出数据到Excel模板的方法
- C# 如何将 不同的数据(多个查询结果集 dataset)导出到一个excel的不同sheet中
- [转]水晶报表如何完美导出一个Excel表格
- 水晶报表如何完美导出一个Excel表格(转)
- Asp.net开发经验-利用Aspose.Words按模板导出Word(注:Excel可以使用Aspose.Excel)
- Aspose.Cells Smart markers 基于模板导出Excel
- 水晶报表如何完美导出一个Excel表格(收藏)
- WinForm使用Aspose.cells利用模板导出Excel
- java利用POI通过模板导出excel的一个实例
- 水晶报表如何完美导出一个Excel表格
- Java 根据模板导出Excel时,如何根据后台数据设置复选框的勾选
- 使用Aspose.Cells利用模板导出Excel(C#)
- Aspose.Cells 根据Excel模板导出数据统计
- java通过模板导出excel的一个实例
- java通过模板导出excel的一个实例
- 利用Aspose.Cells和Excel模板导出复杂的统计数据
- 水晶报表如何完美导出一个Excel表格
- mysql如何将一个表导出为excel表格