Document Solutions for Excel, Java Edition | Document Solutions
Features / Worksheet / Range Operations / Set Row Height and Column Width
In This Topic
    Set Row Height and Column Width
    In This Topic

    You can customize the height of the rows and the width of the columns in a spreadsheet based on specific preferences.

    The setRowHeight method and the setColumnWidth method of the IRange interface can be used to set custom row height (in points) and column width (in characters) for the individual rows and columns of a worksheet, respectively.

    The setRowHeightInPixel method and the setColumnWidthInPixel method of the IRange interface can be used to set the custom row height and column width (in pixels) for the rows and columns of a worksheet, respectively.

    In order to set the row height and column width in a worksheet, refer to the following example code.

    Java
    Copy Code
    // Set row height for row 1:2.
    worksheet.getRange("1:2").setRowHeight(50);
    
    // Set column width for column C:D.
    worksheet.getRange("C:D").setColumnWidth(20);