Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Output difference - Viewer vs. Excel Post Reply Post New Topic
Author Message
clevername
Newbie
Newbie


Joined: 27 Nov 2007
Location: United States
Online Status: Offline
Posts: 4
Quote clevername Replybullet Topic: Output difference - Viewer vs. Excel
     Posted: 06 Dec 2007 at 8:17am
Hi,
 
I have a formula in a field that returns values in seconds that converts it to HH:MM:SS
 
In the display string formula box for this field I have entered:
 
Local numberVar TimeInSeconds := Round(CurrentFieldValue , 0);
Local numberVar hours := Truncate (TimeInSeconds / 3600, 0 );
Local numberVar minutes := Truncate ((Remainder (TimeInSeconds,3600) / 60 ),0 ) ;
Local numberVar seconds := Remainder (TimeInSeconds,60);
ToText(hours,"00")& ":" & ToText(minutes,"00")& ":" & ToText(seconds,"00")
 
However...when I view the report after exporting to excel....it still returns the fields in seconds. It is fine in PDF or crystal viewer, but excel returns the format to seconds. Help!?
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 07 Dec 2007 at 6:40am
That's because Excel ignores the display string formatting information, and just returns the value.  If you want it to export to Excel, you will need to create a formula that looks pretty much like yours (though, have you looked into the TimeValue function?).  Put that formula on the report, and Excel will actually see the string as you have it formatted.


IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum