Working with Excel Sheet?
-
Anyone knows how to extract an attached images inside a cell using the excel activex ? I can read and write normal text but I can't manage to extract images attached inside a cell. Any help would be appreciated.
-
[quote author="Skyrim" date="1307478863"]As it turned out, run Excel macro knowing his name - very simple.
@
QString nameMacro = "mac"; //name macro
excel->dynamicCall("Run(QVariant)", nameMacro);
@[/quote]
Hello, I've been trying to make this work and just doesn't
I can't find the mistakeseleccion->dynamicCall("GoTo(const QString&, const QString&, const QString&)","wdGoToPage","wdGoToAbsolute", pag);
I really would thank you very much if you can help me
-
ok, let it be Word
for example, "go to" the 3 line.@
word = new QAxObject("Word.Application", this);
word->setProperty("DisplayAlerts", false);
doc = word->querySubObject("Documents");
doc->dynamicCall("Open(QVariant)", "d:\a15.doc");
word->querySubObject("Selection")->querySubObject("GoTo(Int, Int, Int)", 3, 1, 3);
@
Selection.GoTo(What, Which, Count, Name)
What:=wdGoToLine - emun = 3;
Which:=wdGoToAbsolute - enum = 1;
Count:= 3 - destination line
-Name - forget about Name -
:-O OMG , dude, thank you very much... So, I have to use the correspoding number of the enumeration instead of the name of the enumeration (wdGoToLine) it works!!! thank you veryyyyyyyy
Sorry for misplacing this but I thought this was the most related thread :P
Thank you againnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn -
:P I'm sure it is :D
-
[quote author="Skyrim" date="1305238978"]Hi all
Error in row 9.
Should be:
@
QAxObject *worksheets = workbook->querySubObject("Sheets");
worksheets->dynamicCall("Add()"); //insert new Sheet
@everything else was fine.[/quote]
Hi, was this running inside a qt dialog or window? or outside ur qt application?
-
Skyrim! Thanks for the tip. Works great!
I have to do the same thread, but comparing one row, which has a product description of my .xls file (as database) with bar code input by code bar reader of the software user.
I'm just adding this to my *.pro *Project File:@CONFIG += qaxcontainer
DEF_FILE = qaxserver.def
RC_FILE = qaxserver.rc@This on my .cpp file working with a new "QTableWidget":
@{
QAxObject *excel;
QAxObject *wbooks;
QAxObject *book;
QAxObject *sheets;
QAxObject *cell;
QTableWidgetItem *wit;excel = new QAxObject("Excel.Application", this); excel->setProperty("Visible", 1); excel->setProperty("DisplayAlerts", 0); wbooks = excel->querySubObject("Workbooks"); book = wbooks->querySubObject("Open (const QString&)", "C:\\1.xls" );; sheets = book->querySubObject("Sheets"); ui->spinBox->setValue(sheets->dynamicCall("Count()").toInt()); for (int i = 0; i<ui->tableWidget->rowCount(); i++){ for (int j =0; j<ui->tableWidget->columnCount(); j++){ cell = excel->querySubObject("Cells(QVariant&, QVariant&)", i+1, j+1); wit = new QTableWidgetItem(cell->property("Value()").toString()); wit = new QTableWidgetItem(QString("%1,%2").arg(i).arg(j)); ui->tableWidget->setRowCount(10); ui->tableWidget->setColumnCount(5); ui->tableWidget->setItem(i, j, wit); } } for (int i = 1; i <= 5; i++) { for (int j = 1; j <= 3; j++) { cell = excel->querySubObject("Cells(Int, Int)", i, j); QString valC = cell->dynamicCall("value").toString(); ui->textEdit->append(valC);//-- simple check QTableWidgetItem *it = new QTableWidgetItem; it->setText(valC); it->setText(cell->dynamicCall("Value").toString()); ui->tableWidget->setItem(i-1, j-1, it); ui->tableWidget->setRowCount(10); ui->tableWidget->setColumnCount(5); } }
}
@