NPOI 打印设置
//横向打印
sheet.PrintSetup.Landscape = true;
//纸张大小
sheet.PrintSetup.PaperSize = (int)PaperSize.A4_Small;
//缩放比:100% 不缩放
sheet.PrintSetup.Scale = 100;
//不缩放到一页
sheet.FitToPage = false;
//居中对齐
sheet.HorizontallyCenter = true;
sheet.VerticallyCenter = true;
//设置打印边距,数值为打印设置里的边距设置(厘米)/3
sheet.SetMargin(MarginType.RightMargin, (double)1.6/3);
sheet.SetMargin(MarginType.TopMargin, (double)0.8/3);
sheet.SetMargin(MarginType.LeftMargin, (double)1.6 / 3);
sheet.SetMargin(MarginType.BottomMargin, (double)0.8 / 3);
//设置打印区域
workbook.SetPrintArea(1, 0, 5, 0, rowIndex - 1);
//设置重复出现的行(表头)
//sheet.RepeatingRows = new NPOI.SS.Util.CellRangeAddress(0, 1, 0, 5);
转载:http://t.zoukankan.com/shya-p-11843000.html