NPOI 打印設置blog
//橫向打印 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);