SSRS是否根据列中的大多数单元格类型动态设置表格单元格的对齐方式?(Does SSRS dynamically set the alignment of table cells based on t

编程入门 行业动态 更新时间:2024-10-27 09:41:20
SSRS是否根据列中的大多数单元格类型动态设置表格单元格的对齐方式?(Does SSRS dynamically set the alignment of table cells based on the majority of cell types in the column?)

这是我第一次遇到这种情况,但似乎SSRS根据列中大多数单元格的类型将text-align设置为所有单元格的一个值。 这种情况在BIDS中不会发生,仅在报告查看器中发生,但它可以在两个不同的服务器上重现。

我有单元格设置为System.Double类型的数据集项目或文本值“ - ”当Is Nothing评估为true =Iif(Fields!SLF.Value Is Nothing, "--", Fields!SLF.Value) 。 之前我从未注意到如果列中的大多数单元格都是Nothing,那么少数不是Nothing的对齐左边以及所有“ - ”文本项。 现在我也看到相反的列也是如此,如果列中的大多数单元格都是数值,那么一切都是正确对齐的,即使列中的几个“ - ”文本项也是如此。 我只使用Default TextAlign和VerticalAlign,没有Indent,SpaceAfter或SpaceBefore,也没有任何连接文本或嵌入保留空格。

SSRS宇宙中是否还有其他人看过这个,有没有人知道为什么或有一个好的解决方法呢? 谢谢!

This is the first time I've run into this, but it appears that SSRS is setting the text-align to one value for all cells based on the type of the majority of the cells in the column. This doesn't happen in BIDS, only in the report viewer, but it was reproducible on two different servers.

I have cells being set with either a dataset item of type System.Double or to the textual value of "--" when Is Nothing evaluates to true =Iif(Fields!SLF.Value Is Nothing, "--", Fields!SLF.Value). I never noticed before that if the majority of the cells in the column are Nothing, then the few that aren't Nothing get aligned to the left along with all of the "--" text items. And now I also see columns where the opposite is also true, where if the majority of the cells in the column are numeric values, then everything is aligned right, even the few "--" text items in the column. I'm only using Default TextAlign and VerticalAlign, and no Indent, SpaceAfter or SpaceBefore, nor any concatenated text or embedded preserved spaces.

Has anyone else in the SSRS universe seen this, and does anyone know why or have a good workaround for it? Thanks!

最满意答案

仅使用Default TextAlign属性值不起作用。 SSRS似乎没有及时检查值类型(当列中使用多个类型时。)我只是猜测它使用其他算法来根据列中的大多数类型确定使用哪个对齐。 但是我找到的一种解决方法是基于用于设置值的相同表达式显式设置TextAlign,这似乎与我期望属性一样有效。 所以,如果值设置如下: =Iif(Fields!SomeField.Value Is Nothing, "--", Fields!SomeField.Value

然后使用以下方法设置TextAlign: =Iif(Fields!SomeField.Value Is Nothing, "Default", "Default"

现在效果很好,文本左对齐,数值右对齐(en-US区域)。

Just using the Default TextAlign property value doesn't work. SSRS does not seem to check intime the values type (when multiple types are used in the column.) I'm only guessing that it uses some other algo to determine which alignment to use based on what the majority of types are in a column. But one way to work around it that I've found is to explicitly set the TextAlign based on the same expression used to set the value, and this seems to work as I was expecting the property to. So, if the value is set like this: =Iif(Fields!SomeField.Value Is Nothing, "--", Fields!SomeField.Value

Then set the TextAlign similarly with this: =Iif(Fields!SomeField.Value Is Nothing, "Default", "Default"

This works perfectly now, with text left aligned and numeric values right aligned (en-US region).

更多推荐

本文发布于:2023-07-30 06:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336694.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元格   表格   类型   方式   动态

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!