MemoryStream ms = new MemoryStream();
XSSFWorkbook workbook = new XSSFWorkbook();//创建Workbook对象
for (int i = 0; i < li.Count; i++)
{
ISheet sheet = workbook.CreateSheet("sheet"+i);//创建工作表
DataTable syscomment = ec.getDtFromSYSCOMMENT("FD", "PURI09", systemInfo.Locale);
DataTable tak003 = ec.getDtFromSYSCOMMENT("FD", "PUR-TAK003", systemInfo.Locale);
DataRow[] dr = dt.Select("TAL002='" + li[i] + "'", "TAL005,TAL007,TAL004");
ICellStyle style = workbook.CreateCellStyle();
style.Alignment = HorizontalAlignment.Center;
style.WrapText = true;
IFont font = workbook.CreateFont();
font.FontHeightInPoints = 16;
font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
font.FontName = "標楷體";
style.SetFont(font);//HEAD 样式
IRow row = sheet.CreateRow(0);
row.Height = 200 * 5;
row.CreateCell(0).SetCellValue(getString(syscomment, "Company") + "\n" + getString(syscomment, "Report"));
//设置Head的样式
row.GetCell(0).CellStyle = style;
MagreRange(sheet, 0, 0, 0, 13);//合并单元格
//正式数据
ICellStyle styleCommonLeft= workbook.CreateCellStyle();
styleCommonLeft.Alignment = HorizontalAlignment.Left;
styleCommonLeft.WrapText = true;
IFont fontLeft = workbook.CreateFont();
fontLeft.FontHeightInPoints = 10;
fontLeft.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
fontLeft.FontName = "標楷體";
styleCommonLeft.SetFont(fontLeft);
ICellStyle styleCommonRight = workbook.CreateCellStyle();
styleCommonRight.Alignment = HorizontalAlignment.Left;
styleCommonRight.VerticalAlignment = VerticalAlignment.Center;
styleCommonRight.WrapText = true;
IFont fontRight = workbook.CreateFont();
fontRight.FontHeightInPoints = 10;
fontRight.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold;
fontRight.FontName = "標楷體";
styleCommonRight.SetFont(fontRight);
ICellStyle styleBorder = workbook.CreateCellStyle();