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


Java PrintSetup类代码示例

本文整理汇总了Java中org.apache.poi.ss.usermodel.PrintSetup的典型用法代码示例。如果您正苦于以下问题:Java PrintSetup类的具体用法?Java PrintSetup怎么用?Java PrintSetup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PrintSetup类属于org.apache.poi.ss.usermodel包,在下文中一共展示了PrintSetup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSheets

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
/**
 * シートのコピーを作成します。
 * @param sheets コピーを作成するシートの数。
 * @throws Exception 例外。
 */
protected void addSheets(final int sheets) throws Exception {
	this.workbook = this.getTamplate();
	for (int i = 0; i < sheets; i++) {
		log.debug("wb = " + i);
		this.workbook.cloneSheet(1);
	}
	PrintSetup printSetting = this.workbook.getSheetAt(1).getPrintSetup();
	for (int i = 2; i < this.workbook.getNumberOfSheets(); i++) {
		this.workbook.getSheetAt(i).getPrintSetup().setLandscape(printSetting.getLandscape());
		this.workbook.getSheetAt(i).getPrintSetup().setPaperSize(printSetting.getPaperSize());
	}
	for (int i = 0; i < this.workbook.getNumberOfSheets(); i++) {
		this.workbook.getSheetAt(i).getFooter().setRight("dataforms.jar " + Page.getDataformsVersion());
	}
}
 
开发者ID:takayanagi2087,项目名称:dataforms,代码行数:21,代码来源:ExcelReport.java

示例2: getPrintSetupString

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
/**
 * 印刷設定の文字列表現を取得する。
 * 
 * @param printSetup 印刷設定
 * @return 印刷設定の文字列表現
 */
public static String getPrintSetupString( PrintSetup printSetup) {
    StringBuffer sb = new StringBuffer();
    if ( printSetup != null) {
        sb.append( "PaperSize=").append( printSetup.getPaperSize()).append( ",");
        sb.append( "Scale=").append( printSetup.getScale()).append( ",");
        sb.append( "PageStart=").append( printSetup.getPageStart()).append( ",");
        sb.append( "FitWidth=").append( printSetup.getFitWidth()).append( ",");
        sb.append( "FitHeight=").append( printSetup.getFitHeight()).append( ",");
        sb.append( "LeftToRight=").append( printSetup.getLeftToRight()).append( ",");
        sb.append( "Landscape=").append( printSetup.getLandscape()).append( ",");
        sb.append( "ValidSettings=").append( printSetup.getValidSettings()).append( ",");
        sb.append( "NoColor=").append( printSetup.getNoColor()).append( ",");
        sb.append( "Draft=").append( printSetup.getDraft()).append( ",");
        sb.append( "Notes=").append( printSetup.getNotes()).append( ",");
        sb.append( "NoOrientation=").append( printSetup.getNoOrientation()).append( ",");
        sb.append( "UsePage=").append( printSetup.getUsePage()).append( ",");
        sb.append( "HResolution=").append( printSetup.getHResolution()).append( ",");
        sb.append( "VResolution=").append( printSetup.getVResolution()).append( ",");
        sb.append( "HeaderMargin=").append( printSetup.getHeaderMargin()).append( ",");
        sb.append( "FooterMargin=").append( printSetup.getFooterMargin()).append( ",");
        sb.append( "Copies=").append( printSetup.getCopies());
    }
    return sb.toString();

}
 
开发者ID:excella-core,项目名称:excella-pdfexporter,代码行数:32,代码来源:ReportsTestUtil.java

示例3: setPaperSize

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
private void setPaperSize() {
	String pageFormat = bean.getReportLayout().getPageFormat();		
	short size = 0;		
	if (ReportLayout.LETTER.equals(pageFormat)) {			
		size = PrintSetup.LETTER_PAPERSIZE;
	} else if (ReportLayout.A3.equals(pageFormat)) {			
		size = PrintSetup.A3_PAPERSIZE;
	} else if (ReportLayout.A4.equals(pageFormat)) {			
		size = PrintSetup.A4_PAPERSIZE;
	} else if (ReportLayout.LEGAL.equals(pageFormat)) {			
		size = PrintSetup.LEGAL_PAPERSIZE;
	} else if (ReportLayout.LEDGER.equals(pageFormat)) {			
		size = PrintSetup.LEDGER_PAPERSIZE;
	} else if (ReportLayout.TABLOID.equals(pageFormat)) {			
		size = PrintSetup.TABLOID_PAPERSIZE;
	}
	if (size != 0) {
		xlsSheet.getPrintSetup().setPaperSize(size);
	}
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:21,代码来源:XlsxExporter.java

示例4: createSheet

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
private HSSFSheet createSheet ( final List<Event> events, final HSSFWorkbook workbook, final List<Field> columns )
{
    final HSSFSheet sheet = workbook.createSheet ( Messages.ExportImpl_ExcelSheet_Name );

    final HSSFHeader header = sheet.getHeader ();
    header.setLeft ( Messages.ExportImpl_ExcelSheet_Header );
    header.setRight ( HeaderFooter.date () + " " + HeaderFooter.time () );//$NON-NLS-1$

    final HSSFFooter footer = sheet.getFooter ();
    footer.setLeft ( String.format ( Messages.ExportImpl_ExcelSheet_Footer_1, events.size () ) );

    footer.setRight ( Messages.ExportImpl_ExcelSheet_Footer_2 + HeaderFooter.page () + Messages.ExportImpl_ExcelSheet_Footer_3 + HeaderFooter.numPages () );

    makeHeader ( columns, sheet );

    final HSSFPrintSetup printSetup = sheet.getPrintSetup ();
    printSetup.setLandscape ( true );
    printSetup.setFitWidth ( (short)1 );
    printSetup.setFitHeight ( (short)0 );
    printSetup.setPaperSize ( PrintSetup.A4_PAPERSIZE );

    sheet.setAutoFilter ( new CellRangeAddress ( 0, 0, 0, columns.size () - 1 ) );
    sheet.createFreezePane ( 0, 1 );
    sheet.setFitToPage ( true );
    sheet.setAutobreaks ( true );

    printSetup.setFooterMargin ( 0.25 );

    sheet.setMargin ( Sheet.LeftMargin, 0.25 );
    sheet.setMargin ( Sheet.RightMargin, 0.25 );
    sheet.setMargin ( Sheet.TopMargin, 0.25 );
    sheet.setMargin ( Sheet.BottomMargin, 0.5 );

    return sheet;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:36,代码来源:ExportEventsImpl.java

示例5: initializeSheet

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
private static CellStyle initializeSheet(Workbook wb, Sheet sheet) {
    PrintSetup printSetup = sheet.getPrintSetup();
    printSetup.setLandscape(true);
    sheet.setFitToPage(true);
    sheet.setHorizontallyCenter(true);

    CellStyle styleTitle;
    Font titleFont = wb.createFont();
    titleFont.setFontHeightInPoints((short) 12);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setFontName("Arial");
    styleTitle = wb.createCellStyle();
    styleTitle.setFont(titleFont);
    return styleTitle;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:16,代码来源:ExcelHandler.java

示例6: configurePrintSetup

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
protected void configurePrintSetup(Sheet sheet) {
	PrintSetup printSetup = sheet.getPrintSetup();
	printSetup.setLandscape(true);
	sheet.setFitToPage(true);
	sheet.setHorizontallyCenter(true);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:7,代码来源:XLTest.java

示例7: initialSheetSetup

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
/**
 * Initial sheet setup. Override this method to specifically change initial,
 * sheet-wide, settings.
 */
protected void initialSheetSetup() {
    final PrintSetup printSetup = sheet.getPrintSetup();
    printSetup.setLandscape(true);
    sheet.setFitToPage(true);
    sheet.setHorizontallyCenter(true);
    if ((isHierarchical()) && (displayTotals)) {
        hierarchicalTotalsSheet = workbook.createSheet("tempHts");
    }
}
 
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:14,代码来源:ExcelExport.java

示例8: createNewSheet

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
protected Sheet createNewSheet(List<? extends IExportColumn<?>> columnList) {
	Sheet s = createSheet();
	s.getPrintSetup().setPaperSize(PrintSetup.A4_PAPERSIZE);
	s.getPrintSetup().setLandscape(true);
	renderHeader(columnList, s);
	return s;
}
 
开发者ID:fjalvingh,项目名称:domui,代码行数:8,代码来源:ExcelExportWriter.java

示例9: initPageSetup

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
protected void initPageSetup(Sheet sheet) {
	// print and page setup
	sheet.setPrintGridlines(true);
	sheet.setDisplayGridlines(true);
	sheet.setAutobreaks(true);
	sheet.setHorizontallyCenter(true);
	// set content size when printing
	PrintSetup printSetup = sheet.getPrintSetup();
	sheet.setFitToPage(true);
	printSetup.setFitHeight(Short.MAX_VALUE);
	printSetup.setFitWidth((short) 1);
}
 
开发者ID:ntenhoeve,项目名称:Introspect-Framework,代码行数:13,代码来源:ExcelWriter.java

示例10: copyPrintSetup

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
/**
 * fromIdxのシートからtoIdxシートへの印刷設定のコピーを行う
 * @param workbook fromIdx、toIdxのシートを含むworkbook
 * @param fromIdx コピー元シートのインデックス
 * @param sheet コピー先シート
 */
public static void copyPrintSetup( Workbook workbook, int fromIdx, Sheet toSheet) {
    Sheet fromSheet = workbook.getSheetAt( fromIdx);
    // 印刷設定
    PrintSetup fromPrintSetup = fromSheet.getPrintSetup();
    PrintSetup printSetup = toSheet.getPrintSetup();
    printSetup.setCopies( fromPrintSetup.getCopies());
    printSetup.setDraft( fromPrintSetup.getDraft());
    printSetup.setFitHeight( fromPrintSetup.getFitHeight());
    printSetup.setFitWidth( fromPrintSetup.getFitWidth());
    printSetup.setFooterMargin( fromPrintSetup.getFooterMargin());
    printSetup.setHeaderMargin( fromPrintSetup.getHeaderMargin());
    printSetup.setHResolution( fromPrintSetup.getHResolution());
    printSetup.setLandscape( fromPrintSetup.getLandscape());
    printSetup.setLeftToRight( fromPrintSetup.getLeftToRight());
    printSetup.setNoColor( fromPrintSetup.getNoColor());
    printSetup.setNoOrientation( fromPrintSetup.getNoOrientation());
    printSetup.setPageStart( fromPrintSetup.getPageStart());
    printSetup.setPaperSize( fromPrintSetup.getPaperSize());
    printSetup.setScale( fromPrintSetup.getScale());
    printSetup.setUsePage( fromPrintSetup.getUsePage());
    printSetup.setValidSettings( fromPrintSetup.getValidSettings());
    printSetup.setVResolution( fromPrintSetup.getVResolution());
    // 印刷範囲
    String printArea = workbook.getPrintArea( fromIdx);
    if ( printArea != null) {
        if ( printArea.contains( "!")) {
            printArea = printArea.substring( printArea.indexOf( "!") + 1);
        }
        int toIdx = workbook.getSheetIndex( toSheet);
        workbook.setPrintArea( toIdx, printArea);
    }
    // タイトル行、タイトル列
    toSheet.setRepeatingColumns( fromSheet.getRepeatingColumns());
    toSheet.setRepeatingRows( fromSheet.getRepeatingRows());
}
 
开发者ID:excella-core,项目名称:excella-reports,代码行数:42,代码来源:ReportsUtil.java

示例11: getPaperSizeFromString

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
/**
 * Convert a BIRT paper size string into a POI PrintSetup.*PAPERSIZE constant.
 * @param name
 * The paper size as a BIRT string.
 * @return
 * A POI PrintSetup.*PAPERSIZE constant.
 */
public short getPaperSizeFromString( String name ) {
	if( "a4".equals(name) ) {
		return PrintSetup.A4_PAPERSIZE;
	} else if( "a3".equals(name)) {
		return PrintSetup.A3_PAPERSIZE;
	} else if( "us-letter".equals(name)) {
		return PrintSetup.LETTER_PAPERSIZE;
	}
	
	return PrintSetup.A4_PAPERSIZE;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:19,代码来源:StyleManagerUtils.java

示例12: setupPageSize

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
private void setupPageSize(HandlerState state, IPageContent page) {
	PrintSetup printSetup = state.currentSheet.getPrintSetup();
	printSetup.setPaperSize(state.getSmu().getPaperSizeFromString(page.getPageType()));
	if( page.getOrientation() != null ) {
		if( "landscape".equals(page.getOrientation())) {
			printSetup.setLandscape(true);
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:10,代码来源:PageHandler.java

示例13: copyPrintSetup

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
/**
 * 复制模板工作表的打印区域到数据工作表中
 * 
 * @author      ZhengWei(HY)
 * @createDate  2017-03-17
 * @version     v1.0
 * 
 * @param i_FromSheet  源工作表
 * @param i_ToSheet    目标工作表
 */
public final static void copyPrintSetup(Sheet i_FromSheet ,Sheet i_ToSheet) 
{
    PrintSetup v_FromPrintSetup = i_FromSheet.getPrintSetup();
    PrintSetup v_ToPrintSetup   = i_ToSheet  .getPrintSetup();
    
    v_ToPrintSetup.setCopies(       v_FromPrintSetup.getCopies());
    v_ToPrintSetup.setDraft(        v_FromPrintSetup.getDraft());          // 值为true时,表示用草稿品质打印
    v_ToPrintSetup.setFitHeight(    v_FromPrintSetup.getFitHeight());      // 设置页高
    v_ToPrintSetup.setFitWidth(     v_FromPrintSetup.getFitWidth());       // 设置页宽
    v_ToPrintSetup.setFooterMargin( v_FromPrintSetup.getFooterMargin());
    v_ToPrintSetup.setHeaderMargin( v_FromPrintSetup.getHeaderMargin());
    v_ToPrintSetup.setHResolution(  v_FromPrintSetup.getHResolution());
    v_ToPrintSetup.setLandscape(    v_FromPrintSetup.getLandscape());      // true,则表示页面方向为横向;否则为纵向
    v_ToPrintSetup.setLeftToRight(  v_FromPrintSetup.getLeftToRight());    // true表示“先行后列”;false表示“先列后行”
    v_ToPrintSetup.setNoColor(      v_FromPrintSetup.getNoColor());        // 值为true时,表示单色打印
    v_ToPrintSetup.setNoOrientation(v_FromPrintSetup.getNoOrientation()); 
    v_ToPrintSetup.setNotes(        v_FromPrintSetup.getNotes());          // 设置打印批注
    v_ToPrintSetup.setPageStart(    v_FromPrintSetup.getPageStart());      // 设置打印起始页码
    v_ToPrintSetup.setPaperSize(    v_FromPrintSetup.getPaperSize());      // 纸张类型 A4纸 HSSFPrintSetup.A4_PAPERSIZE
    v_ToPrintSetup.setScale(        v_FromPrintSetup.getScale());          // 缩放比例80%(设置为0-100之间的值)
    v_ToPrintSetup.setUsePage(      v_FromPrintSetup.getUsePage());        // 设置打印起始页码是否使用"自动"
    v_ToPrintSetup.setValidSettings(v_FromPrintSetup.getValidSettings());
    v_ToPrintSetup.setVResolution(  v_FromPrintSetup.getVResolution());
    
    // 设置打印参数
    if ( i_ToSheet instanceof HSSFSheet )
    {
        ((HSSFPrintSetup)v_ToPrintSetup).setOptions(((HSSFPrintSetup)v_FromPrintSetup).getOptions());
        
        i_ToSheet.setMargin(HSSFSheet.TopMargin     ,i_FromSheet.getMargin(HSSFSheet.TopMargin));     // 页边距(上)
        i_ToSheet.setMargin(HSSFSheet.BottomMargin  ,i_FromSheet.getMargin(HSSFSheet.BottomMargin));  // 页边距(下)
        i_ToSheet.setMargin(HSSFSheet.LeftMargin    ,i_FromSheet.getMargin(HSSFSheet.LeftMargin));    // 页边距(左)
        i_ToSheet.setMargin(HSSFSheet.RightMargin   ,i_FromSheet.getMargin(HSSFSheet.RightMargin));   // 页边距(右)
        i_ToSheet.setMargin(HSSFSheet.HeaderMargin  ,i_FromSheet.getMargin(HSSFSheet.HeaderMargin));  // 页眉
        i_ToSheet.setMargin(HSSFSheet.FooterMargin  ,i_FromSheet.getMargin(HSSFSheet.FooterMargin));  // 页脚
    }
    else if ( i_ToSheet instanceof SXSSFSheet )
    {
        ((XSSFPrintSetup)v_ToPrintSetup).setOrientation(((XSSFPrintSetup)v_FromPrintSetup).getOrientation());  // 设置方向 
        
        i_ToSheet.setMargin(SXSSFSheet.TopMargin    ,i_FromSheet.getMargin(SXSSFSheet.TopMargin));     // 页边距(上)
        i_ToSheet.setMargin(SXSSFSheet.BottomMargin ,i_FromSheet.getMargin(SXSSFSheet.BottomMargin));  // 页边距(下)
        i_ToSheet.setMargin(SXSSFSheet.LeftMargin   ,i_FromSheet.getMargin(SXSSFSheet.LeftMargin));    // 页边距(左)
        i_ToSheet.setMargin(SXSSFSheet.RightMargin  ,i_FromSheet.getMargin(SXSSFSheet.RightMargin));   // 页边距(右)
        i_ToSheet.setMargin(SXSSFSheet.HeaderMargin ,i_FromSheet.getMargin(SXSSFSheet.HeaderMargin));  // 页眉
        i_ToSheet.setMargin(SXSSFSheet.FooterMargin ,i_FromSheet.getMargin(SXSSFSheet.FooterMargin));  // 页脚
    }
    else if ( i_ToSheet instanceof XSSFSheet )
    {
        ((XSSFPrintSetup)v_ToPrintSetup).setOrientation(((XSSFPrintSetup)v_FromPrintSetup).getOrientation());  // 设置方向 
        
        i_ToSheet.setMargin(XSSFSheet.TopMargin     ,i_FromSheet.getMargin(XSSFSheet.TopMargin));     // 页边距(上)
        i_ToSheet.setMargin(XSSFSheet.BottomMargin  ,i_FromSheet.getMargin(XSSFSheet.BottomMargin));  // 页边距(下)
        i_ToSheet.setMargin(XSSFSheet.LeftMargin    ,i_FromSheet.getMargin(XSSFSheet.LeftMargin));    // 页边距(左)
        i_ToSheet.setMargin(XSSFSheet.RightMargin   ,i_FromSheet.getMargin(XSSFSheet.RightMargin));   // 页边距(右)
        i_ToSheet.setMargin(XSSFSheet.HeaderMargin  ,i_FromSheet.getMargin(XSSFSheet.HeaderMargin));  // 页眉
        i_ToSheet.setMargin(XSSFSheet.FooterMargin  ,i_FromSheet.getMargin(XSSFSheet.FooterMargin));  // 页脚
    }
    
    copyHeaderFooter(i_FromSheet.getHeader() ,i_ToSheet.getHeader());
    copyHeaderFooter(i_FromSheet.getFooter() ,i_ToSheet.getFooter());
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.report,代码行数:73,代码来源:ExcelHelp.java

示例14: getPrintSetup

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
public PrintSetup getPrintSetup() {
	return sheet.getPrintSetup();
}
 
开发者ID:eclipse,项目名称:birt,代码行数:4,代码来源:FilteredSheet.java

示例15: getPrintSetup

import org.apache.poi.ss.usermodel.PrintSetup; //导入依赖的package包/类
/**
 * Not supported
 */
@Override
public PrintSetup getPrintSetup() {
  throw new UnsupportedOperationException();
}
 
开发者ID:monitorjbl,项目名称:excel-streaming-reader,代码行数:8,代码来源:StreamingSheet.java


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