Solved

How to numberformat a column in excel from delphi

Posted on 2004-03-24
13
2,605 Views
Last Modified: 2012-06-22
I am exporting repor data to excel but need to set the numberformat to "0.00" for 2 decimal places for certain columns.

I can do this via              

VarXCel.Range['E1','E99'].Numberformat:='0.00';

if I know how many rows there are but surely there must be a way of specifying simple the whole column irrespective of how many rows are in use.  
0
Comment
Question by:ashdata
  • 5
  • 4
13 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10670538
I belive there is a FixedDecimalPlaces which you can pass the column ID

 ExcelApplication1.FixedDecimalPlaces[3]:= '0.00';

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10670555
Sorry,

maybe its something like this

 ExcelApplication1.FixedDecimal[3]:= True;
  ExcelApplication1.FixedDecimalPlaces[3]:= 2;

Shane
0
 

Author Comment

by:ashdata
ID: 10670664
Thansk, Compiles and runs but gets "old format or invalid type library" when gets to that line ??
0
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
LVL 11

Expert Comment

by:shaneholmes
ID: 10670704
What version of Delphi are you using? SOunds like its not compatible with the version of the Excell OLE server you have installed on your machine

Shane
0
 

Author Comment

by:ashdata
ID: 10670729
Delphi 7 and Office 2002
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10670805
hmm,
not exactly sure what is going on there.

I do know that is how you change the column precision though.

I have used it in the past .

Shane
0
 

Author Comment

by:ashdata
ID: 10670876
Thanks, very frustrating as that sounded perfect :(
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10670940
Have you tried different values in there in both places (play with it abit) see if it will accept any otehr them the values you are using.

Shane
0
 

Author Comment

by:ashdata
ID: 10671140
Still no luck. Given other formatting requirement eg text to stop thinking it is numeric etc, I need to be able to set the format for columns other than decimals - so back to the oringinal problem :( In the mean time I will do the range technique...
0
 

Accepted Solution

by:
arodionov earned 50 total points
ID: 10675470
Hello.

I didn't solve such a problem but I have just recorded a macro in Excel while selecting a whole column and found the following VB code:

Columns("D:D").Select

Maybe it will work...
Anyway the Columns property exists in ExcelApplication interface declaration.

Alex.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 158
Delphi TcxGrid group footer summary 3 276
Delphi IDE crash without error message ... 7 91
RESTRequest Parameter 4 31
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question