1, NPOI2.2.1版本,设值打印区域,打印标题,设值筛选。
string tpath = "d:\\BM.xls");
FileStream filewrite = new FileStream(tpath, FileMode.Open, FileAccess. Write);
HSSFWorkbook book2 = new HSSFWorkbook(filewrite);
HSSFSheet CPS ;
//设置打印标题
CPS.RepeatingRows = new CellRangeAddress(0, 8, 0, 8);
// (int first row,int last row,int first col,int last col)
//设置Excel的自动筛选
CellRangeAddress c = CellRangeAddress.ValueOf("A9:K9");
CPS.SetAutoFilter(c);
//设置打印区域
book2.SetPrintArea(sheetnum, int first row,int last row,int first col,int last col);
book2.Write(fileSave2);
filewrite.Close();
原文地址:https://www.cnblogs.com/fangen/p/10253760.html
时间: 2024-11-13 10:01:55