下面列出了org.apache.poi.ss.usermodel.Sheet#getColumnWidth ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private int getTableWidth(Sheet sheet) {
ensureColumnBounds(sheet);
int width = 0;
for (int i = firstColumn; i < endColumn; i++) {
width = width + (sheet.getColumnWidth(i) / 32);
}
return width;
}
private int getTableWidth(Sheet sheet) {
ensureColumnBounds(sheet);
int width = 0;
for (int i = firstColumn; i < endColumn; i++) {
width = width + (sheet.getColumnWidth(i) / 32);
}
return width;
}
private int getTableWidth(Sheet sheet) {
ensureColumnBounds(sheet);
int width = 0;
for (int i = firstColumn; i < endColumn; i++) {
width = width + (sheet.getColumnWidth(i) / 32);
}
return width;
}
/**
* Calculate the width of a set of columns, in millimetres.
* @param startCol
* The first column to consider (inclusive).
* @param endCol
* The last column to consider (inclusive).
* @return
* The sum of the widths of all columns between startCol and endCol (inclusive) in millimetres.
*/
private double spanWidthMillimetres( Sheet sheet, int startCol, int endCol ) {
int result = 0;
for ( int columnIndex = startCol; columnIndex <= endCol; ++columnIndex ) {
result += sheet.getColumnWidth(columnIndex);
}
return ClientAnchorConversions.widthUnits2Millimetres( result );
}