SubReport truncated if export (by code) to RTF

4 posts, 1 answers
  1. Dario Concilio
    Dario Concilio avatar
    180 posts
    Member since:
    Apr 2016

    Posted 29 Mar Link to this post

    Hi to all,

    something strange happens to me.

    I have a report that contains a subreport. Subreport generates several records, each record is 1/4 tall of an A4 page.

    If I try to render report into Visual Studio 2017 I see all correct, and if I try to save in RTF format it generates all.

    But if I try to generate RTF file by code, if I open rtf file with Word content of subreport is truncated after some records.

    What's happend?

    01.public static Bundle SaveAsWord(string fileName, Bundle pBundle)
    02.        {
    03.            Bundle bundle = new Bundle();
    04. 
    05.            try
    06.            {
    07.                //Create new CultureInfo
    08.                var cultureInfo = new System.Globalization.CultureInfo(pBundle.Get(2).ToString());
    09. 
    10.                // Set the language for static text (i.e. column headings, titles)
    11.                System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;
    12. 
    13.                // Set the language for dynamic text (i.e. date, time, money)
    14.                System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
    15. 
    16.                Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
    17. 
    18.                // set any deviceInfo settings if necessary
    19.                System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
    20. 
    21.                Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
    22. 
    23.                // reportName is the Assembly Qualified Name of the report
    24.                typeReportSource.TypeName = typeof(OffertaVenditaBrema).AssemblyQualifiedName;
    25.                typeReportSource.Parameters.Add("NumeroOfferta", pBundle.Get(1).ToString());
    26.                typeReportSource.Parameters.Add("MostraPrezziListino", pBundle.Get(3).ToString());
    27.                typeReportSource.Parameters.Add("MostraPrezziNetti", pBundle.Get(4).ToString());
    28.                typeReportSource.Parameters.Add("SfondoGrigio", pBundle.Get(5).ToString());
    29.                typeReportSource.Parameters.Add("TestoBianco", pBundle.Get(6).ToString());
    30.                typeReportSource.Parameters.Add("MostraTabellaPrezzi", pBundle.Get(7).ToString());
    31. 
    32.                Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("RTF", typeReportSource, deviceInfo);
    33. 
    34.                //string fileName = result.DocumentName + "." + result.Extension;
    35.                string path = System.IO.Path.GetTempPath();
    36.                string filePath = System.IO.Path.Combine(path, fileName);
    37. 
    38.                using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
    39.                    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
    40. 
    41.                bundle.Add(1, true);
    42.                bundle.Add(2, filePath);
    43.            }
    44.            catch (Exception ex)
    45.            {
    46.                bundle.Add(1, false);
    47.                bundle.Add(2, ex.Message);
    48.                bundle.Add(3, ex.StackTrace.ToString());
    49.            }
    50. 
    51.            return bundle;
    52.        }

     

  2. Dario Concilio
    Dario Concilio avatar
    180 posts
    Member since:
    Apr 2016

    Posted 29 Mar in reply to Dario Concilio Link to this post

    I have a doubt, a subreport can be divided into 2 pages?

  3. Dario Concilio
    Dario Concilio avatar
    180 posts
    Member since:
    Apr 2016

    Posted 29 Mar in reply to Dario Concilio Link to this post

    More info: if I try to export with DOCX format, rendering is correct. in RTF no.

  4. Answer
    Silviya
    Admin
    Silviya avatar
    176 posts

    Posted 03 Apr Link to this post

    Hi Dario,

    In general, my assumption is that the filled data after getting the report parameters programmatically is not all report's data and this may cause different amount of pages after exporting. Also, double check if the Page Width and Height are less than 22 inches. If the report grows more than the page width, the page will be automatically expanded to accommodate the report if possible.

    Check the Design Considerations for RTF Rendering (Paging section) help article where are listed the limitations and the expected behavior when exporting to RTF format. 

    I experimented with a test report, the Invoice report from our examples. However, it seems both exported formats are work as expected on my side.
    If the problem still persist, we would need a sample report definition that demonstrates the issue in order to be able to investigate further. You can attach it in a new support ticket.

    Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top