Java Code Examples for org.apache.poi.ss.usermodel.Sheet#getColumnWidth()

The following examples show how to use org.apache.poi.ss.usermodel.Sheet#getColumnWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExcelToHtmlServer.java    From autopoi with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 2
Source File: ExcelToHtmlServer.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: ExcelToHtmlServer.java    From easypoi with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: CellContentHandler.java    From birt with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 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 );
}