Two XtraReports I can bring together by Pages.AddAange. How can I bring together two XafReports?
Mario
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Sorry, One should say: Pages.AddRange
Hi Mario,
Thank you for report. We've created a special knowledge base article that helps you (I want to create a report with two business objects. Does XAF allow this?). Please let me know your results.
Thanks,
Marina
Thank you for these good instructions. However, my problem is another. I have several different XafReports and would like to combine this when required passed away (Merge Pages of Two Reports). How is this possible?
Mario
Hi Mario,
To accomplish your task, write the following ViewController:
//... using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.XtraReports.UI; using DevExpress.ExpressApp.Reports; using DevExpress.Data.Filtering; namespace TwoBOinOneReport.Module.Win { public partial class ViewController1 : ViewController { public ViewController1() { InitializeComponent(); RegisterActions(components); } private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e) { ReportData reportData1 = ObjectSpace.FindObject<ReportData>(new BinaryOperator("Name", "r1")); XtraReport xr1 = reportData1.LoadXtraReport(ObjectSpace); xr1.CreateDocument(); ReportData reportData2 = ObjectSpace.FindObject<ReportData>(new BinaryOperator("Name", "r")); XtraReport xr2 = reportData2.LoadXtraReport(ObjectSpace); xr2.CreateDocument(); xr1.Pages.AddRange(xr2.Pages); xr1.PrintingSystem.ContinuousPageNumbering = true; xr1.ShowPreviewDialog(); } } }
I've attached the modified sample. Feel free to ask additional questions.
Thanks,
Marina
I use the following code for the web project. What must I change?
Dim reportName1 As String = "test"
Dim reportName2 As String = "test2"
Dim parametersObjectSpace As ObjectSpace = Application.CreateObjectSpace()
Dim reportData1 As Reports.ReportData = parametersObjectSpace.FindObject(Of ReportData)(New BinaryOperator("Name", reportName1))
Dim reportData2 As Reports.ReportData = parametersObjectSpace.FindObject(Of ReportData)(New BinaryOperator("Name", reportName2))
'Merge???
Dim report As Reports.XafReport = reportData1.LoadXtraReport(parametersObjectSpace)
Dim detailView As DetailView = report.CreateParametersDetailView(Application)
If detailView Is Nothing Then
detailView = New DetailView(parametersObjectSpace, reportData1, Application, False)
detailView.SetInfo(New DictionaryNode(""))
End If
detailView.Caption = reportData1.ReportName
detailView.SetReadOnlyByKey("", False)
detailView.ViewEditMode = ViewEditMode.Edit
parametersObjectSpace.SetModified(reportData1)
e.ShowViewParameters.Context = TemplateContext.PopupWindow
e.ShowViewParameters.CreatedView = detailView
e.ShowViewParameters.TargetWindow = TargetWindow.Popup
e.ShowViewParameters.Controllers.Add(CreateReportDialogController(report, ReportOutputType.Mht))
Thanks, Mario
Hi Mario,
In your Web application, you need to write something in the following manner:
Private Sub simpleAction1_Execute(ByVal sender As Object, ByVal e As SimpleActionExecuteEventArgs) Handles simpleAction1.Execute Dim reportName As String = "test" Dim parametersObjectSpace As ObjectSpace = Application.CreateObjectSpace() Dim reportData As ReportData = parametersObjectSpace.FindObject(Of ReportData)(New BinaryOperator("Name", reportName)) Dim report As XafReport = reportData.LoadXtraReport(parametersObjectSpace) report.CreateDocument() Dim reportName1 As String = "test2" Dim parametersObjectSpace1 As ObjectSpace = Application.CreateObjectSpace() Dim reportData1 As ReportData = parametersObjectSpace.FindObject(Of ReportData)(New BinaryOperator("Name", reportName1)) Dim report1 As XafReport = reportData1.LoadXtraReport(parametersObjectSpace) report1.CreateDocument() report.Pages.AddRange(report1.Pages) report.PrintingSystem.ContinuousPageNumbering = True Dim detailView As DetailView = report.CreateParametersDetailView(Application) If detailView Is Nothing Then detailView = New DetailView(parametersObjectSpace, reportData, Application, False) detailView.SetInfo(New DictionaryNode("")) End If detailView.Caption = reportData.ReportName detailView.SetReadOnlyByKey("", False) detailView.ViewEditMode = ViewEditMode.Edit e.ShowViewParameters.Context = TemplateContext.PopupWindow e.ShowViewParameters.CreatedView = detailView e.ShowViewParameters.TargetWindow = TargetWindow.Popup e.ShowViewParameters.Controllers.Add(CreateReportDialogController(report, ReportOutputType.Pdf)) End Sub
Thanks,
Marina
In my project were absent for Modules.Web the references to XtraPrinting and XtraReports. Some methods were not thereby recognizable.
Now it functions. Thank you
Mario Funke
Mario, thank you for your feedback. I'm happy to know that my code helped you. Next time, I will define which assemblies, except for default ones, you need to use.
Marina