RDLC报表格式设置.doc_第1页
RDLC报表格式设置.doc_第2页
RDLC报表格式设置.doc_第3页
RDLC报表格式设置.doc_第4页
RDLC报表格式设置.doc_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

RDLC报表格式设置设置数字格式下表列出了常用的 .NET 数字格式设置字符串。格式字符串 名称C 或 c 货币D 或 d 小数E 或 e 科学记数法F 或 f 固定点G 或 g 常规N 或 n 数量P 或 p 百分比R 或 r 往返X 或 x 十六进制您可以将许多格式字符串修改为包含精度说明符,该说明符用于定义小数点后的位数。例如,格式设置字符串 D0 将数字格式设置为小数点后没有数字。您还可以使用自定义的格式设置字符串,例如 #,#。设置日期格式下表列出了常用的 .NET Framework 日期格式设置字符串。格式字符串 名称d 短日期2008.08.08D 长日期2008年08月08日t 短时间T 长时间f 完整日期/时间(短时间)F 完整日期/时间(长时间)g 常规日期/时间(短时间)2008.08.08 8:8G 常规日期/时间(长时间)M 或 m 月日R 或 r RFC1123 模式Y 或 y 年月您还可以使用自定义的格式设置字符串,例如 dd/MM/yy。有关 .NET Framework 格式设置字符串的详细信息,请参阅Formatting Types。例:说明:如果参考进价=100000,则保留1位小数,否则保留2位小数.=IIF(Fields!参考进价.Value=100000,F1 , F2) Public Sub Main() Display string representations of numbers for en-us culture Dim ci As New CultureInfo(en-us) Output floating point values Dim floating As Double = 10761.937554 Console.WriteLine(C: 0, _ floating.ToString(C, ci) Displays C: $10,761.94 Console.WriteLine(E: 0, _ floating.ToString(E03, ci) Displays E: 1.076E+004 Console.WriteLine(F: 0, _ floating.ToString(F04, ci) Displays F: 10761.9376 Console.WriteLine(G: 0, _ floating.ToString(G, ci) Displays G: 10761.937554 Console.WriteLine(N: 0, _ floating.ToString(N03, ci) Displays N: 10,761.938 Console.WriteLine(P: 0, _ (floating/10000).ToString(P02, ci) Displays P: 107.62 % Console.WriteLine(R: 0, _ floating.ToString(R, ci) Displays R: 10761.937554 Console.WriteLine() Output integral values Dim integral As Integer = 8395 Console.WriteLine(C: 0, _ integral.ToString(C, ci) Displays C: $8,395.00 Console.WriteLine(D: 0, _ integral.ToString(D6) Displays D: 008395 Console.WriteLine(E: 0, _ integral.ToString(E03, ci) Displays E: 8.395E+003 Console.WriteLine(F: 0, _ integral.ToString(F01, ci) Displays F: 8395.0 Console.WriteLine(G: 0, _ integral.ToString(G, ci) Displays G: 8395 Console.WriteLine(N: 0, _ integral.ToString(N01, ci) Displays N: 8,395.0 Console.WriteLine(P: 0, _ (integral/10000).ToString(P02, ci) Displays P: 83.95 % Console.WriteLine(X: 0x0, _ integral.ToString(X, ci) Displays X: 0x20CB Console.WriteLine() End Sub Public Shared Sub Main() Dim msgShortDate As String = (d) Short date: . . . . . . . Dim msgLongDate As String = (D) Long date:. . . . . . . . Dim msgShortTime As String = (t) Short time: . . . . . . . Dim msgLongTime As String = (T) Long time:. . . . . . . . Dim msgFullDateShortTime As String = _ (f) Full date/short time: . . Dim msgFullDateLongTime As String = _ (F) Full date/long time:. . . Dim msgGeneralDateShortTime As String = _ (g) General date/short time:. Dim msgGeneralDateLongTime As String = _ (G) General date/long time (default): & vbCrLf & _ . . . . . . . . . . . . . Dim msgMonth As String = (M) Month:. . . . . . . . . . Dim msgRFC1123 As String = (R) RFC1123:. . . . . . . . . Dim msgSortable As String = (s) Sortable: . . . . . . . . Dim msgUniSortInvariant As String = _ (u) Universal sortable (invariant): & vbCrLf & _ . . . . . . . . . . . . . Dim msgUniFull As String = (U) Universal full date/time: Dim msgYear As String = (Y) Year: . . . . . . . . . . Dim msgRoundtripLocal As String = (o) Roundtrip (local):. . . . Dim msgRoundtripUTC As String = (o) Roundtrip (UTC):. . . . . Dim msgRoundtripUnspecified As String = (o) Roundtrip (Unspecified):. Dim msg1 As String = Use ToString(String) and the current thread culture. & vbCrLf Dim msg2 As String = Use ToString(String, IFormatProvider) and a specified culture. & vbCrLf Dim msgCulture As String = Culture: Dim msgThisDate As String = This date and time: 0 & vbCrLf Dim thisDate As DateTime = DateTime.Now Dim utcDate As DateTime = thisDate.ToUniversalTime() Dim unspecifiedDate As DateTime = new DateTime(2000, 3, 20, 13, 2, 3, 0, DateTimeKind.Unspecified) Dim ci As CultureInfo Format the current date and time in various ways. Console.Clear() Console.WriteLine(Standard DateTime Format Specifiers: & vbCrLf) Console.WriteLine(msgThisDate, thisDate) Console.WriteLine(msg1) Display the thread current culture, which is used to format the values. ci = Thread.CurrentThread.CurrentCulture Console.WriteLine(0,-301 & vbCrLf, msgCulture, ci.DisplayName) Console.WriteLine(msgShortDate & thisDate.ToString(d) Console.WriteLine(msgLongDate & thisDate.ToString(D) Console.WriteLine(msgShortTime & thisDate.ToString(t) Console.WriteLine(msgLongTime & thisDate.ToString(T) Console.WriteLine(msgFullDateShortTime & thisDate.ToString(f) Console.WriteLine(msgFullDateLongTime & thisDate.ToString(F) Console.WriteLine(msgGeneralDateShortTime & thisDate.ToString(g) Console.WriteLine(msgGeneralDateLongTime & thisDate.ToString(G) Console.WriteLine(msgMonth & thisDate.ToString(M) Console.WriteLine(msgRFC1123 & utcDate.ToString(R) Console.WriteLine(msgSortable & thisDate.ToString(s) Console.WriteLine(msgUniSortInvariant & utcDate.ToString(u) Console.WriteLine(msgUniFull & thisDate.ToString(U) Console.WriteLine(msgYear & thisDate.ToString(Y) Console.WriteLine(msgRoundtripLocal & thisDate.ToString(o) Console.WriteLine(msgRoundtripUTC & utcDate.ToString(o) Console.WriteLine(msgRoundtripUnspecified & unspecifiedDate.ToString(o) Console.WriteLine() Display the same values using a CultureInfo object. The CultureInfo class implements IFormatProvider. Console.WriteLine(msg2) Display the culture used to format the values. ci = New CultureInfo(de-DE) Console.WriteLine(0,-301 & vbCrLf, msgCulture, ci.DisplayName) Console.WriteLine(msgShortDate & thisDate.ToString(d, ci) Console.WriteLine(msgLongDate & thisDate.ToString(D, ci) Console.WriteLine(msgShortTime & thisDate.ToString(t, ci) Console.WriteLine(msgLongTime & thisDate.ToString(T, ci) Console.WriteLine(msgFullDateShortTime & thisDate.ToString(f, ci) Console.WriteLine(msgFullDateLongTime & thisDate.ToString(F, ci) Console.WriteLine(msgGeneralDateShortTime & thisDate.ToString(g, ci) Console.WriteLine(msgGeneralDateLongTime & thisDate.ToString(G, ci) Console.WriteLine(msgMonth & thisDate.ToString(M, ci) Console.WriteLine(msgRFC1123 & utcDate.ToString(R, ci) Console.WriteLine(msgSortable & thisDate.ToString(s, ci) Console.WriteLine(msgUniSortInvariant & utcDate.ToString(u, ci) Console.WriteLine(msgUniFull & thisDate.ToString(U, ci) Console.WriteLine(msgYear & thisDate.ToString(Y, ci) Console.WriteLine(msgRoundtripLocal & thisDate.ToString(o), ci) Console.WriteLine(msgRoundtripUTC & utcDate.ToString(o), ci) Console.WriteLine(msgRoundtripUnspecified & unspecifiedDate.ToString(o), ci) Console.WriteLine() End Sub MainEnd Class SampleThis code example produces the following results:Standard DateTime Format Specifiers:This date and time: 4/17/2006 2:29:09 PMUse ToString(String) and the current thread culture.Culture: English (United States)(d) Short date: . . . . . . . 4/17/2006(D) Long date:. . . . . . . . Monday, April 17, 2006(t) Short time: . . . . . . . 2:29 PM(T) Long time:. . . . . . . . 2:29:09 PM(f) Full date/short time: . . Monday, April 17, 2006 2:29 PM(F) Full date/long time:. . . Monday, April 17, 2006 2:29:09 PM(g) General date/short time:. 4/17/2006 2:29 PM(G) General date/long time (default): . . . . . . . . . . . . . 4/17/2006 2:29:09 PM(M) Month:. . . . . . . . . . April 17(R) RFC1123:. . . . . . . . . Mon, 17 Apr 2006 21:29:09 GMT(s) Sortable: . . . . . . . . 2006-04-17T14:29:09(u) Universal sortable (invariant): . . . . . . . . . . . . . 2006-04-17 21:29:09Z(U) Universal full date/time: Monday, April 17, 2006 9:29:09 PM(Y) Year: . . . . . . . . . . April, 2006(o) Roundtrip (local):. . . . 2006-04-17T14:29:09.3011250-07:00(o) Roundtrip (UTC):. . . . . 2006-04-17T21:29:09.3011250Z(o) Roundtrip (Unspecified):. 2000-03-20T13:02:03.0000000Use ToString(String, IFormatProvider) and a specified culture.Culture: German (Germany)(d) Short date: . . . . . . . 17.04.2006(D) Long date:. . . . . . . . Montag, 17. April 2006(t) Short time: . . . . . . . 14:29(T) Long time:. . . . . . . . 14:29:09(f) Full date/short time: . . Montag, 17. April 2006 14:29(F) Full date/long time:. . . Montag, 17. April 2006 14:29:09(g) General date/short time:. 17.04.2006 14:29(G) General date/long time (default): . . . . . . . . . . . . . 17.04.2006 14:29:09(M) Month:. . . . . . . . . . 17 April(R) RFC1123:. . . . . . . . . Mon, 17 Apr 2006 21:29:09 GMT(s) Sortable: . . . . . . . . 2006-04-17T14:29:09(u) Universal sortable (invariant): . . . . . . . . . .

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论