我正在尝试找出 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/