Npoi Export Excel print settings pagination and print titles

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.