public ExcelPageDefinition( final short pageFormatCode, final PageSize pageSize ) { this( pageFormatCode, (int) pageSize.getWidth(), (int) pageSize.getHeight() ); }
public String getPageFormatName( final double width, final double height ) { try { final Field[] fields = PageSize.class.getFields(); for ( int i = 0; i < fields.length; i++ ) { final Field f = fields[i]; if ( Modifier.isPublic( f.getModifiers() ) && Modifier.isStatic( f.getModifiers() ) ) { final Object o = f.get( PageFormatFactory.getInstance() ); if ( o instanceof PageSize ) { final PageSize pageDef = (PageSize) o; if ( pageDef.getWidth() == width && pageDef.getHeight() == height ) { return f.getName(); } } } } } catch ( Exception e ) { PageFormatFactory.logger.warn( "Unable to lookup the page name", e ); } return null; }
/** * Creates a paper by using the paper size in points found in the int-array. The array must have a length of 2 and the * first value of this array has to contain the width and the second the height parameter. The created Paper has no * ImagableArea defined. * * @param papersize * the definition of the papersize in a 2-element int-array * @return the created paper */ public Paper createPaper( final PageSize papersize ) { return createPaper( papersize.getWidth(), papersize.getHeight() ); }