BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Excel automation (NumberFormat)

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX)
View previous topic :: View next topic  
Author Message
siraj
Guest





PostPosted: Thu Jan 20, 2005 12:38 pm    Post subject: Excel automation (NumberFormat) Reply with quote



Hi!
I am using c++ builder 5 and Access 2000 database.
I export data from access to excel.
I have one date/field.
After I export all the data to excel , I try to format the date/time field
like this

Variant forma;
forma = "dd/mm/yyyy hh:mm";
Range.ClearArgs();
SetValue.ClearArgs();
my_range = my_worksheet.Exec(Range << "A:A");
my_range.Exec(Function("Select"));
my_range.Exec(PropertySet("NumberFormat")<< forma);

I get the OleException "unable to set the NumberFormat for the Range".

I use windows 2000 french operating system and my regional setting are
french(swiss)

If I replace the line
forma = "dd/mm/yyyy hh:mm";
by
forma = "jj/mm/aaaa hh:mm";

It works correctly.
This application is going to be used on korean,chinese operating systems and
korean and chinese version of excel.

How to make the numberformat independent of this so that it format the
date/time in every case.
I have been struggling with this for quite long time.
Please help.

I tried replacing
forma = "dd/mm/yyyy hh:mm";
with
forma = "dd mm yyyy hh:mm";
then if the date/time is 12/01/2005 11:12 I get the result as "dd 01 yyyy
hh:mm"
because in french dd is jj,mm is mm, yyyy is aaaa. I don't know what it will
be chinese.

Thank you in advance.

Regards,
Siraj







Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (ActiveX) All times are GMT
Page 1 of 1

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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.