Use comma for decimals and period for thousands rd

2019-07-07 00:10发布

问题:

I'm using Report Viewer Control (rdlc) to generate reports. One of my columns represent a decimal value from a SQL database, for example:

5199.9800 

and at the end of this column, all the amounts are summed. So, the amounts rows are represented this way:

 =Fields!DEBIT.Value 

And the total row is represented this way:

 =Sum(CDbl(Fields!DEBIT.Value), "dtsItems")

Currently all the values are formatted in the standard way, using comma for thousands and period for decimals like this:

  5,199.98      

but i need to format it the opposite way: using period for thousands and comma for decimals, like this:

   5.199,98 

I've been searching for a way to do it with an expression or just changing the TextBox properties in the rdlc file, but nothing seems to work.

回答1:

Maybe try using Excel style masks? It would be something like this:

=Format(CDbl(Fields!DEBIT.Value), "#.###,##")

Or you can convert it to a string and use the all the goodness of a string.format, but you lose sorting.

Another related solution: What are the valid Style Format Strings for a Reporting Services [SSRS] Expression?



回答2:

First select object with expression, usually text box and in properties find property Format and enter this: #,0.00;(#,0.00) Somewhere below format find Language property and set to hr-HR (this is for Croatia Republic). That's all... Works for me!