Microsoft Reporting WebForms报表查看器 - 导出到Excel

时间:2021-06-01 08:15:07

I have a report viewer that I am using to export to PDF and Excel. Sometimes some of the data in the tables is longer than a singular line.

我有一个报表查看器,我用它来导出到PDF和Excel。有时表中的某些数据比单数行长。

When exported to PDF the fields that need more height are automatically given it. Yet when I export to excel it remains in the original height and doesn't grow to display all the data.

导出为PDF时,会自动给出需要更多高度的字段。然而,当我导出到excel时,它仍保持原始高度,并且不会增长以显示所有数据。

I want the cell heights to automatically grow to display all the data on screen. I have set CanGrow to true but this has no effect (apart from working when exporting to PDF).

我希望单元格高度自动增长以显示屏幕上的所有数据。我已将CanGrow设置为true但这没有效果(除了导出为PDF时的工作)。

Has anyone had this problem before and can share a resolution?

有没有人之前有这个问题,可以分享一个决议?

Thanks

谢谢

1 个解决方案

#1


0  

OK, after not receiving any answers I delved in to this one myself.

好的,在没有收到任何答案后,我自己钻研了这个。

It appears that text doesn't wrap in excel when the cell is a number of merged cells together.

当单元格是多个合并的单元格时,文本似乎不会在excel中换行。

So in the report viewer if all text areas and items aren't lined up with one another or if one is twice as long as two others then they will be placed in merged cells to make up for the crossover.

因此,在报表查看器中,如果所有文本区域和项目没有相互排列,或者如果一个文本区域和项目的长度是另外两个文件的两倍,那么它们将被放置在合并的单元格中以弥补交叉。

It means that the chances are these isn't a solution to the problem, unless all your text areas are identical in width or you can alter the layout so that those that require wrapping to new lines will only take up a single cell.

这意味着这些问题很可能不是问题的解决方案,除非所有文本区域的宽度相同或者您可以更改布局,以便需要换行到新行的那些只占用一个单元格。

I done this by putting everything in a table, and knowing that if I merged any cells then text wrapping would not be possible.

我通过将所有内容放在一个表中来完成此操作,并且知道如果我合并了任何单元格,则无法进行文本换行。

I hope this will help someone out there!

我希望这能帮助那里的人!

#1


0  

OK, after not receiving any answers I delved in to this one myself.

好的,在没有收到任何答案后,我自己钻研了这个。

It appears that text doesn't wrap in excel when the cell is a number of merged cells together.

当单元格是多个合并的单元格时,文本似乎不会在excel中换行。

So in the report viewer if all text areas and items aren't lined up with one another or if one is twice as long as two others then they will be placed in merged cells to make up for the crossover.

因此,在报表查看器中,如果所有文本区域和项目没有相互排列,或者如果一个文本区域和项目的长度是另外两个文件的两倍,那么它们将被放置在合并的单元格中以弥补交叉。

It means that the chances are these isn't a solution to the problem, unless all your text areas are identical in width or you can alter the layout so that those that require wrapping to new lines will only take up a single cell.

这意味着这些问题很可能不是问题的解决方案,除非所有文本区域的宽度相同或者您可以更改布局,以便需要换行到新行的那些只占用一个单元格。

I done this by putting everything in a table, and knowing that if I merged any cells then text wrapping would not be possible.

我通过将所有内容放在一个表中来完成此操作,并且知道如果我合并了任何单元格,则无法进行文本换行。

I hope this will help someone out there!

我希望这能帮助那里的人!