本文整理汇总了Java中org.apache.poi.hssf.usermodel.HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE属性的典型用法代码示例。如果您正苦于以下问题:Java HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE属性的具体用法?Java HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE怎么用?Java HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.poi.hssf.usermodel.HSSFPrintSetup
的用法示例。
在下文中一共展示了HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSuitablePaperSize
private final short getSuitablePaperSize() {
if (pageFormat == null) {
return -1;
}
long width = 0;
long height = 0;
short ps = -1;
if ((pageFormat.getPageWidth() != 0) && (pageFormat.getPageHeight() != 0)) {
double dWidth = (pageFormat.getPageWidth() / 72.0);
double dHeight = (pageFormat.getPageHeight() / 72.0);
height = Math.round(dHeight * 25.4);
width = Math.round(dWidth * 25.4);
// Compare to ISO 216 A-Series (A3-A5). All other ISO 216 formats
// not supported by POI Api yet.
// A3 papersize also not supported by POI Api yet.
for (int i = 4; i < 6; i++) {
int w = calculateWidthForDinAN(i);
int h = calculateHeightForDinAN(i);
if (((w == width) && (h == height)) || ((h == width) && (w == height))) {
if (i == 4) {
ps = HSSFPrintSetup.A4_PAPERSIZE;
} else if (i == 5) {
ps = HSSFPrintSetup.A5_PAPERSIZE;
}
break;
}
}
//envelope sizes
if (ps == -1) {
// ISO 269 sizes - "Envelope DL" (110 x 220 mm)
if (((width == 110) && (height == 220)) || ((width == 220) && (height == 110))) {
ps = HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE;
}
}
// Compare to common North American Paper Sizes (ANSI X3.151-1987).
if (ps == -1) {
// ANSI X3.151-1987 - "Letter" (216 x 279 mm)
if (((width == 216) && (height == 279)) || ((width == 279) && (height == 216))) {
ps = HSSFPrintSetup.LETTER_PAPERSIZE;
}
// ANSI X3.151-1987 - "Legal" (216 x 356 mm)
if (((width == 216) && (height == 356)) || ((width == 356) && (height == 216))) {
ps = HSSFPrintSetup.LEGAL_PAPERSIZE;
}
// ANSI X3.151-1987 - "Executive" (190 x 254 mm)
else if (((width == 190) && (height == 254)) || ((width == 254) && (height == 190))) {
ps = HSSFPrintSetup.EXECUTIVE_PAPERSIZE;
}
// ANSI X3.151-1987 - "Ledger/Tabloid" (279 x 432 mm)
// Not supported by POI Api yet.
}
}
return ps;
}