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


Java HSSFPrintSetup.setLandscape方法代码示例

本文整理汇总了Java中org.apache.poi.hssf.usermodel.HSSFPrintSetup.setLandscape方法的典型用法代码示例。如果您正苦于以下问题:Java HSSFPrintSetup.setLandscape方法的具体用法?Java HSSFPrintSetup.setLandscape怎么用?Java HSSFPrintSetup.setLandscape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.hssf.usermodel.HSSFPrintSetup的用法示例。


在下文中一共展示了HSSFPrintSetup.setLandscape方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSheet

import org.apache.poi.hssf.usermodel.HSSFPrintSetup; //导入方法依赖的package包/类
private Sheet createSheet(HSSFWorkbook wb,Paper paper,String name){
	Sheet sheet = null;
	if(name==null){
		sheet=wb.createSheet();
	}else{			
		sheet=wb.createSheet(name);
	}
	PaperType paperType=paper.getPaperType();
	HSSFPrintSetup printSetup=(HSSFPrintSetup)sheet.getPrintSetup();
	Orientation orientation=paper.getOrientation();
	if(orientation.equals(Orientation.landscape)){
		printSetup.setLandscape(true);
	}
	setupPaper(paperType, printSetup);
	int leftMargin=paper.getLeftMargin();
	int rightMargin=paper.getRightMargin();
	int topMargin=paper.getTopMargin();
	int bottomMargin=paper.getBottomMargin();
	sheet.setMargin(Sheet.LeftMargin, UnitUtils.pointToInche(leftMargin));
	sheet.setMargin(Sheet.RightMargin, UnitUtils.pointToInche(rightMargin));
	sheet.setMargin(Sheet.TopMargin, UnitUtils.pointToInche(topMargin));
	sheet.setMargin(Sheet.BottomMargin, UnitUtils.pointToInche(bottomMargin));
	return sheet;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:25,代码来源:Excel97Producer.java

示例2: createSheet

import org.apache.poi.hssf.usermodel.HSSFPrintSetup; //导入方法依赖的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

示例3: formatPage

import org.apache.poi.hssf.usermodel.HSSFPrintSetup; //导入方法依赖的package包/类
protected void formatPage(final HSSFSheet sheet)
{
	sheet.setFitToPage(true);
	// Print Setup
	HSSFPrintSetup ps = sheet.getPrintSetup();
	ps.setFitWidth((short)1);
	ps.setNoColor(true);
	ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
	ps.setLandscape(false);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:11,代码来源:AbstractExcelExporter.java

示例4: setSheetOrientation

import org.apache.poi.hssf.usermodel.HSSFPrintSetup; //导入方法依赖的package包/类
public void setSheetOrientation() {
    HSSFPrintSetup ps = getSheet().getPrintSetup();
    ps.setLandscape(true);
    getSheet().setMargin(HSSFSheet.TopMargin, 0.10);
    getSheet().setMargin(HSSFSheet.BottomMargin, 0.10);
    getSheet().setMargin(HSSFSheet.LeftMargin, 0.10);
    getSheet().setMargin(HSSFSheet.RightMargin, 0.10);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-commons,代码行数:9,代码来源:StyledExcelSpreadsheet.java

示例5: exportMotionExcel

import org.apache.poi.hssf.usermodel.HSSFPrintSetup; //导入方法依赖的package包/类
/**
 * 为退款经办下载表
 * 
 * @param outfile
 * @param list
 * @param name
 *            表名
 * @param s为每一格的宽度
 * @throws IOException
 */
public FileTransfer exportMotionExcel(List<String[]> list, String filename,
		String name, String[] s) throws Exception {

	ByteArrayOutputStream buffer = new ByteArrayOutputStream();
	HSSFWorkbook wb = new HSSFWorkbook();
	HSSFSheet sheet = wb.createSheet();
	HSSFCellStyle cs = wb.createCellStyle();
	// 设置表头的格式
	HSSFCellStyle cs1 = wb.createCellStyle();
	HSSFFont f1 = wb.createFont();
	f1.setFontHeightInPoints((short) 20);// 字体大小
	cs1.setFont(f1);
	cs1.setAlignment(HSSFCellStyle.ALIGN_CENTER);

	// 设置表中的格�?
	cs.setBorderBottom(HSSFCellStyle.BORDER_THIN);
	cs.setBorderLeft(HSSFCellStyle.BORDER_THIN);
	cs.setBorderRight(HSSFCellStyle.BORDER_THIN);
	cs.setBorderTop(HSSFCellStyle.BORDER_THIN);
	cs.setAlignment(HSSFCellStyle.ALIGN_CENTER);
	cs.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
	cs.setWrapText(true);// 自动换行
	// 将页面设�为横向打印模�?
	HSSFPrintSetup hps = sheet.getPrintSetup();
	hps.setLandscape(true); // 将页面设置为横向打印模式
	hps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);// 为A4纸的大小

	int columnCount = list.get(0).length;
	// 表头那一列的的宽�?
	sheet.setColumnWidth((short) 0, (short) 10000);
	// 合并单元�?
	// sheet.addMergedRegion(new Region((short) 0, (short) 0, (short) 0,
	// (short) (columnCount-1)));
	// 根据String[] s来设定每一格的宽度
	for (int i = 0; i < columnCount; i++) {
		sheet.setColumnWidth((short) i, (Short.parseShort(s[i])));
	}
	// 表名
	HSSFRow row1 = sheet.createRow(0);
	HSSFCell cell = row1.createCell(0);
	cell.setCellValue(name);
	cell.setCellStyle(cs1);
	row1.setHeight((short) 800);
	sheet.addMergedRegion(new Region((short) 0, (short) 0, (short) 0,
			(short) (columnCount - 1)));

	HSSFRow rows = null;
	for (int i = 0; i < list.size(); i++) {
		rows = sheet.createRow(i + 1);
		String cellDate[] = list.get(i);
		HSSFCell cells = null;
		for (int j = 0; j < cellDate.length; j++) {
			cells = rows.createCell((short) (j));
			cells.setCellValue(cellDate[j]);
			cells.setCellStyle(cs);
		}
		if (i == 0) {
			rows.setHeight((short) 600);// 标题行宽�?
		}
	}
	wb.write(buffer);
	return new FileTransfer(filename, "application/x-xls", buffer
			.toByteArray());
}
 
开发者ID:wufeisoft,项目名称:ryf_mms2,代码行数:75,代码来源:DownloadFileService.java


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