'An error occurred during local report processing.' - SSRS Excel Rendering throws error

Mukil Vendhan 1 Reputation point
2022-12-16T10:49:57.307+00:00

ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

StackTrace "at
System.Text.StringBuilder.ToString(Int32 startIndex, Int32 length)\r\n
at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.OpenXmlGenerator.GetUsablePortionOfHeaderFooterString(String candidate, Int32& spaceRemaining)\r\n
at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.OpenXmlGenerator.AddFooter(String left, String center, String right)\r\n
at Microsoft.ReportingServices.Rendering.ExcelRenderer.Layout.LayoutEngine.RenderPageToExcel(IExcelGenerator excel, String key, Dictionary2 sharedBorderCache, Dictionary2 sharedImageCache)\r\n
at Microsoft.ReportingServices.Rendering.ExcelRenderer.MainEngine.RenderRPLPage(RPLReport report, Boolean headerInBody, Boolean suppressOutlines)\r\n
at Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)" string

I have several report with export type excel. One particular report is throwing this error when I try to export.Other reports are working fine
How to resolve this issue? Thanks in advance

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,061 questions
Developer technologies | C#
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2022-12-16T22:44:03.477+00:00

    The error indicates an issue rendering the footer. Specifically while trying to render the footer it failed because when it tried to get the footer text it used an invalid length. My guess is that GetUsablePortionOfHeaderFooterString is attempting to parse the footer string and it is failing because of the value. I would start by setting your footer to empty and see if the issue goes away. If it does then take a closer look at the footer expression you're using.

    0 comments No comments

  2. Anonymous
    2022-12-19T02:09:18.353+00:00

    Hi @Mukil Vendhan
    From what I've searched, it's possible that this is an issue with the number of characters in the string in the footer. Have you added expressions or text boxes to the footer? If there is, please delete it to check whether it is causing the error. If it's causing the error, try modifying it.
    For more details, you can refer to this link: exporting-into-excel-issue-in-2012-ssrs-length-cannot-be-less-than-zero.
    Best regards,
    Aniya

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.