Thanks for any help you can provide...
13 Answers, 1 is accepted
Bill
The page breaking mechanism cannot be "wired" to the page numbering due to the fact that the built-in PageNumber and PageCount objects are available only in page sections. Data processing and paging are two separate processes and as explained in the Understanding Report Sections help article, the paging of a report strongly depends on the format it is rendered to, that is why page sections and their items are processed by the corresponding rendering extension after the report data has been processed.
In short all pages of a report are printed in a continuous manner and there is nothing specific we do for printing. Тhe print behavior should be controlled through the printer drivers or printer itself, as Telerik Reporting does not have control over it.Greetings,
Steve
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
We have a 'report book' consisting of reports for 400 individuals. Report length can be 1, 2, 3 or 4 pages per individuals. End users will want to duplex reports of this length.
We are trying to force the extra form feed when the page count for an indivdual report is odd. We've attempted to do this with a page footer that is printed conditonally based upon page count. The Can Grow property for the page footer is TRUE -- the footer prints a field consisting of about 45 carriage returns -- enough to force another page.
When the report is previewed with the Telerik previewer, the technique works -- we get an extra form feed to accommodate the page footer. But when we export to PDF or send to the printer, the Can Grow property appears to be lost -- only the first line of the page footer prints, at the bottom of the page.
Do you know of any other techniques we can use to force an extra form feed based upon page count?
The real problem is knowing when an individual report will generate odd or even pages. As mentioned the data processing and paging are two separate processes so we cannot know this at runtime. The page sections are not related to the report itself, but are relative to the margins of the report's media, i.e. to the paper or screen, so their size is constant and cannot be changed at runtime, that is why the behavior you observe is correct. In the web report viewer you get the carriage returns, because it is not a page oriented format, rather it is a logical representation of the report whether the report width and height is infinite.
We've searched to see how other reporting products or even word processors handle such cases, but we could not find standardized approach if any at all.
The only kind of workaround we can offer for the time being is to generate separate report for each individual and print them as batch order or combine them in a Report Book but insert an empty report for individuals that generate odd pages.
Kind regards,
Steve
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
Thanks for the response. One of the things we tried was to go 'direct to printer', bypassing the preview. We generated a separate report for each individual and sent it to the printer. This would force a sheet feed for each new report. We initially hoped that the reports would print with the user's default printer settings. Those are not available, so we tried to find a way to have the Print Setup dialog appear for only the first report, and to save those settings.
However, we could not find a way to do this -- the print setup dialog appeared for each report. When you suggest printing the reports as a batch order, is there a way to do this so that the print setup dialog appears only once?
Bill
I suspect you're using a web application, so in order to print a report through the Web ReportViewer you need to use the built-in print functionality, which depends on the Adobe Acrobat Reader PDF plugin (you need it installed to take advantage of true print and not the browsers' printing capabilities) and you have all the options to select a printer from a list.
On the client side you can invoke the print through the ReportViewer client object's PrintReport() method.
This is the only possible thing you can do on the client side - there is no way to list the available printers or their settings.
To print a report through the Windows Forms ReportViewer you need to use the ReportProcessor.PrintReport() method. It accepts two parameters - the report to print and the PrinterSettings that should be used:
ReportProcessor reportProcessor = new ReportProcessor();
reportProcessor.PrintReport(new Reports.Report1(), printDlg.PrinterSettings);
See Hide the print progress dialog when printing a report programmatically for more info on doing batch printing.
Best wishes,
Steve
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
Thanks again for the response. Yes, we are using a web application. We have already done what you suggested, but the problem is this:
- Rather than compile a single report for 400 indivduals, with a varying number of pages per individual, we compile 400 indivdual reports and print them in a loop (a batch order?).
- Using the PrintReport() method, we get the Print Setup dialog 400 times -- not an acceptable way to print the report.
- We've been trying to find a way either to post the Print Setup dialog only once, or to get access to the client's default printer settings.
We've invested a lot of time in trying to resolve what appears to be a fairly common problem. We've tried to find a way to generate an extra form-feed based upon page count for an individual report, but, as I reported in a previous post, this does not work.
Bill
Thanks for the additional info. Generally there is a way to print directly but is kind of a hack. You will need 2 pages: MainForm.aspx from which the request will be triggered and PrintForm.aspx which will serve the report print operation. Here is the concrete implementation of both pages:
MainForm.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MainForm.aspx.cs" Inherits="MainForm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
head
runat
=
"server"
>
<
title
></
title
>
<
script
type
=
"text/javascript"
>
function PrintReport() {
var printFrame = document.getElementById("PrintFrame");
printFrame.src = "PrintForm.aspx?tmp=" + new Date().getTime();
}
</
script
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
iframe
id
=
"PrintFrame"
src
=
"javascript:'';"
style
=
"visibility:hidden;"
width
=
"1px"
height
=
"1px"
></
iframe
>
<
asp:Button
ID
=
"Button1"
Text
=
"PrintReport"
runat
=
"server"
Height
=
"20px"
OnClientClick
=
"PrintReport(); return false;"
/>
<
br
/>
</
div
>
</
form
>
</
body
>
</
html
>
PrintForms.aspx.cs:
Protected
Sub
Page_Load(sender
As
Object
, eventArgs
As
EventArgs)
Dim
deviceInfo =
New
Hashtable()
deviceInfo(
"JavaScript"
) =
"this.print({bUI: false, bSilent: true, bShrinkToFit: true});"
Dim
reportProcessor =
New
ReportProcessor()
Dim
reportDocument =
New
SampleReport()
reportDocument.ReportParameters(
"Parameter1"
).Value =
"Report"
Dim
renderingResult = reportProcessor.RenderReport(
"PDF"
, reportDocument, deviceInfo)
Response.Clear()
Response.ContentType = renderingResult.MimeType
Response.Cache.SetCacheability(HttpCacheability.[
Private
])
Response.Expires = -1
Response.Buffer =
True
Response.BinaryWrite(renderingResult.DocumentBytes)
Response.[
End
]()
End
Sub
Generally no out of the box solution is available to print the reportbook reports one at a time. However printing the reports directly and knowing the reportbook reports you can trigger report processing and printing operation for every report separately as shown in the above code snippets.
Best wishes,
Steve
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
Group by Invoice Number.
At the end of the group create a formula "Page Type", which consists of
if cstr(pagenumber/2) like "*.00" then
"Even"
else
"Odd"
Then insert this in the Group Footer.
Then Check the following boxes via Section Expert on the Group Footer.
1. Print At Bottom Of Page (Most Important).
2. New Page Before (This is conditional where Page Type is "Odd")
3. Reset Page Number After
4. New Page After
The PageNumber and PageCount global objects are available only in the page sections, so any expression containing them that is not used in the page section would throw an exception. So the answer is no, such approach would not work.
Regards,
Steve
the Telerik team
Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!
Thanks for the idea. I was hoping that there would be an easier way to do this. I'm adding the individual reports to a report book, and then printing the report book. It seems that there should be a way to determine the number of pages of each individual report that is being added to the report book, and then adding a separation page as needed.
Paul