Problem when export an HTML content to open office application

Posted by SBBR123 under ASP.NET on 9/8/2011 | Points: 10 | Views : 1222 | Status : [Member] | Replies : 1
Hello All.

I am facing a problem when I am trying to export an HTML content to open office application.
I am using ASP.Net with C#.
I have a datatable and one of it's column is say "Average Hours".
It holds the value suppose as "08:50" as string type.
That means average hours for an employee is 08 hours and 50 minutes.
When the HTML is exported into open office application,
it is showing as 08:50:00 AM.
I think default time format for open office is set as HH:MM:SS AM/PM.
When I am changing the format to only HH:MM in open office, then values in column is showing properly.
But in Microsoft Office (Excel) application, it is all right.

Suppose my HTML content is as follows--


Is there any way to manage this problem through my code with out changing the format every time in open office. in C#.
Please help me.
Thanks a lot.


Posted by: Vuyiswamb on: 9/8/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

I dont see anything wrong with the time, what you can do as you said its a string, just do a Substring on

if the value is like this

08:50:00 AM.

substring("08:50:00 AM",0,4) 

i might be wrong with the Substring count, try that

Thank you for posting at Dotnetfunda

SBBR123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response