當前位置: 首頁>>代碼示例>>Java>>正文


Java Sheet.createFreezePane方法代碼示例

本文整理匯總了Java中org.apache.poi.ss.usermodel.Sheet.createFreezePane方法的典型用法代碼示例。如果您正苦於以下問題:Java Sheet.createFreezePane方法的具體用法?Java Sheet.createFreezePane怎麽用?Java Sheet.createFreezePane使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.poi.ss.usermodel.Sheet的用法示例。


在下文中一共展示了Sheet.createFreezePane方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: copySheet

import org.apache.poi.ss.usermodel.Sheet; //導入方法依賴的package包/類
/**
 * 複製工作表相關參數
 * 
 * @author      ZhengWei(HY)
 * @createDate  2017-03-20
 * @version     v1.0
 *
 * @param i_FromSheet
 * @param i_ToSheet
 */
public final static void copySheet(Sheet i_FromSheet ,Sheet i_ToSheet)
{
    // 打印時顯示網格線
    i_ToSheet.setPrintGridlines(           i_FromSheet.isPrintGridlines());
    i_ToSheet.setPrintRowAndColumnHeadings(i_FromSheet.isPrintRowAndColumnHeadings());
    i_ToSheet.setFitToPage(                i_FromSheet.getFitToPage());
    
    // Sheet頁自適應頁麵大小
    i_ToSheet.setAutobreaks(               i_FromSheet.getAutobreaks());
    i_ToSheet.setDisplayZeros(             i_FromSheet.isDisplayZeros());
    i_ToSheet.setDisplayGuts(              i_FromSheet.getDisplayGuts());
    // 網格線
    i_ToSheet.setDisplayGridlines(         i_FromSheet.isDisplayGridlines());
    
    // 凍結線
    if ( i_FromSheet.getPaneInformation() != null )
    {
        i_ToSheet.createFreezePane(i_FromSheet.getPaneInformation().getVerticalSplitPosition()
                                  ,i_FromSheet.getPaneInformation().getHorizontalSplitPosition()
                                  ,i_FromSheet.getPaneInformation().getVerticalSplitLeftColumn()
                                  ,i_FromSheet.getPaneInformation().getHorizontalSplitTopRow());
    }
}
 
開發者ID:HY-ZhengWei,項目名稱:hy.common.report,代碼行數:34,代碼來源:ExcelHelp.java

示例2: createRows

import org.apache.poi.ss.usermodel.Sheet; //導入方法依賴的package包/類
private static void createRows(List<String> keyList,
        Map<String, ResourceBundle> defaultProperties,
        Map<String, Properties> localizedProperties, Sheet sheet,
        List<String> localeList, String sheetName) {
    sheet.createFreezePane(1, 1);
    int rowIdx = 1;
    int colIdx = 0;
    for (String key : keyList) {
        Row row = sheet.createRow(rowIdx++);
        colIdx = 0;
        row.createCell(colIdx++).setCellValue(key);

        for (String locale : localeList) {
            String cellValue = null;
            cellValue = getCellValue(defaultProperties,
                    localizedProperties, key, locale, sheetName);
            row.createCell(colIdx++).setCellValue(cellValue);
        }
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:21,代碼來源:ExcelHandler.java

示例3: createSheet

import org.apache.poi.ss.usermodel.Sheet; //導入方法依賴的package包/類
/**
 * Creates an excel sheet in the provided workbook using provided parameters.
 * 
 * @param input the data to put in the sheet-
 * @param sheetName the name to user for the sheet.
 * @param wb the workbook to create the sheet in.
 */
private void createSheet(	List<MessageResourceEntry> input,
							String sheetName,
							Workbook wb)
{
	// create a new sheet
	String name = StringUtils.isBlank(sheetName) ? this.defaultSheetName : sheetName;
	LOG.info("Create sheet with name " + name);
	Sheet sheet = wb.createSheet(name);
	sheet.setZoom(this.zoom, 100);

	Map<Locale, Integer> langs = getLanguageInformation(input);
	createHeader(sheet, langs);

	CellStyle keyStyle = sheet.getWorkbook().createCellStyle();
	keyStyle.setAlignment(CellStyle.ALIGN_LEFT);
	keyStyle.setBorderBottom(CellStyle.BORDER_THIN);
	keyStyle.setBorderRight(CellStyle.BORDER_MEDIUM);
	Font f = sheet.getWorkbook().createFont();
	f.setBoldweight(Font.BOLDWEIGHT_NORMAL);
	keyStyle.setFont(f);

	CellStyle valueStyle = sheet.getWorkbook().createCellStyle();
	valueStyle.setAlignment(CellStyle.ALIGN_LEFT);
	valueStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
	valueStyle.setBorderBottom(CellStyle.BORDER_THIN);
	valueStyle.setBorderRight(CellStyle.BORDER_THIN);
	valueStyle.setBorderTop(CellStyle.BORDER_THIN);
	valueStyle.setBorderLeft(CellStyle.BORDER_THIN);
	valueStyle.setFont(f);
	valueStyle.setWrapText(true);

	CellStyle emptyStyle = sheet.getWorkbook().createCellStyle();
	emptyStyle.setAlignment(CellStyle.ALIGN_LEFT);
	emptyStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
	emptyStyle.setBorderBottom(CellStyle.BORDER_THIN);
	emptyStyle.setBorderRight(CellStyle.BORDER_THIN);
	emptyStyle.setBorderTop(CellStyle.BORDER_THIN);
	emptyStyle.setBorderLeft(CellStyle.BORDER_THIN);
	emptyStyle.setFont(f);
	emptyStyle.setFillForegroundColor(IndexedColors.LAVENDER.getIndex());
	emptyStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
	emptyStyle.setWrapText(true);

	LOG.info("Write data to sheet " + name);
	int rowIndex = this.languageHeaderRow + 1;
	for (MessageResourceEntry entry : input)
	{
		Row row = sheet.createRow(rowIndex);
		createContentRow(entry, row, langs, keyStyle, valueStyle, emptyStyle);
		rowIndex++;
	}
	sizeColumns(sheet, langs);
	sheet.createFreezePane(this.firstLanguageColumn, this.languageHeaderRow + 1, this.firstLanguageColumn, this.languageHeaderRow + 1);
}
 
開發者ID:namics,項目名稱:spring-i18n-support,代碼行數:62,代碼來源:ExcelWriter.java


注:本文中的org.apache.poi.ss.usermodel.Sheet.createFreezePane方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。