Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Extremely Frustrating Problem SSRS 2008 and Excel

Author  Topic 

joe8079
Posting Yak Master

127 Posts

Posted - 2012-08-31 : 12:20:28
Does anyone know how to export a negative number such as -213.00 into excel as Text??? For some reason, excel refuses to format this as text no matter if I convert it to data type varchar or not. The same field of 213.00 which I cast as varchar will export as text, but the
-213.00 is going in as an int even though I cast as varchar

joe8079
Posting Yak Master

127 Posts

Posted - 2012-08-31 : 12:58:09
is there a function I can use to force it to export to excel as text?
Go to Top of Page

joe8079
Posting Yak Master

127 Posts

Posted - 2012-08-31 : 15:28:53
I just find it bizarre that the value of 213 for example exports as text to excel, but -213 stays at integer no matter what I do.
Go to Top of Page

joe8079
Posting Yak Master

127 Posts

Posted - 2012-09-03 : 12:01:12
any thoughts...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-03 : 15:38:40
specify the type as string explicitly in textbox properties in SSRS. If its not working, try using =CStr(fields!...) in SSRS to explicitly cast it

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

joe8079
Posting Yak Master

127 Posts

Posted - 2012-09-03 : 17:15:42
Thanks, I'll give that a shot.
Go to Top of Page

joe8079
Posting Yak Master

127 Posts

Posted - 2012-09-03 : 17:42:48
I think this might work, I tested it out on the adventureworks database and it turns it to text. I'll give it a shot at work tommorow. Any reason why SSRS does this even when you tell it Varchar in the SQL code. I mean why it reverts back to INT when exporting.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-03 : 19:12:10
no idea on that. it may have something to do with IMEX property. how were you trying to do export?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

joe8079
Posting Yak Master

127 Posts

Posted - 2012-09-04 : 08:56:14
Sorry, just tried this an unfortantely it still doesnt export to excel as a Text. I set the properties to =CSTR(Field) and that doesnt seem to work. The value that I am working with is a decimal so it comeso out like -100.04. When you say to specify the type as string in textbox properties in SSRS where would I go to do that? It doesnt have an option to set it to a string. I've never seen something that should seem so easy, but end up so frustrating before.
Go to Top of Page

joe8079
Posting Yak Master

127 Posts

Posted - 2012-09-04 : 09:05:52
Wow, not sure what just happened, but it works now. I got so mad I started removing all the formating from the report, images, textboxes, headers, footers and now it seems to export to excel as Text.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-05 : 21:56:37
quote:
Originally posted by joe8079

Wow, not sure what just happened, but it works now. I got so mad I started removing all the formating from the report, images, textboxes, headers, footers and now it seems to export to excel as Text.


ok so i hope you were using a standard or custom format expression for integers which is why it interpreted it as int

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -