Creating report with Excel Format Footer

2 Answers 193 Views
Rendering Report Designer (standalone)
Jan
Top achievements
Rank 1
Iron
Jan asked on 13 Jun 2022, 08:40 AM

Hi,

we have troubles with the excel report creation. We defined a footer with a left, middle and right textbox which renders correctly in a PDF [pdf-Screenshot 2022-06-13 103500.png] but in Excel it renders the left and middle textbox in the left footer in Excel [excel-footer-Screenshot 2022-06-13 103646.png]. Additionally the height of the footer seems to be wrong because the margins won't be setup correctly [excel-height-Screenshot 2022-06-13 103622.png].

This is the code we use to create the reports:


        private static byte[] Render(ReportFormat format, ReportData values)
        {
            var serializerSettings = new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            var jsonValues = JsonConvert.SerializeObject(values, serializerSettings);
            var reportPath = Configuration.AppSettings.Read("ReportPath");
            var uriReportSource = new UriReportSource
            {
                Uri = reportPath,
            };
            uriReportSource.Parameters.Add("Parameter1", jsonValues);
            var r = new ReportProcessor();

            var formatString = format switch
            {
                ReportFormat.Excel => "XLSX",
                ReportFormat.Pdf   => "PDF"
            };

            var result = r.RenderReport(formatString, uriReportSource, new Hashtable());
            return result.DocumentBytes;
        }

Greetings

Jan



2 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 16 Jun 2022, 06:20 AM

Hi Jan,

I tested locally and managed to reproduce the issue when the middle TextBox location started from the first third of the PageFooter width. This forced the Reporting engine to place it in the left part of the footer.

When I placed the middle TextBox to start from the middle part of the PageFooter, which means within the second third of the page width, the text was displayed in the middle of the Excel document footer.

The above behavior is by design with the default value of UseNativePageFooter and you may read more details in the article section Excel Rendering - Page Headers and Footers.

The workaround is to reduce the width of the middle TextBox and move it so that it falls in the middle of the page width.

Regards,
Todor
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
0
Jan
Top achievements
Rank 1
Iron
answered on 20 Jun 2022, 08:07 AM

Hi Todor,

thanks for the help! I will try it today. Did you have any chance to have a look at the height rendering problem as shown in [excel-height-Screenshot 2022-06-13 103622.png]?

Regards,

Jan

 

Todor
Telerik team
commented on 23 Jun 2022, 07:47 AM

Hello Jan,

Indeed, when you use native Page Footer, its content may not appear as designed. The reason is that we don't have full control over the native page footer layout.

I tested locally with different PageSettings, for example, I changed the Margins and can confirm that the height of the native page footer varied based on this. Feel free to log this behavior as a problem in our public feedback portal.

The workaround would be to use a non-native Page Footer.

Tags
Rendering Report Designer (standalone)
Asked by
Jan
Top achievements
Rank 1
Iron
Answers by
Todor
Telerik team
Jan
Top achievements
Rank 1
Iron
Share this question
or