getColumnWidth method

double getColumnWidth(
  1. int iColumnIndex
)

Returns the width of the specified column.

// Create a new Excel Document.
final Workbook workbook = Workbook(1);
// Accessing sheet via index.
final Worksheet sheet = workbook.worksheets[0];
sheet.getRangeByName('A1');
// get column Width.
print(sheet.getColumnWidth(1));
// Save and dispose workbook.
final List<int> bytes = workbook.saveAsStream();
File('Output.xlsx').writeAsBytes(bytes);
workbook.dispose();

Implementation

double getColumnWidth(int iColumnIndex) {
  if (iColumnIndex < 1 || iColumnIndex > _book._maxColumnCount) {
    throw Exception(
        'Value cannot be less 1 and greater than max column index.');
  }
  return _innerGetColumnWidth(iColumnIndex);
}