Solved

How do I set conditional formatting in Excel from a Delphi program using OLE

Posted on 2010-08-31
2
1,071 Views
Last Modified: 2012-05-10
I've used
oWB := oXL.Workbooks.add;
oSheet := oWB.activesheet;

This bit works and I can produce an excel sheet but can't get the conditional formatting to work

oSheet.Range['C7:C7'].FormatConditions.add(    ,      ,    ,    )

is the part where I am having trouble.  What do I enter to get a condition of greater than 1
0
Comment
Question by:s_w_e2
2 Comments
 
LVL 13

Accepted Solution

by:
aflarin earned 500 total points
ID: 33573958
procedure TForm1.Button2Click(Sender: TObject);
const
  xlCellValue = $00000001;
const
  xlGreater = $00000005;
begin
  WorkSheet.Cells[1,1].FormatConditions.Add(xlCellValue,xlGreater,1);
  WorkSheet.Cells[1,1].FormatConditions[1].Interior.ColorIndex := 3;
end;
0
 

Author Closing Comment

by:s_w_e2
ID: 33582085
Thanks for the solution.  It was great.
Is there a place I can get the format for this - my original try had 4 parameters - yours had only 3  (I've figured that you need 4 if you use xlBetween  (I've got a list of numbers for these).

Can you also give me the format for validation of a cell?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

809 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