标签:style blog http ar color os 使用 sp on
1、读取
using (FileStream stream = new FileStream(@"c:\客户资料.xls", FileMode.Open, FileAccess.Read)) { HSSFWorkbook workbook = new HSSFWorkbook(stream); MessageBox.Show(workbook.GetSheetName(0)); }
2.写入Excel
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.CreateSheet(); HSSFRow row = sheet.CreateRow(0); row.CreateCell(0, HSSFCell.CELL_TYPE_STRING).SetCellValue("Hello"); row.CreateCell(1, HSSFCell.CELL_TYPE_NUMERIC).SetCellValue(3.14); using (FileStream stream = new FileStream(@"c:\1.xls", FileMode.OpenOrCreate, FileAccess.ReadWrite)) { workbook.Write(stream); }
标签:style blog http ar color os 使用 sp on
原文地址:http://www.cnblogs.com/gldblogs/p/4143166.html