biswanath_c has asked for the wisdom of the Perl Monks concerning the following question:


Hi,

I was writing a tool which dumps the analysis results into a spreadsheet. I used the Spreadsheet::WriteExcel module. Writing to the excel worked just fine like a charm! But I'd like to know how to enable the automatic resizing of cell widths to accomodate the text in the cells programatically? ..also, is there a way to write text in bold, enable cell coloring programatically?


  • Comment on Spreadsheet::WriteExcel - Auto resizing of spreadsheet cells...

Replies are listed 'Best First'.
Re: Spreadsheet::WriteExcel - Auto resizing of spreadsheet cells...
by runrig (Abbot) on Oct 15, 2009 at 18:36 UTC
      I was not able to find that perl script anywhere in my machine. I am pretty much sure it did not come with the installation for me! The documentation for Format was empty! It did not list any methods or the usage description!!

        I was not able to find that perl script anywhere in my machine. I am pretty much sure it did not come with the installation for me!
        You can just grab the autofit.pl script from CPAN.
Re: Spreadsheet::WriteExcel - Auto resizing of spreadsheet cells...
by ww (Archbishop) on Oct 15, 2009 at 18:27 UTC
      Is there a documentation for Format?

Re: Spreadsheet::WriteExcel - Auto resizing of spreadsheet cells...
by biohisham (Priest) on Oct 16, 2009 at 01:07 UTC
    This is my favorite Spreadsheet::WriteExcel source of examples listed and grouped together in a nice way here at this link, it got a couple of examples about colors, you can even programmatically control cells to display colors based on conditions regarding the contents they have, like red for negative values, blue for zero and green for positive values or any other combination of colors and conditions.

    Probably you meant automatic resizing of columns to the size of the longest string a cell in that column can have. There's a function called Autofit. However get yourself familiarized with formats in Spreadsheet::WriteExcel so you can explore the multitude of other options you can get.


    Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.