是什么原因导致Excel从SQL Server Reporting Services导出以生成异常大的文件?

时间:2022-03-01 08:15:38

We have are relatively simple Reporting Services report that our users commonly export to Excel. I've noticed that the files produced by the Excel export seem unusually large. If I open one of these files and just click save, without making any changes, the file size reduces to about half of it's previous size. Has anyone else run into this and is there a known workaround?

我们有相对简单的Reporting Services报告,我们的用户通常会将其导出到Excel。我注意到Excel导出生成的文件看起来异常大。如果我打开其中一个文件,只需单击“保存”而不进行任何更改,文件大小将减少到之前大小的一半。有没有其他人遇到这个并且有一个已知的解决方法?

5 个解决方案

#1


2  

You've mentioned that the report is relatively simple, but this is important to check. The export to Excel will go to extraordinary lengths to try and maintain how your report looks.

您已经提到报告相对简单,但这一点非常重要。导出到Excel将花费大量时间来尝试和维护报表的外观。

If you have lots of different borders or colours (particularly if different formatting is determined by the data in your report) this will bloat the file.

如果您有许多不同的边框或颜色(特别是如果报表中的数据确定了不同的格式),这将使文件膨胀。

Also check if many columns with very small and unusual sizes are created in the exported worksheet. The export does this to try and match alignment in Excel with the original report.

还要检查导出的工作表中是否创建了许多具有非常小且不寻常大小的列。导出执行此操作以尝试将Excel中的对齐与原始报表匹配。

Try recreating your report as a basic table with no formatting or headers/footers and see if you can reproduce the problem. If Excel's behaviour is acceptable then add each piece of formatting back until it goes awry. Please let us know what you find.

尝试将报表重新创建为基本表格,没有格式或页眉/页脚,看看是否可以重现问题。如果Excel的行为可以接受,则将每个格式都添加回去,直到它出错。请告诉我们您的发现。

#2


1  

I don't have an immediate solution, but a common problem in Excel is files bloating because one/some/all of the worksheets have saved all 64K rows instead of the ones being used. The fix in Excel is to select all the lower rows not being used, and delete them, then save the spreadsheet, close and reopen. Therefore, I'd pursue the angle of extra rows being saved in the export, and see if there is a way to keep this from happening.

我没有立即解决方案,但Excel中的常见问题是文件膨胀,因为一个/部分/全部工作表已保存所有64K行而不是正在使用的行。 Excel中的修复是选择所有未使用的较低行,然后删除它们,然后保存电子表格,关闭并重新打开。因此,我将追求在导出中保存额外行的角度,并查看是否有办法防止这种情况发生。

#3


0  

What tool are you using when exporting to Excel?

导出到Excel时使用的是什么工具?

I have also managed to reduce # of rows in my Excel worksheet by copying it to another worksheet, then deleting the original sheet.

我还设法通过将其复制到另一个工作表,然后删除原始工作表来减少Excel工作表中的行数。

You could also try copying only the data in your worksheet, and paste it into a new Excel Workbook (file).

您还可以尝试仅复制工作表中的数据,并将其粘贴到新的Excel工作簿(文件)中。

#4


0  

I had the issue where the exported Excel files took and extremely long to open and they would stop responding every time you clicked on a cell.

我遇到导出的Excel文件占用的问题,并且打开的时间非常长,并且每次单击单元格时它们都会停止响应。

Also, extra and merged columns would appear in exported excel files.

此外,额外和合并的列将出现在导出的Excel文件中。

The fix was to make sure my header text boxes lined up with the beginning and end of columns in the data table just below it. Once both were aligned, there were no more extra columns in the exported excel spreadsheets and the performance was back to normal.

修复是为了确保我的标题文本框与数据表正下方的列的开头和结尾对齐。两者对齐后,导出的Excel电子表格中不再有额外的列,性能恢复正常。

Here's the reference that helped me understand the issue: http://www.codegur.press/12747988/issue-report-export-to-excel-in-rdlc-report

以下是帮助我理解该问题的参考资料:http://www.codegur.press/12747988/issue-report-export-to-excel-in-rdlc-report

#5


-1  

May be I am answering your question very late. Here's the solution for exporting to CSV.

可能是我很晚才回答你的问题。这是导出为CSV的解决方案。

You need to give the a name that you want to see as a column header for the field (not the column name) in the designer.

您需要在设计器中为要显示的字段(而不是列名称)的列标题指定一个名称。

By default all the text headers are exported as a separate columns along with the table columns and make sure that you name the Design name in the properties with the name you want to see.

默认情况下,所有文本标题都将作为单独的列与表列一起导出,并确保在属性中使用要查看的名称命名设计名称。

The other important thing to note about the option DataElementOutput which is set to Auto meaning it will be exported. You can change that if you don't want it to be exported.

关于DataElementOutput选项的另一个重要注意事项是设置为Auto意味着它将被导出。如果您不希望导出它,可以更改它。

The last but not least thing ... after you export the data looks messed up. You need select the whole first column and go to the Data tab - > convert text to column -> use the delimiter as comma and say Finish. That should solve your issue.

最后但并非最不重要的事情......导出数据后看起来搞砸了。您需要选择整个第一列并转到数据选项卡 - >将文本转换为列 - >使用分隔符作为逗号并说完。这应该可以解决你的问题。

#1


2  

You've mentioned that the report is relatively simple, but this is important to check. The export to Excel will go to extraordinary lengths to try and maintain how your report looks.

您已经提到报告相对简单,但这一点非常重要。导出到Excel将花费大量时间来尝试和维护报表的外观。

If you have lots of different borders or colours (particularly if different formatting is determined by the data in your report) this will bloat the file.

如果您有许多不同的边框或颜色(特别是如果报表中的数据确定了不同的格式),这将使文件膨胀。

Also check if many columns with very small and unusual sizes are created in the exported worksheet. The export does this to try and match alignment in Excel with the original report.

还要检查导出的工作表中是否创建了许多具有非常小且不寻常大小的列。导出执行此操作以尝试将Excel中的对齐与原始报表匹配。

Try recreating your report as a basic table with no formatting or headers/footers and see if you can reproduce the problem. If Excel's behaviour is acceptable then add each piece of formatting back until it goes awry. Please let us know what you find.

尝试将报表重新创建为基本表格,没有格式或页眉/页脚,看看是否可以重现问题。如果Excel的行为可以接受,则将每个格式都添加回去,直到它出错。请告诉我们您的发现。

#2


1  

I don't have an immediate solution, but a common problem in Excel is files bloating because one/some/all of the worksheets have saved all 64K rows instead of the ones being used. The fix in Excel is to select all the lower rows not being used, and delete them, then save the spreadsheet, close and reopen. Therefore, I'd pursue the angle of extra rows being saved in the export, and see if there is a way to keep this from happening.

我没有立即解决方案,但Excel中的常见问题是文件膨胀,因为一个/部分/全部工作表已保存所有64K行而不是正在使用的行。 Excel中的修复是选择所有未使用的较低行,然后删除它们,然后保存电子表格,关闭并重新打开。因此,我将追求在导出中保存额外行的角度,并查看是否有办法防止这种情况发生。

#3


0  

What tool are you using when exporting to Excel?

导出到Excel时使用的是什么工具?

I have also managed to reduce # of rows in my Excel worksheet by copying it to another worksheet, then deleting the original sheet.

我还设法通过将其复制到另一个工作表,然后删除原始工作表来减少Excel工作表中的行数。

You could also try copying only the data in your worksheet, and paste it into a new Excel Workbook (file).

您还可以尝试仅复制工作表中的数据,并将其粘贴到新的Excel工作簿(文件)中。

#4


0  

I had the issue where the exported Excel files took and extremely long to open and they would stop responding every time you clicked on a cell.

我遇到导出的Excel文件占用的问题,并且打开的时间非常长,并且每次单击单元格时它们都会停止响应。

Also, extra and merged columns would appear in exported excel files.

此外,额外和合并的列将出现在导出的Excel文件中。

The fix was to make sure my header text boxes lined up with the beginning and end of columns in the data table just below it. Once both were aligned, there were no more extra columns in the exported excel spreadsheets and the performance was back to normal.

修复是为了确保我的标题文本框与数据表正下方的列的开头和结尾对齐。两者对齐后,导出的Excel电子表格中不再有额外的列,性能恢复正常。

Here's the reference that helped me understand the issue: http://www.codegur.press/12747988/issue-report-export-to-excel-in-rdlc-report

以下是帮助我理解该问题的参考资料:http://www.codegur.press/12747988/issue-report-export-to-excel-in-rdlc-report

#5


-1  

May be I am answering your question very late. Here's the solution for exporting to CSV.

可能是我很晚才回答你的问题。这是导出为CSV的解决方案。

You need to give the a name that you want to see as a column header for the field (not the column name) in the designer.

您需要在设计器中为要显示的字段(而不是列名称)的列标题指定一个名称。

By default all the text headers are exported as a separate columns along with the table columns and make sure that you name the Design name in the properties with the name you want to see.

默认情况下,所有文本标题都将作为单独的列与表列一起导出,并确保在属性中使用要查看的名称命名设计名称。

The other important thing to note about the option DataElementOutput which is set to Auto meaning it will be exported. You can change that if you don't want it to be exported.

关于DataElementOutput选项的另一个重要注意事项是设置为Auto意味着它将被导出。如果您不希望导出它,可以更改它。

The last but not least thing ... after you export the data looks messed up. You need select the whole first column and go to the Data tab - > convert text to column -> use the delimiter as comma and say Finish. That should solve your issue.

最后但并非最不重要的事情......导出数据后看起来搞砸了。您需要选择整个第一列并转到数据选项卡 - >将文本转换为列 - >使用分隔符作为逗号并说完。这应该可以解决你的问题。