Solved

How to numberformat a column in excel from delphi

Posted on 2004-03-24
13
2,576 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
 
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now