Is there a way in Arisscript to set the column width in Excel to automatically fit the widest data?
Thanks!
Rick Beddoe
Cargill Aris Technical Analyst
Minneapolis, MN, USA
Thanks Torsten,
I simply wrote a function to do this (UPDATED):
function _autoFitColumns(_workSheet, _columnCount) { var oRowCount = _workSheet.getAbsoluteFilledRowCount(); var oRowWidth = 0; for (i=0;i<_columnCount;i++) { var oColWidth = 0; for (j=0;j<oRowCount;j++) { var oCell = _workSheet.getCell(j, i).getCellValue(); var oCharCount = oCell.length(); if (oCharCount > oColWidth) { oColWidth = oCharCount; } } oColWidth = (oColWidth + 3) * 256; _workSheet.setColumnWidth(i,oColWidth); }