NPOI版本:V1.2.4.0
IFont font = WB.CreateFont();
ICellStyle style1 = Sheet.GetRow(0).GetCell(0).CellStyle;
font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.BOLD;
style1.SetFont(font);
本来是想对A1这个单元格加粗,结果执行了之后,所有单元格都加粗了,为什么呢?
同时,就算我只想把某个单元格加边框:style1 = Sheet.GetRow(0).GetCell(0).CellStyle;
style1.BorderBottom = CellBorderType.THIN;
style1.BorderLeft = CellBorderType.THIN;
style1.BorderRight = CellBorderType.THIN;
style1.BorderTop = CellBorderType.THIN;
结果也是整个工作表都加边框了。
IFont font = WB.CreateFont();
ICellStyle style1 = Sheet.GetRow(0).GetCell(0).CellStyle;
font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.BOLD;
style1.SetFont(font);
本来是想对A1这个单元格加粗,结果执行了之后,所有单元格都加粗了,为什么呢?
同时,就算我只想把某个单元格加边框:style1 = Sheet.GetRow(0).GetCell(0).CellStyle;
style1.BorderBottom = CellBorderType.THIN;
style1.BorderLeft = CellBorderType.THIN;
style1.BorderRight = CellBorderType.THIN;
style1.BorderTop = CellBorderType.THIN;
结果也是整个工作表都加边框了。
解决方案 »
- C#中控件的调用问题
- 写一个获取字符串中<table></table>中标记的内容的方法
- 关于datatable.select用法的问题
- ASP.NET 反射dll文件!
- Md5加密算法及调用VB的inputbox
- vista下如何注册fastreport3.dll
- 烦死,怎么读一个二进制文件,再把内容写到新文件中
- C#windows窗体包含flash怎样屏蔽flash中的右键菜单
- 我用C#怎么把中文信息写到数据库里都成问号了
- 有关水晶报表中table的ApplyLogOnInfo方法的一个简单问题
- 我想问一下,在C#里面因为是自己做的皮肤,所以导致了一个问题。
- 此表达式将出现副作用,将不进行计算
HSSFSheet sheet = hssfworkbook.CreateSheet("new sheet");
// Create a row and put some cells in it. Rows are 0 based.
HSSFRow row = sheet.CreateRow(1);
// Create a cell and put a value in it.
HSSFCell cell = row.CreateCell(1);
// Style the cell with borders all around.
HSSFCellStyle style = hssfworkbook.CreateCellStyle();
style.BorderBottom= HSSFCellStyle.BORDER_THIN;
style.BorderLeft= HSSFCellStyle.BORDER_THIN;
style.BorderRight= HSSFCellStyle.BORDER_THIN;
style.BorderTop = HSSFCellStyle.BORDER_THIN ;
cell.CellStyle= style;