日期:2014-05-16 浏览次数:21063 次
SaveFileDialog saveFileDia = new SaveFileDialog();
saveFileDia.Filter="Excel文件|*.xls";
saveFileDia.FileName="浏览明细";
if (saveFileDia.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
//在内存中创建一个空的excel文件对象
HSSFWorkbook wb = new HSSFWorkbook();
//在excel文件对象中添加一个表格数据
// HSSFSheet sheet = wb.CreateSheet();
string strPath = saveFileDia.FileName;
ListView lv = this.lv_detaillist;
HSSFSheet sheet=wb.CreateSheet("MingXi");
HSSFRow row1=sheet.CreateRow(0);
HSSFCell cell1=row1.CreateCell(0,HSSFCell.CELL_TYPE_STRING);
cell1.SetCellValue("病人姓名");
cell1=row1.CreateCell(1,HSSFCell.CELL_TYPE_STRING);
cell1.SetCellValue("病历号");
cell1=row1.CreateCell(2,HSSFCell.CELL_TYPE_STRING);
cell1.SetCellValue("登记时间");
cell1=row1.CreateCell(3,HSSFCell.CELL_TYPE_STRING);
cell1.SetCellValue("执行时间");
cell1=row1.CreateCell(4,HSSFCell.CELL_TYPE_STRING);
cell1.SetCellValue("结束时间");
cell1=row1.CreateCell(5,HSSFCell.CELL_TYPE_STRING);
cell1.SetCellValue("登记护士");
cell1=row1.CreateCell(6,HSSFCell.CELL_TYPE_STRING);