When you export Excel with Npoi, you set up pagination, and you find it on the Internet with Sheet1. Setrowbreak (i) method, but has not played a role. The study is to set the Sheet1. FitToPage = false; This property, by default, is true, no wonder the settings are not working.
Set the print title with
Hssfworkbook. Setrepeatingrowsandcolumns (0, 0, 5, 0, 5);
But the latest version already has a new approach.
Sheet. Repeatingrows=new cellrangeaddress (0,5,0,5)
Sheet Sheet1 = Hssfworkbook. Createsheet ("Sheet1");
Sheet1. SetMargin (Margintype.rightmargin, (double) 0.5);
Sheet1. SetMargin (Margintype.topmargin, (double) 0.6);
Sheet1. SetMargin (Margintype.leftmargin, (double) 0.4);
Sheet1. SetMargin (Margintype.bottommargin, (double) 0.3);
Sheet1. Printsetup.copies = 3; Sheet1. Printsetup.nocolor = true;
Sheet1. Printsetup.landscape = true;
Sheet1. Printsetup.papersize = (short) papersize.a4;
Sheet1. Printsetup.fitheight = 2;
Sheet1. Printsetup.fitwidth = 3;
Sheet1. Isprintgridlines = true;
Whether the adaptive interface Sheet1. FitToPage = false;
Sets the print title Hssfworkbook. Setrepeatingrowsandcolumns (0, 0, 5, 0, 5);
Original link: https://www.cnblogs.com/Gyoung/p/4483475.html
---------------------
Longtenggenssupreme
Source: CSDN
Original: 83271183
Copyright NOTICE: This article is for bloggers original article, reprint please attach blog link!
Npoi Export Excel print settings pagination and print titles