/** * get the width (in units of 1/256th of a character width ) * @param columnIndex - the column to set (0-based) * @return width - the width in units of 1/256th of a character width */ @Override public int getColumnWidth(int columnIndex) { return _sh.getColumnWidth(columnIndex); }
/** * Get the actual column width in pixels * * <p> * Please note, that this method works correctly only for workbooks * with the default font size (Calibri 11pt for .xlsx). * </p> */ @Override public float getColumnWidthInPixels(int columnIndex) { float widthIn256 = getColumnWidth(columnIndex); return (float)(widthIn256/256.0*Units.DEFAULT_CHARACTER_WIDTH); }
int c = cell.getCol(); int cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); wPos += cw;
/** * get the width (in units of 1/256th of a character width ) * @param columnIndex - the column to set (0-based) * @return width - the width in units of 1/256th of a character width */ @Override public int getColumnWidth(int columnIndex) { return _sh.getColumnWidth(columnIndex); }
/** * get the width (in units of 1/256th of a character width ) * @param columnIndex - the column to set (0-based) * @return width - the width in units of 1/256th of a character width */ public int getColumnWidth(int columnIndex) { return _sh.getColumnWidth(columnIndex); }
/** * Get the actual column width in pixels * * <p> * Please note, that this method works correctly only for workbooks * with the default font size (Calibri 11pt for .xlsx). * </p> */ @Override public float getColumnWidthInPixels(int columnIndex) { float widthIn256 = getColumnWidth(columnIndex); return (float)(widthIn256/256.0*Units.DEFAULT_CHARACTER_WIDTH); }
private void updateColumnWidth(XSSFCell cell, String value) { double width = CellWidthEstimator.getCellWidth(cell, value); int col = cell.getColumnIndex(); if (columnWidths.containsKey(col)) { columnWidths.put(col, Math.max(width, columnWidths.get(col))); } else { columnWidths.put(col, Math.max(width, sheet.getColumnWidth(col) / 256f)); } }
public void reportColumnWidth(String column, float width) { if (maxColumnWidths.containsKey(column)) { float current = maxColumnWidths.get(column); if (current < width) { maxColumnWidths.put(column, width); } } else { float colWidth = PDFHelper.excelToPixel(getSheet().getColumnWidth(CellReference.convertColStringToIndex(column))); maxColumnWidths.put(column, Math.max(width, colWidth)); } }
public void setColumnWidths(XSSFWorkbook wb) { for (int i = 0; i < wb.getNumberOfSheets(); i++) { XSSFSheet sheet = wb.getSheetAt(i); Map<String, Float> maxColumnWidths = new HashMap<String, Float>(); for (int col = 0; col < 256; col++) { maxColumnWidths.put(CellReference.convertNumToColString(col), PDFHelper.excelToPixel(sheet.getColumnWidth(col))); } workbookColumnWidths.put(sheet, maxColumnWidths); } }
private float columnWidth(PdfContext context, int i) { String col = CellReference.convertNumToColString(i); return context.getMargins() + (context.isExpanded(col) ? context.getColumnWidth(col) : PDFHelper.excelToPixel(getSheet().getColumnWidth(i))); }
public PdfCellNode(XSSFSheet sheet, XSSFCell cell, XLSXExpression expr) { super(sheet, cell, expr); excelWidth = sheet.getColumnWidth(cell.getColumnIndex()); colRef = CellReference.convertNumToColString(cell.getColumnIndex()); int rowIndex = getCell().getRowIndex(); int rowRef = rowIndex + 1; absoluteRef = colRef + rowRef; verticalRange = new SimpleRange(rowIndex, rowIndex); horizontalAlignment = Alignment.LEFT; verticalAlignment = getCell().getCellStyle().getVerticalAlignment(); }
targetSheet.setColumnWidth(i, sourceSheet.getColumnWidth(i));
cw = name.trim().length() + 12; if(sheet.getColumnWidth((short)0)< (short) name.trim().length()) sheet.setColumnWidth((short)0, (short) name.trim().length()); if(sheet.getColumnWidth((short)1)< (short) value.trim().length()) sheet.setColumnWidth((short)1, (short) value.trim().length()); name = "";
int c = cell.getCol(); int cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); wPos += cw;
newSheet.setColumnWidth(columnNumber, oldSheet.getColumnWidth(columnNumber));
int width=sheet.getColumnWidth(i); col.setWidth(width/37); col.setColumnNumber(i+1);
copy(tplSheet, 21, 0, sheet, ++iRow, 0, 'K' - 'A'); for (int i = 0; i < 'K' - 'A'; i++) { sheet.setColumnWidth(i, tplSheet.getColumnWidth(i));