how to expand table to a page size? RRS feed

  • Question

  • Hi experts,


      Thanks in advance for the help. I want the table in my report  be able to expand itself to fill up a page size even when it only has one record to display. Think about an invoice print out , if it only has one item and the table shank into 1/5 of the A4 page size, how ungly it is. In that table it has a group, a detail row, and a header row. Any help would be most appreciate.




    Monday, July 2, 2007 9:17 AM

All replies

  • Is the problem that you need data items in the footer so you aren't putting them in the page footer?  This might be solvable, if so. 


    If you have already exhausted all options there, I would try experimenting with a nested table.


    Another way to do this is to add extra dummy rows matching your requirement into the set of details.  I showed how to do this in another thread ( but that was a pretty involved situation so I am just going to pull out the relevant post here for you:


    Oh -- one more thing -- I was going to show you how to get the 25 rows without a temp table.   For completeness I will add that information to this thread, in case anybody wants to follow through with a similar problem.


    The version I'll show you here will work assuming that the full table has at least 25 rows and that you are just filtering down to some date set, some set of classrooms, etc.  Substitute whatever you want for the condition in green here. 


    You use a self-join repeating the "real condition" for your data on both sides of the join, with a slight variation.  On the second side of the  join, you ensure the right number of records by using a TOP N clause and, instead of really applying the condition as  WHERE clause, use the condition as an ORDER BY clause that re-orders the rows so that the ones you want will be on top.  You get your columns from the left side, which ensures that the rows that do not match the condition have all nulls in their columns -- use ISNULL() if this is not what you want in those extra rows:


    Code Snippet

    SELECT  realCondition.enrolmentID, whatever FROM

    (SELECT enrolmentID, whatever FROM Attendances

    WHERE enrolmentID like 'XX%') realCondition


    (SELECT TOP 25 enrolmentID FROM Attendances
    ORDER BY CASE WHEN enrolmentID like 'XX%' THEN 0 ELSE 1 END) dummy

    ON realCondition.enrolmentID  = dummy.enrolmentID


    Hope this helps somebody reading,







    Monday, July 2, 2007 3:47 PM
    • Proposed as answer by Xware Wednesday, July 13, 2011 5:39 PM
    Monday, July 28, 2008 1:52 AM