npoi 打印区域设置
NPOI打印区域设置
// 设置打印区域
workbook.SetPrintArea(sheetIndex, 0, 12, 0, solution.routes.Count + 3);
// 设置固定列头
sheet.RepeatingRows = new CellRangeAddress(0, 3, 0, 12);
// 设置横向打印 纵向为false
sheet.PrintSetup.Landscape = true;
// 设置页高为自动
sheet.PrintSetup.FitHeight = -1;
// 设置页宽为自动
sheet.PrintSetup.FitWidth = -1;
// 设置缩放比例
sheet.PrintSetup.Scale = 75;
// 设置纸张尺寸 A4 = 9
sheet.PrintSetup.PaperSize = 9;
// 设置不自适应
sheet.FitToPage = false;
// 设置打印边距
sheet.SetMargin(MarginType.RightMargin, (double)0.5);
sheet.SetMargin(MarginType.TopMargin, (double)0.6);
sheet.SetMargin(MarginType.LeftMargin, (double)0.4);
sheet.SetMargin(MarginType.BottomMargin, (double)0.3);
workbook.SetPrintArea(sheetIndex, 0, 12, 0, solution.routes.Count + 3);
就是这种蓝边旷课 记住模板要设 分页预览
分页就是缩放比例
https://www.cnblogs.com/wolfplan/archive/2013/01/13/2858991.html