行高:row.Height = 30 * 20; //行高为30
列宽:sheet.SetColumnWidth(3, 13 * 256) //第4列的列宽为13
单元格合并后,样式以左上角的单元格为准
//CellRangeAddress四个参数为:起始行,结束行,起始列,结束列
sheet.AddMergedRegion(new CellRangeAddress(0, 0, 0, 10));
style.Alignment = HorizontalAlignment.CENTER;
不需要写“=”号
cell.CellFormula = "公式";
//上下左右
styleFont.BorderTop = NPOI.SS.UserModel.BorderStyle.THIN; styleFont.BorderBottom = NPOI.SS.UserModel.BorderStyle.THIN; styleFont.BorderLeft = NPOI.SS.UserModel.BorderStyle.THIN; styleFont.BorderRight = NPOI.SS.UserModel.BorderStyle.THICK;
颜色对照表:
颜色测试Class名称short Test颜色Black8 Test颜色Brown60 Test颜色Olive_Green59 Test颜色Dark_Green58 Test颜色Dark_Teal56 Test颜色Dark_Blue18 Test颜色Indigo62 Test颜色Grey_80_PERCENT63 Test颜色Dark_Red16 Test颜色Orange53 Test颜色DARK_YELLOW19 Test颜色Green17 Test颜色Teal21 Test颜色Blue12 Test颜色Blue_Grey54 Test颜色Grey_50_PERCENT23 Test颜色Red10 Test颜色LIGHT_ORANGE52 Test颜色LIME50 Test颜色SEA_GREEN57 Test颜色AQUA49 Test颜色LIGHT_BLUE48 Test颜色VIOLET20 Test颜色GREY_40_PERCENT55 Test颜色Pink14 Test颜色Gold51 Test颜色Yellow13 Test颜色BRIGHT_GREEN11 Test颜色TURQUOISE15 Test颜色SKY_BLUE40 Test颜色Plum61 Test颜色GREY_25_PERCENT22 Test颜色Rose45 Test颜色Tan47 Test颜色LIGHT_YELLOW43 Test颜色LIGHT_GREEN42 Test颜色LIGHT_TURQUOISE41 Test颜色PALE_BLUE44 Test颜色LAVENDER46 Test颜色White9 Test颜色CORNFLOWER_BLUE24 Test颜色LEMON_CHIFFON26 Test颜色MAROON25 Test颜色ORCHID28 Test颜色CORAL29 Test颜色ROYAL_BLUE30 Test颜色LIGHT_CORNFLOWER_BLUE31 Test颜色AUTOMATIC64转载于:https://www.cnblogs.com/nxxshxf/p/6410797.html
相关资源:数据结构—成绩单生成器