reporting-services - Reporting Services [SSRS] 表达式的有效样式格式字符串是什么?

标签 reporting-services formatting

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

相关文章:

java - 如何以安全的方式将 Double 从 1234567 格式化为 1 234.567

matrix - SSRS如何获取矩阵行组的第一个和最后一个值?

sql-server-2008 - 将 SSRS 中的特定文本加粗

.net - VB.Net : How to use an Object data source in report (. RDLC)

c# - 如何格式化 DateTime 或 TimeZone/TimeZoneInfo 以显示三个字母?

python - 使用 Python 将 Excel 转换为 JSON,如何根据需要格式化这些数据?

c - C 中带有前导零的“printf”

sql - 需要将前一天的日期类型与整数值进行比较

reporting-services - SSRS 查找函数返回#Error

c# - 如何格式化日期以两行显示?