Profile picture for user RBeddoe

Is there a way in Arisscript to set the column width in Excel to automatically fit the widest data?


Rick Beddoe

Cargill Aris Technical Analyst

Minneapolis, MN, USA

by Torsten Haase
Posted on Mon, 10/17/2011 - 15:40

It is not possible at this time. Please ask for this as a new requirement. It should be easy to realize.



by Rick Beddoe Author
Posted on Mon, 10/31/2011 - 20:50

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;

Featured achievement

Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks
  • SS
  • MZ
  • Profile picture for user kbiront
  • Profile picture for user Tony Iliev
  • Profile picture for user amandeep.7.singh
  • PacMan


icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock