Reputation: 127
I am new to Qt . I have written a program to read and write datas from excel file.
void Excel::Color(const QString& Sheet_Name,const QString& cell,const QString& color_Name) {
QAxObject* Worksheet = activeWorkbook->querySubObject("WorkSheets(const QString&)",Sheet_Name);
QAxObject* Cell_Range = Worksheet->querySubObject("Range(const QString&)",cell );
}
Now i need to apply color to particular cell. Is there any posibility to achieve this ?
Upvotes: 2
Views: 3857
Reputation: 11
How to get currentCell
object:
QAxObject* Interior = currentCell->querySubObject("Interior");
Interior->setProperty("ColorIndex",Index_val);
Upvotes: 1
Reputation: 7575
As a delphi enthusiast, I did office automation in the past. I don't feel very comfortable with Qt but I have Qt Creator 2.4.0 installed on my box with the latest Qt framework: It's very promising.
Here is a VBA snippet more relevant to Cell coloring,
Cells(1, “D”).Interior.Color = RGB(0, 255, 255)
Cells(1, “D”).Borders.Weight = xlThick
Cells(1, “D”).Borders.Color = RGB(0, 0, 255)
You can also head to this interesting thread related to harnessing Excel file with QAxWidget.
Edit:
The OP finally end up founding an appropriate Qt solution as follows:
QAxObject* Interior = currentCell->querySubObject("Interior");
Interior->setProperty("ColorIndex",Index_val);
Upvotes: 2