当前位置: 首页>>代码示例>>Java>>正文


Java HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE属性代码示例

本文整理汇总了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;
	}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:62,代码来源:JRXlsMetadataExporter.java


注:本文中的org.apache.poi.hssf.usermodel.HSSFPrintSetup.ENVELOPE_DL_PAPERSIZE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。