Menu

Auto Column Sizing

Help
Brian
2005-09-07
2013-04-11
  • Brian

    Brian - 2005-09-07

    Hello,

    In the xml_init_col procedure it places the attribute ss:AutoFitWidth to equal 1; however, the columns don't autosize to the text in the cells for the specified column when the document opens in Excel.  Am I correct when assuming that the command should?  If so, any idea on why it doesn't work?

    Thanks,

    Brian

     
    • psgeek

      psgeek - 2005-09-08

      Brian
      The AutoFitWidth of 1 only works if the data is a date or number.  It doesn't autowidth for strings.  This is an Excel limitation, from what I can see.

      If you can get it to work in Excel, then save the Excel as XML and check out the XML output.  I wasn't able to get it to work in Excel, so I did a Google search and found the following link:

      http://www.excelforum.com/archive/index.php/t-230141.html

      If you do use this for numbers and dates, the correct format (number or date) might need to be a style and set up as a style for that column.  Not sure about this part.  But for use on strings, you'll have to compute your own width (and somehow know the width before you even get the data...)  You could populate an array or work table, find the max width of any string, then set the column width.

      Good luck
      David Vandiver

      P.S.  Let me know if you use this in Production.  I like hearing about where all the project has helped others in the world.   work @ vandiverhouse.com  (take out the spaces).

       
    • Brian

      Brian - 2005-09-08

      Wow! Thanks for the quick response.  I was actually developing my own PeopleCode solution when a friend pointed me to your project.  I didn't dive into the XML scheme as much as you have.  I've started adapting the pieces I've missed from yours into mine.

      Thanks Much!

      Brian

       
      • psgeek

        psgeek - 2005-09-08

        Send me an e-mail, and I can share with you my PeopleCode experience.

         

Log in to post a comment.

Auth0 Logo