We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Programmatically add blank records in Detail Section

rarich02 asked
Medium Priority
Last Modified: 2010-12-31
I have a report where the layout is setup so that the data is printed in a tabular format, where the data is obtained from a SQL Server stored procedure.  Thus, if I have 13 records, then I will get 13 rows of data produced in the Detail section.  In addition, I have set the CAN GROW property of one of my textbox fields in the Detail section to true.  

The report is capable of holding 25 records, if the previously mentioned textbox does NOT grow.  If it grows, then there's no telling how many records the page will actually contain.  Here's my problem:  Regardless of now many records are actually able to fit the report, I would like to fill the detail section with BLANK rows if the data obtained did not fill the page.

For example, say none of the records will cause the textbox to grow. Then this means I can have a total of 25 rows on each page.  However, say, instead of 25 records, I get 15.  Then, I would like to programmatically add the remaining 10 records, as blanks, into the detail section so that the report looks filled.  

When the textbox grows, this is even hairier, because now I don't know how many blank rows I'll need to add.

Any ideas.

By the way, I'm using the Crystal Reports Bundled edition, wich came with VisStudio .NET 2002.
Watch Question

What is your intention for adding blank rows?  

If you have a report footer that you want to display at the bottom of the page, you can simply check the "print at bottom" box in the section expert.


1) The blank rows allow a person to Hand write any additional records they may need after the report has been printed out.  
2) It makes the report look complete, with the blank rows filling any empty space that has not been populated with records.

I guess where I'm confused is normally the bottom of the page will be blank whether there are "blank" records or not, so I was guessing that you must have a footer or something that you want at the bottom of the physical sheet of paper to get the "complete" feeling.

In any event, Crystal isn't going to print blank records so the closest you'll be able to get will be to create a formula for the last record that will insert a number of carraige returns (or text or whatever you want).  If you want to pursue this I can show you a formula to do it.

The problem is that the "can grow" is going to screw you up no matter what.  I can show you a formula that will insert five carraige returns after record number 20 however there is no way to calculate accurately if you really only need 3 carraige returns because two of the prior records "grew."  


Currently, I figure there are two ways this can be done:

1) Disallow the CAN grow property of the text box. This way, I know that I will always have 25 records.  Then, on the SQL Server side, let my Stored procedure calculate how many extra "Blank" records I need and add them to the recordset I'm returning.  Then, using the Sorting feature, I'll make sure that the Blank rows will always be the last rows to be printed, in effect filling my last sheet with "Blank" rows.

2) If I could programmatically determine when I've hit my last record, then I'd like to somehow tell the detail section to continue adding new records to that page.  In order to stop this, I would somehow check to see if I've used up the maximum amount of space that the Detail section can use for that page.  If this can be done, then I'd prefer this solution since then, the CAN GROW property would not matter anymore.

Any ideas
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


Thanks for the info.  I'd be more than happy to give you the points if you can help me find the documentation supporting your statement.



"You aren't going to be able to check the space needed with the can grow though or how much space is needed.  Crystal exposes recordcounts and end of file indicators but it does not expose end of page indicators.  You simply aren't going to be able to do it exactly the way you want"

Thanks for the info.  I'd be more than happy to give you the points if you can help me find the documentation supporting your statement.


I don't know of any official documentation saying what Crystal can't do - most company tell you what their software *can* do, not what it can't do ;-)   You can search this forum though if you'd like because this topic has come up before and there some hit or miss workarounds but nothing that provides a real solution.

I'm the #3 ranked expert on this site and to the best of my knowledge it can't be done.  Below link is where the #1 ranked expert on this site says the same thing - he does suggest a workaround by counting the characters to estimate the number of rows although in my own experience this doesn't work well unless everyone uses the same printer because the margins on different print drivers will throw it off.  https://www.experts-exchange.com/Databases/Crystal_Reports/Q_20891815.html





I appreciate your effort.  Looks like I'll be going with Solution #1.  Thanks.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.