Hello I'm trying to use Conditional Formating
I'm using Borland C++ Builder and XLSReadWriteII 3.0
My sorse code is following:
//**********************************************************************************************************************************//
XLS->Sheet[0]->FillRandom("A1:I10",300); //Add somw random numbers
XLS->Sheet[0]->ConditionalFormats->Add();
XLS->Sheet[0]->ConditionalFormats->Add()->Areas->Add(0,0,9,9);
XLS->Sheet[0]->ConditionalFormats->Add()->Condition1->Formula1="100";
XLS->Sheet[0]->ConditionalFormats->Add()->Condition1->Formula2="200";
XLS->Sheet[0]->ConditionalFormats->Add()->Condition1->CompOperator=coBetween;
XLS->Sheet[0]->ConditionalFormats->Add()->Condition1->FmtPattern->ForeColor=xcRed;
//**********************************************************************************************************************************//
In output XLS sheet it fills A1:I10 with random values from 0 to 300, but it does not do any frmating (does not color in red cells with values between 100 and 200)
What i'm doing wrong ??
Conditional Formating
Re: Conditional Formating
Hello
For every call to Add(), you adds a new conditional format, so at the end you have added six.
Here is a working delphi sample:
var
CondFmt: TConditionalFormat;
begin
XLSBook.XLS.Sheet[0].FillRandom('A1:I10',300); //Add somw random numbers
CondFmt := XLSBook.XLS.Sheet[0].ConditionalFormats.Add();
CondFmt.Areas.Add(0,0,9,9);
CondFmt.Condition1.Formula1 := '100';
CondFmt.Condition1.Formula2 := '200';
CondFmt.Condition1.CompOperator := coBetween;
CondFmt.Condition1.FmtPattern.ForeColor := xcRed;
end;
For every call to Add(), you adds a new conditional format, so at the end you have added six.
Here is a working delphi sample:
var
CondFmt: TConditionalFormat;
begin
XLSBook.XLS.Sheet[0].FillRandom('A1:I10',300); //Add somw random numbers
CondFmt := XLSBook.XLS.Sheet[0].ConditionalFormats.Add();
CondFmt.Areas.Add(0,0,9,9);
CondFmt.Condition1.Formula1 := '100';
CondFmt.Condition1.Formula2 := '200';
CondFmt.Condition1.CompOperator := coBetween;
CondFmt.Condition1.FmtPattern.ForeColor := xcRed;
end;
Lars Arvidsson, Axolot Data
Re: Conditional Formating
OK,
But how to apally it for C++?
Can you give me code example ?
But how to apally it for C++?
Can you give me code example ?
Re: Conditional Formating
Hello
Sorry, I don't have C++ installed, but assigning a value to a variable, and then use the variable, is just basic C++ programming.
Sorry, I don't have C++ installed, but assigning a value to a variable, and then use the variable, is just basic C++ programming.
Lars Arvidsson, Axolot Data
Re: Conditional Formating
sorry but it does not work.
If you find some kind of example in C++
it would be grate help
many thx .
If you find some kind of example in C++
it would be grate help
many thx .