NOPI设置单元格格式

 

将单元格格式设置为文本

HSSFWorkbook wk = new HSSFWorkbook();
HSSFSheet sheet = (HSSFSheet)wk.CreateSheet("sheet1");
HSSFRow head = (HSSFRow)sheet.CreateRow(0);
IDataFormat dataformat = wk.CreateDataFormat();
ICellStyle style1 = wk.CreateCellStyle();
style1.DataFormat = dataformat.GetFormat("text");

sheet.SetDefaultColumnStyle(0, style1);//列格式

 

 

HSSFRow row = (HSSFRow)sheet.CreateRow(0);

row.CreateCell(0).SetCellValue("0000005");

row.GetCell(0).CellStyle = style1;//单元格格式

posted @ 2022-10-08 09:22  奇迹之耀  阅读(88)  评论(0编辑  收藏  举报