Symptom
When using the ‘Save to Excel’ option in Reporting Services, the
resulting Excel file produces the following error when you try to open
it:
“File Error: Data may have been lost”
This typically happens when the report is very complex and contains a
lot of data or images.
Explanation
When a user clicks on the ‘Save to Excel’ button, the server generates
an Excel file and sends this file to the user in a single HTTP packet.
By default, the server will limit the size of this HTTP packet according
to the maxRequestLength property in the
web.config file (this is set to 4096KB by
default). If the Excel file is very large, the end of the file becomes
clipped, and data is lost.
Resolution
To resolve this issue, open the web.config file and set the
httpRuntime.maxRequestLength property to a larger number (in the
following example it's doubled to 8MB):
<configuration>
<system.web>
<httpRuntime maxRequestLength="8192"/>
</system.web>
</configuration>
This sets the maximum HTTP packet size (in KB) and lets the server
send larger, more complex files.
Note:
If the <httpRuntime> element already
exists in the web.config file, for example:
>httpRuntime executionTimeout="9000"/>
Then you will want to add the maxRequestLength attribute like this:
<httpRuntime executionTimeout="9000" maxRequestLength="8192"/>
|