reporting-services - Reporting Services [SSRS] 表达式

我正在尝试找出 Reporting Services 表达式中 Format(Expression as Object, Style as String) 函数的样式字符串。

我找不到这些样式格式字符串的记录位置!

具体来说,我正在尝试将价格字段格式化为始终保留 2 位小数。

即 1.5 格式到 $1.50

最佳答案

货币格式格式化字符串

=Format(Fields!Price.Value, "C")

它会给你 2 位小数,前缀为“$”。

您可以在 MSDN 上找到其他格式字符串:Adding Style and Formatting to a ReportViewer Report

注意:MSDN 文章已归档到“VS2005_General”文档,不再可直接在线访问。以下是引用的格式化字符串的摘录:

Formatting Numbers

The following table lists common .NET Framework number formatting strings.

Format string, Name

C or c Currency

D or d Decimal

E or e Scientific

F or f Fixed-point

G or g General

N or n Number

P or p Percentage

R or r Round-trip

X or x Hexadecimal

You can modify many of the format strings to include a precision specifier that defines the number of digits to the right of the

decimal point. For example, a formatting string of D0 formats the number so that it has no digits after the decimal point. You

can also use custom formatting strings, for example, #,###.

Formatting Dates

The following table lists common .NET Framework date formatting strings.

Format string, Name

d Short date

D Long date

t Short time

T Long time

f Full date/time (short time)

F Full date/time (long time)

g General date/time (short time)

G General date/time (long time)

M or m Month day

R or r RFC1123 pattern

Y or y Year month

You can also a use custom formatting strings; for example, dd/MM/yy. For more information about .NET Framework formatting strings, see Formatting Types.

关于reporting-services - Reporting Services [SSRS] 表达式的有效样式格式字符串是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/922506/

相关文章:

eclipse - 如何在 Eclipse 中禁用保存时自动格式化?

c# - ToString ("N2") 和 ToString ("0.00") 之间的区别

perl - Perl 中的今天日期,格式为 MM/DD/YYYY

php - $SimpleXML->asXML() 的格式输出;

.net - 如何使用缩写的时区显示 DateTime?

ruby-on-rails - Rails(或 Ruby): Yes/No instead of T

visual-studio - Razor Helper 语法自动格式化丑陋。怎么修?

sql-server - SSMS 结果到网格 - CRLF 未保留在复制/粘贴中 - 有更好的技术

php - 在 PHP 中获取货币符号

visual-studio-code - 如何格式化 Visual Studio Code 项目中的