cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports XI: formatting and exporting to Excel (VB 6)

Former Member
0 Kudos

Hi.

I have a VERY simple report that all I want it to do is display the numbers from a table EXACTLY as formatted and be able to export them to Excel, as NUMBER (not STRINGS).

Example:

My fields may contains the following values in a single column:

45.02

0.04454

215

And I want them to be displayed as entered in the source table.

Initially, to maintain the formatting, I set the field's data type to a STRING.

The problem is that when I then export the data to Excel, all the numerical values are treated as TEXT and we need to "Convert Text to Numbers".

When I changed the field's data type to a DOUBLE, the data in the table is correct, but the report formats all the numbers in one way. I want to be able to retain the formatting of the field (as-is) but have them exported as numbers, rather than text.

Can this be done?

Please advise!

Thanks.

AK

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with your directly

Former Member
0 Kudos

I actuallly found my answer elsewhere (http://www.tek-tips.com/viewthread.cfm?qid=1235276&page=4).

The Decimal formattion (x=2) for the fields can be set as follows:

If CurrentFieldValue = Int(CurrentFieldValue) Then 0Else If CurrentFieldValue * 10 = Int(CurrentFieldValue * 10) Then 1

Else If CurrentFieldValue * 100 = Int(CurrentFieldValue * 100) Then 2

Else If CurrentFieldValue * 1000 = Int(CurrentFieldValue * 1000) Then 3

Else If CurrentFieldValue * 10000 = Int(CurrentFieldValue * 10000) Then 4

Else If CurrentFieldValue * 100000 = Int(CurrentFieldValue * 100000) Then 5

Else If CurrentFieldValue * 1000000 = Int(CurrentFieldValue * 1000000) Then 6

ElseDefaultAttribute

Basically - this works.

Hope this helps someone else!

Thanks.

AK

former_member183750
Active Contributor
0 Kudos

Before looking at CR in VB 6, can you do this in the CR designer?

Ludek

Former Member
0 Kudos

Not sure what you mean.

In the table itself, I see the proper data (it is an Access database).

In Crystal Reports, when I select Browse data for the formula field that references that field, I see the formatted value and not the "raw data".

I only mentioned VB6 in case I needed to write some code to turn the formatting off.

All I want is for the report to display the numerical data exactly as it appears in the source table (and NOT apply any built in formatting, EVER).

Thanks!

AK

former_member183750
Active Contributor
0 Kudos

Let's put this query into report design forum then.

Ludek