日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

java wrap方法_Java WritableCellFormat.setWrap方法代码示例

發布時間:2023/12/2 java 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java wrap方法_Java WritableCellFormat.setWrap方法代码示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

import jxl.write.WritableCellFormat; //導入方法依賴的package包/類

/**

* @param workSheet to add the help to

* @param table to fetch metadata from

* @param startRow to start adding rows at

* @param helpTextRowNumbers - map to insert row numbers for each help field into

* @return the index of the next row to use

* @throws WriteException if any of the writes to workSheet failed

*/

private int outputHelp(WritableSheet workSheet, Table table, final int startRow, final Map helpTextRowNumbers) throws WriteException {

int currentRow = startRow;

// Title for the descriptions

Label dataLabel = new Label(0, currentRow, "Column Descriptions");

dataLabel.setCellFormat(getBoldFormat());

workSheet.addCell(dataLabel);

currentRow++;

int currentColumn = 0;

for (Column column : table.columns()) {

if (!column.getName().equals("id") && !column.getName().equals("version")) {

// Field name to go with the description

Label fieldName = new Label(0, currentRow, spreadsheetifyName(column.getName()));

fieldName.setCellFormat(getBoldFormat());

workSheet.addCell(fieldName);

// The type/width

String typeString = column.getType() + "(" + column.getWidth() + (column.getScale() == 0 ? "" : "," + column.getScale()) + ")";

Label fieldType = new Label(1, currentRow, typeString);

fieldType.setCellFormat(getStandardFormat());

workSheet.addCell(fieldType);

// The default

String defaultValue = additionalSchemaData.columnDefaultValue(table, column.getName());

Label fieldDefault = new Label(2, currentRow, defaultValue);

fieldDefault.setCellFormat(getStandardFormat());

workSheet.addCell(fieldDefault);

// The field documentation

workSheet.mergeCells(3, currentRow, 12, currentRow);

String documentation = additionalSchemaData.columnDocumentation(table, column.getName());

Label documentationLabel = new Label(3, currentRow, documentation);

WritableCellFormat format = new WritableCellFormat(getStandardFormat());

format.setWrap(true);

format.setVerticalAlignment(VerticalAlignment.TOP);

documentationLabel.setCellFormat(format);

workSheet.addCell(documentationLabel);

//If we've exceed the maximum number of columns - then output truncated warnings

if(currentColumn >= MAX_EXCEL_COLUMNS) {

Label truncatedWarning = new Label(13, currentRow, "[TRUNCATED]");

truncatedWarning.setCellFormat(getBoldFormat());

workSheet.addCell(truncatedWarning);

}

// We are aiming for 150px. 1px is 15 Excel "Units"

workSheet.setRowView(currentRow, 150 * 15);

// Remember at what row we created the help text for this column

helpTextRowNumbers.put(column.getName(), currentRow);

currentRow++;

currentColumn++;

}

}

// Group all the help rows together

workSheet.setRowGroup(startRow + 1, currentRow - 1, true);

// Some extra blank space for neatness

currentRow++;

return currentRow;

}

總結

以上是生活随笔為你收集整理的java wrap方法_Java WritableCellFormat.setWrap方法代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。