Search
Active

1
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Suggestion
ID: 507656
Opened: 11/2/2009 12:37:00 PM
Access Restriction: Public
0
Workaround(s)
I need to use Format() for numeric fields in my report to get the correct format needed for number and currency fields. I have all textboxes set to use a format of C, N, or P but I cannot just use the default .Net format codes because I need to support other formats (no group separator, not show currency symbols for come currency fields, show zero as blank, etc.

When I use Format() or FormatCurrency() and then export the output to Excel, all numbers export as text.

The export to Excel is basically useless to my clients because all numbers are exporting as text fields.
Details (expand)
Product Language
English

Category

Reporting Services
Proposed Solution
Can't SQL RS use the Format property to determine that the textbox being downloaded to Excel is an actual number? Or better yet, support an actual data type property for a textbox?
Benefits
Improved User Interface
Other (please provides details below)
Other Benefits
Critical for users that need to export reports to Excel.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/3/2009 at 7:14 PM
Hello Jim,

could you attach your actual report, or describe the specific =Format(...) RDL expressions you are currently using?

I'm trying to better understand why you cannot achieve the desired effect by using the Format property on the textbox instead of using the Format function.
You may be aware of this, but just to make sure, I'd like to point out that for a textbox.Format property you can use custom .NET numeric format strings as explained in the following documentation links:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomnumericformatstrings.asp
Specific examples:
http://msdn.microsoft.com/en-us/library/7x5bacwt(VS.71).aspx

HTH,
Robert Bruckner
SQL Server Reporting Services Team
Posted by Microsoft on 11/3/2009 at 7:21 PM
Sorry, forgot to include the MSDN link for the custom format string examples:

http://msdn.microsoft.com/en-us/library/7x5bacwt(VS.71).aspx
Posted by JimMcCarthy on 11/4/2009 at 6:15 AM
Hi Robert,

We have a lot of options in our product to support different types of formatting for numbers and currencies. We also have a requirement to have the report formats for numbers and currencies use the same formatting options set in Regional Settings for that user. Regional Settings lets you set any character as the decimal and thousands separator.

I thought about doing this with a format string but could not come up with a good way to set the decimal separator and groupSeparator with a format string. Instead we decided to wrap all our numeric fields with a custom function Code.MyFormat(Fields!col.Value, decimalSeparator, groupSeparator, currencySymbol). The custom function creates a NumberFormatInfo object which allows us to set the decimalSeparator and groupSeperator to whatever we want to get the correct format. For example:

Lets say the user sets their group separator to "-" and their decimal separator to "," in regional settings. We would do this:

Private nf As New System.Globalization.NumberFormatInfo

nf.CurrencyDecimalSeparator = ","
nf.CurrencyGroupSeparator = "-"
Return wkNum.ToString("C", nf)

This all works great with the exception of Excel which treats all our numbers as string because there is no actual Type for a textbox to let Excel know this is actually a number.

If there is a way to have a format string like this

#-###,00;(#-###,00);#

that would recognize a that "," is a decimal separator, I would love to know how to do that. The best I could find is to manipulate the language to do this but I don't think that is really how we want to handle this.

One of the needs here is that a US user may be creating an invoice for a client in Europe and they may want to use a number format with different separators so we need to do this kind of formatting.

Any input or suggestions on this would be greatly appreciated.
Posted by Sunil Pereira on 11/17/2009 at 11:59 AM
Hey Jim,

We were running into the same issue while exporting to excel with SSRS 2005. We had to take off the format from the expression in the value field, like FormatCurrency, FormatNumber, etc. Let the value field for the textbox be set to the data field. Under properties of textbox, go to the Format tab and enter a format code in there. Currency would be something like C1 or C2. The output to excel then recognises the formatting.