Support mixed Page orientation in reports

Posted by: grapecity on 23 April 2021, 7:20 pm EST

  • Posted 23 April 2021, 7:20 pm EST

    I am using AR13. We have customer requests to support portrait/landscape orientation in the same report (useful for viewing tables/graphs & is a very fair, basic request). My report includes a Page report with multiple subreports (hosting page reports) in it.Subreports do not support setting orientation.So, I looked at the 'ReportCombiner" class to merge pagereports of different orientation. Here again, page orientation of first report is applied. Is there a any way to achieve mixed orienantion in a single report or merge reports of diferent orientation (atleast any dev plans in pipeline)?

  • Posted 25 April 2021, 1:41 am EST

    Hello,

    Mixed orientation is not supported in the RDL report. You can only render the report in Portrait or Landscape mode. As workaround, You can convert the RDLX to RDF to fulfill your requirements.

    You can use the RDFRenderingExtension to convert your RDL report to RDF. Please refer to the following lines of code:

    GrapeCity.ActiveReports.PageReport pr = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(“…/…/PageReport1.rdlx”));

    System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@“C:\MyRDF”);

    outputDirectory.Create();

    GrapeCity.ActiveReports.Export.Rdf.RdfRenderingExtension re = new GrapeCity.ActiveReports.Export.Rdf.RdfRenderingExtension();

    GrapeCity.ActiveReports.Export.Rdf.Settings s = new GrapeCity.ActiveReports.Export.Rdf.Settings();

    GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider fs= new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));

    pr.Document.Render(re,fs,s);

    It is only generated report document from RDL report like Exported Document. You only need to export the report in RDF format using the above code.

    How could I merge the two after conversion?

    You can load the generated RDF file into the SectionDocument class using the “Load” method. After that, you can use the following lines of code to merge the report:

    for (i=0; i < SectionDocument1.Pages.Count; i++)

    {

    SectionDocument2.Document.Pages.Insert(i,SectionDocument1.Document.Pages[i]);

    }

    You can also refer to the following blog link for the detail:

    https://www.grapecity.com/blogs/how-to-create-pages-of-mixed-orientation-in-activereports/

    Hope it clarifies.

    Thanks,

    Mohit

  • Posted 25 April 2021, 10:18 pm EST

    Hello,

    Thanks for the suggestion. Follwed the steps & I am able to generate a report that is landscape on Page 1 & portrait on page 2.(see attached video). However, I am having issues with header. I need a common header/footer for all pages in the doc. I followed steps

    // main section report where I have defined haeder

    var mainSectionReport = ReportManager.Instance.AddMainSectionReport();

    // attachStream1 is the stream output from Rdf rendering for page report with

    // landscape orientation (Page 1 in attached video)

    var sectionReport1 = new SectionReport();

    sectionReport1.Document.Load(attachStream1);

    // attachStream1 is the stream output from Rdf rendering for page report with

    // portrait orientation (Page 2 in attached video)

    var sectionReport2 = new SectionReport();

    sectionReport2.Document.Load(attachStream2);

    // at this point the pagecount in mainSectionReport is zero

    // adding pages from two section reports to main section report mainSectionReport.Document.Pages.AddRange(sectionReport1.Document.Pages); mainSectionReport.Document.Pages.AddRange(sectionReport2.Document.Pages);

    //Loading document to see the report as in attached video

    Viewer.LoadDocument(mainSectionReport.Document);

    Now, I do not see the header defined in 'mainSectionReport".

    How can I get a common header/footer in the final doc?

    tMixed Page Orientation.zip

  • Posted 26 April 2021, 4:20 pm EST

    Hello,

    Can you add header and footer in both report separately so that it will be appear on both page after merging.

    Thanks,

    Mohit

  • Posted 26 April 2021, 7:29 pm EST

    Hello Mohit,

    Thanks for your suggestion. Yes, I have tried that & it works. But one of the items in the header or footer could be DateTime or Page Numer.

    a) The datetime should be same on all the pages. In this case, there is a pssooibility that different reports may get slightly different date/time. Maybe, this can be solved by storing the current system date//time before repprt geneartion & passing that as parmeter

    b) How can we ensure the running page numbers in the merged reports?

    c) Also, how to add TOC that reflects the assigned HaedeingLevel in the merged reports?

    Thanks,

    Narayanan

  • Posted 27 April 2021, 4:12 pm EST

    Hello,

    a) The datetime should be same on all the pages. In this case, there is a pssooibility that different reports may get slightly different date/time. Maybe, this can be solved by storing the current system date//time before repprt geneartion & passing that as parmeter

    b) How can we ensure the running page numbers in the merged reports?

    You can use the DrawText method SectionDocument to add the date and running page number on the page.

    https://www.grapecity.com/activereportsnet/docs/v15/online/GrapeCity.ActiveReports.Document~GrapeCity.ActiveReports.Document.Section.Page~DrawText.html?highlight=drawtext%2C

    c) Also, how to add TOC that reflects the assigned HaedeingLevel in the merged reports?

    Sorry it not possible to add TOC in the merged report in this case.

    Thanks,

    Mohit

  • Posted 27 April 2021, 5:44 pm EST

    Thanks Mohit for the support & hints. I guess TOC is something that our customers would expect. Do you think our use case of mixed orientation can be highlighted to your product team for consideration? In page reports, at subreport level if we can set the page orientation, it will be very helpful.

  • Posted 2 May 2021, 4:02 am EST

    Hello,

    I have escalated this to the PM team(AR-26496) and will inform you once I get any information from them.

    Thanks,

    Mohit

  • Posted 18 May 2021, 1:05 pm EST

    Since you’re building the portrait pages as one report and landscape pages as another report, and merging the two reports requires looping through each report’s page collection, you could build a third report for the TOC and insert that to the beginning of the report resulting from merging the portrait and landscape reports. Hope this helps.

  • Posted 18 May 2021, 9:24 pm EST

    Hello Steve,

    Thanks for the suggestion. I am not sure if the table of contents link to pages will be still functional (as they are rendered as different reports)? Also, the page numbering is lost. We have escalated this to the product team & they are looking at supporting this in their upcoming releases.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels