How to write code to reduce excel file size during export data from Grid view to excel in aspx page?
I have more than 2 Lcs data.
Thanks in advance.
How to write code to reduce excel file size during export data from Grid view to excel in aspx page?
I have more than 2 Lcs data.
Thanks in advance.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tuhin PaulPosted Mar 26, 2023, 3:27 AM
Check the code:
Tuhin PaulPosted Mar 26, 2023, 3:26 AM
Remove any unnecessary data such as formatting or styling information, images, or other non-essential data that is not needed in the Excel file. This can be achieved by setting the GridView properties such as AutoFormat, CssClass, HeaderStyle, and RowStyle to false.Also Limit the number of rows and columns exported to Excel by setting the AllowPaging property of the GridView to false and setting the PageSize property to a smaller value.
BONUS: Try compress the output using libraries such as SharpZipLib or DotNetZip. These libraries provide classes to compress and decompress files and streams.