Npoi Print Settings

Source: Internet
Author: User

The print settings mainly include orientation settings, scaling, paper settings, margins, and so on. Npoi 1.2 supports most print properties, allowing you to easily meet your customers ' printing needs.

Direction setting
The first is the orientation setting, and Excel supports two page orientations, portrait and landscape.
How do I set it up in Npoi? You can set it by HSSFSheet.PrintSetup.Landscape, landscape is a Boolean type and is horizontal in English. If landscape equals true, the page orientation is horizontal; otherwise portrait.

Zoom settings
The zoom ratio here corresponds to HSSFSheet.PrintSetup.Scale, and the page width and page height correspond to HSSFSheet.PrintSetup.FitWidth and HSSFSheet.PrintSetup.FitHeight respectively. Note that the printsetup.scale here should be set to a value between 0-100 and not a decimal.

Paper Setup
Next is the paper set up, corresponding to the HSSFSheet.PrintSetup.PaperSize, but here the PaperSize is not casually set, but by a number of fixed values, the specific values and the corresponding paper as shown in the following table:

Value paper
1US Letter 8 X one in
2US Letter Small 8 x one in
3US Tabloid x in
4US Ledger x in
5US Legal 8 x in
6US Statement 5 x 8 in
7US Executive 7 x Ten in
8A3 297 x 420 mm
9A4 x 297 mm
10A4 Small x 297 mm
11A5 148 x mm
12B4 (JIS) x 354
13B5 (JIS) 182 x 257 mm
14Folio 8 x in
15Quarto 215 x 275 mm
1610 x in
1711 X in
18US Note 8 x in
19US Envelope #9 3 7/8 x 8 7/8
20US Envelope #10 4 1/8 x 9 1/2
21US Envelope #11 4 x 10 3/8
22US Envelope #12 4 \276 x 11
23US Envelope #14 5 x 11 1/2
24C size Sheet
25D size Sheet
26E size Sheet
27Envelope DL x 220mm
28Envelope C5 162 x 229 mm
29Envelope C3 324 x 458 mm
30Envelope C4 229 x 324 mm
31Envelope C6 x 162 mm
32Envelope C65 x 229 mm
33Envelope B4 x 353 mm
34Envelope B5 176 x mm
35Envelope B6 176 x mm
36Envelope x mm
37US Envelope Monarch 3.875 x 7.5 in
386 3/4 US Envelope 3 5/8 x 6 in
39US Std fanfold 7/8 x in
40German STD fanfold 8 x in
41German Legal fanfold 8 x in
42B4 (ISO) x 353 mm
43Japanese Postcard x 148 mm
449 x in
4510 x in
4615 x in
47Envelope Invite x mm
48reserved–do not use
49reserved–do not use
50US Letter Extra 9 \275 x
51US Legal Extra 9 \275 x in
52US Tabloid Extra 11.69 x in
53A4 Extra 9.27 x 12.69 in
54Letter Transverse 8 \275 x in
55A4 Transverse x 297 mm
56Letter Extra transverse 9\275 x in
57SUPERA/SUPERA/A4 227 x 356 mm
58SUPERB/SUPERB/A3 305 x 487 mm
59US Letter Plus 8.5 x 12.69 in
60A4 Plus x mm
61A5 Transverse 148 x mm
62B5 (JIS) transverse 182 x 257 mm
63A3 Extra 322 x 445 mm
64A5 Extra 174 x 235 mm
65B5 (ISO) Extra 201 x 276 mm
66A2 420 x 594 mm
67A3 transverse 297 x 420 mm
68a3 Extra Transverse 322 x 445 mm
69Japanese Double postcard x 148 mm
70A6 x 148 mm
71Japanese Envelope Kaku #2
72Japanese Envelope Kaku #3
73Japanese Envelope Chou #3
74Japanese Envelope Chou #4
75Letter rotated x 8 each in
76A3 rotated 420 x 297 mm
77A4 rotated 297 x mm
78A5 rotated x 148 mm
79B4 (JIS) rotated 364 x 257 mm
80B5 (JIS) rotated 257 x 182 mm
81Japanese postcard rotated 148 x mm
82Double Japanese Postcard rotated 148 x mm
83A6 rotated 148 x mm
84Japanese Envelope Kaku #2 Rotated
85Japanese Envelope Kaku #3 Rotated
86Japanese Envelope Chou #3 Rotated
87Japanese Envelope Chou #4 Rotated
88b6 (JIS) x 182 mm
89b6 (JIS) rotated 182 x mm
9012 x in
91Japanese Envelope You #4
92Japanese Envelope you #4 rotated
93PRC 16K 146 x 215 mm
94PRC 32K x 151 mm
95PRC 32K (Big) x 151 mm
96PRC Envelope #1 102 x 165 mm
97PRC Envelope #2 102 x 176 mm
98PRC Envelope #3 x 176 mm
99PRC Envelope #4 x 208 mm
100PRC Envelope #5 x mm
101PRC Envelope #6 x mm
102PRC Envelope #7 x mm
103PRC Envelope #8 x 309 mm
104PRC Envelope #9 229 x 324 mm
105PRC Envelope #10 324 x 458 mm
106PRC 16K Rotated
107PRC 32K Rotated
108PRC 32K (Big) rotated
109PRC Envelope #1 Rotated 165 x 102 mm
110PRC Envelope #2 Rotated 176 x 102 mm
111PRC Envelope #3 rotated 176 x mm
112PRC Envelope #4 rotated 208 x mm
113PRC Envelope #5 Rotated x mm
114PRC Envelope #6 Rotated x mm
115PRC Envelope #7 Rotated x mm
116PRC Envelope #8 Rotated 309 x mm
117PRC Envelope #9 Rotated 324 x 229 mm
118PRC Envelope #10 Rotated 458 x 324 mm
(This table was excerpted from Excel Binary File Format (. xls) Structure specification.pdf)

Hssfsheet The following defines some xxxx_papersize constants, but all are very common paper size, if you do not meet your needs, you can assign a value to the PaperSize property according to the table above. So, if you want to set the paper size you can use this code:
Hssfsheet.printsetup.papersize=hssfsheet.a4_papersize;
Or
hssfsheet.printsetup.papersize=9; (A4 210*297mm)

Start Page
Again down is the beginning page number of the printing, which corresponds to HSSFSheet.PrintSetup.PageStart and HSSFSheet.PrintSetup.UsePage, if usepage=false, then the equivalent of "automatic", At this point Pagestart does not work, if Usepage=true,pagestart will work. Therefore, you must set the Usepage to true before setting the Pagestart.

Grid lines
The gridlines setting in the print bar corresponds to Hssfsheet.isprintgridlines, please note that this is not hssfsheet.printsetup below, so don't confuse it. The reason why this is not subordinate to Printsetup is determined by the record of the underlying storage of this information, and the bottom layer is to put isgridsprinted in Gridsetrecord, not printsetuprecord inside, although the interface is put together. There is also a hssfsheet.isgridsprinted property, which corresponds to the underlying gridset record, but the record is reserved and the document displayed from Microsoft does not have any meaning, so please do not set this property.

Other
Monochrome printing corresponds to HSSFSheet.PrintSetup.NoColors, which is a Boolean type that represents monochrome printing when the value is true.

"Draft quality" corresponds to HSSFSheet.PrintSetup.IsDraft, which is also a Boolean type, when the value is true, the representation is printed with draft quality.

The print order here is determined by the HSSFSheet.PrintSetup.LeftToRight, which is a Boolean type, and when True, indicates "first column" and, if False, "row by column".

In Npoi 1.2, the row Number column label, annotation, and error cell print as, margins are not supported, and will be supported in a future release.

Original link: http://www.cnblogs.com/wolfplan/archive/2013/01/13/2858991.html

Npoi Print Settings

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.