Page 1 of 2
send multiple reports to the printer
Posted: Tue Apr 26, 2011 9:38 am
by jpascual
Hi, I have a report that prints a single report with many dataset that are of a client. The dataset is loaded with a CustomerID.
I can not group the reports by CustomerID, each report is for a customer.
I want to send to print multiple reports for different customers without having to open multiple windows, one for each client.
Is it possible to send multiple reports to the printer queue without opening multiple windows?
thanks!
send multiple reports to the printer
Posted: Wed Apr 27, 2011 4:42 am
by Alex K.
Hello,
As a way, you can create multiple reports for different CustomerID, and then merge them into one report and send for printing.
Thank you.
send multiple reports to the printer
Posted: Wed Apr 27, 2011 5:27 am
by jpascual
Hi, thanks for your response.
Could you tell me more about how I can combine multiple reports into one?
I can create multiple reports but I do not know how to group.
thanks
send multiple reports to the printer
Posted: Thu Apr 28, 2011 2:42 am
by Alex K.
Hello,
Please see the sample code:
Code: Select all
StiReport report = new StiReport();
report.Load("e:\\Report.mrt");
report.Compile();
report["VariableCustomerID"] = 1;
report.Render(false);
StiReport reportAll = new StiReport();
reportAll.Render();
reportAll.RenderedPages.Clear();
foreach (StiPage page in report.RenderedPages)
{
reportAll.RenderedPages.Add(page);
}
report["VariableCustomerID"] = 2;
report.Render(false);
foreach (StiPage page in report.RenderedPages)
{
reportAll.RenderedPages.Add(page);
}
//..
reportAll.Show();
Let us know if you need any additional help.
Thank you.
send multiple reports to the printer
Posted: Fri Apr 29, 2011 2:51 am
by jpascual
Hi, I have tried to do what you told me but I can not work. Can you check my code and see what I do wrong?
Code: Select all
Dim report As New StiReport
report.Load(MapPath("~/Reports/report.mrt"))
report.Compile()
'report.Render(False)
Dim reportAll As New StiReport
reportAll.Render()
reportAll.RenderedPages.Clear()
Dim Customers(2) As String
Customers(0) = 719
Customers(1) = 717
For k = 0 To Customers.Length - 2
Dim CustomerID As Integer = Customers(k)
Dim DSCustomer As DataSet
DSCustomer = CNResid.ShowCustomer(CustomerID)
Dim DS2 As New DataSet
DS2.Tables.Add(DSCustomer.Tables(0).Copy)
report.RegData(DS2)
report.Render(False)
For Each page As StiPage In report.RenderedPages
reportAll.RenderedPages.Add(page)
Next
Next
'reportAll.Show()
StiWebViewerFx1.Report = reportAll
send multiple reports to the printer
Posted: Fri Apr 29, 2011 7:10 am
by Alex K.
Hello,
Can you please send us a sample project, which reproduce the issue?
Thank you.
send multiple reports to the printer
Posted: Mon May 02, 2011 2:41 am
by jpascual
I attach a Visual Studio 2008 project with the code to join two reports into one report. thanks
send multiple reports to the printer
Posted: Mon May 02, 2011 7:52 am
by Alex K.
Hello,
Please check modified project in attachment.
Thank you.
send multiple reports to the printer
Posted: Mon May 02, 2011 9:07 am
by jpascual
Thanks for your answer but the example does not work. Displays the report in black and with only one page when it should have two pages and data.
The code is similar to what I had. Just change one line and is similar.
In this example I use variables but usually I use Dataset to load the report. For example:
Dim DSvisualizar As New DataSet
DSvisualizar.Tables.Add(myDatatable.Copy())
report.RegData(DSvisualizar)
send multiple reports to the printer
Posted: Wed May 04, 2011 7:15 am
by Ivan
Hello,
jpascual wrote:Thanks for your answer but the example does not work. Displays the report in black and with only one page when it should have two pages and data.
Please modify your code:
Code: Select all
Dim report As New StiReport
report.Load(MapPath("~/report.mrt"))
report.Compile()
report.Render(False)
Dim reportAll As New StiReport
reportAll.NeedsCompiling = False
reportAll.IsRendered = True
reportAll.RenderedPages.Clear()
Dim Customers(2) As String
Customers(0) = 719
Customers(1) = 717
For k As Integer = 0 To Customers.Length - 2
Dim CustomerID As Integer = Customers(k)
report("Variable1") = CustomerID.ToString()
report.Render(False)
For Each page As StiPage In report.RenderedPages
reportAll.RenderedPages.Add(page)
Next
Next
StiWebViewerFx1.Report = reportAll
jpascual wrote:The code is similar to what I had. Just change one line and is similar.
This line of code depends on whether the report is compiled or not.
Thank you.