none
Dynamic column width using Can Grow/Can Shrink

    Question

  • I have a table in Reporting Services 2005 that contains potentially 75 columns ... They are displayed based on the parameter i pass. However, they are all set to not show if they are not passed in the parameter.   The report is working fine and the export to Excel is also working fine - but if printing or exporting to PDF or selecting the print option from reportviewer , all the blank pages caused by the original width of the table are included.  That is, the table with its full 75 columns is a lot wider than the actual result the user sees, and that width is taken up with blank pages.    At design time, I cannot alter the width of the table because even if I make all the fields small enough and then set them to "Can Grow" - they don't grow and I end up with a squished-looking mess.  Which is frustrating because I would have thought that's the whole point of "Can Grow" and "Can Shrink".

    Has anyone got any idea how we can get around this issue?

    Thanks in advance,

    Avani

     

    P.S : Even if PDF option doesnot work,,its ok. I want the print button option to work...Let me know the workaround...i m stuck up ...

    Friday, October 24, 2008 12:31 PM

All replies

  • Hi Avani,

     

    Unfortunately CanGrow and CanShrink only affect the vertical size.

     

    Regards.

     

    Mike

    MSFT

    Friday, October 24, 2008 4:05 PM
    Moderator
  • Hi Avani,

     

    Is upgrading to RS 2008 an option for you?  In RS 2008 dynamically hidden columns do not consume any space and you won't get any of the blank pages.

     

    In RS 2005, one option you may want to try is the following:  once you are done with your entire report design, open the report in e.g. Notepad or an Xml editor, and then under the <Report> element find the <Width> element.  Try setting the Width element to something like <Width>6.5in</Width> and publish the report.  This may or may not work in your situation depending on your overall report layout/contents.

     

    -- Robert

     

    • Proposed as answer by Daniel Bello Wednesday, June 01, 2011 4:34 PM
    Friday, October 24, 2008 4:13 PM
    Owner
  • Hi Avani

     

    In your notes/mail above you said   ==>  "Reporting Services 2005 that contains potentially 75 columns ... They are displayed based on the parameter i pass. However, they are all set to not show if they are not passed in the parameter"

     

     

    I would say, why don't you return the values from those column that are desired / selected, insted of hiding/un-hiding the column dynamically?

    Saturday, October 25, 2008 3:18 PM
  • Hi,

     

    I tried the width approach but it doesnot seem to work..

     

    I need to render all the 75 columns because the user might select any no of columns. If i write a dynamic sql query n get data for the required columns, my report will not work since the column names that are not fetched in the query will pose a problem coz they are renderered. Thanks for you suggesstion. Can u please suggest me some other method to overcome this problem.

     

    Does anyone know...how to print just the part of a report programatically(asp.net with C#) ...

    Monday, October 27, 2008 3:05 AM
  • I know this is kind of an old topic, but I wanted to propose that you take a look at this post in case it would help you:

    http://spacefold.com/lisa/post/2007/10/03/Changing-the-Sheet-names-in-SQL-Server-RS-Excel-QnD-XSLT.aspx

    xslt can alter many properties of the resulting excel doc - could possibly solve your problem by not inserting columns where there is no data or based on a variable condition.

    Just and idea.

    n.
    Wednesday, May 06, 2009 3:37 PM
  • No this is not perfect to adjust column width.

    Md. Shohel Rana

    Saturday, April 27, 2013 10:31 AM