QAxObject* Tables = ActD->querySubObject("Tables()"); QAxObject* NewTable = Tables->querySubObject("Add(Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)", ActD->dynamicCall("Range()"), 4,4,1,1); QAxObject * row = NewTable->querySubObject("Rows()"); row->dynamicCall("Add()");
QList<QString> t; mQ->setQuery("Select Владелец.Владелец , Владелец.Адресс, Владелец.Телефон, Владелец.email, Владелец.Клуб from View, Animals, Владелец where Владелец.ID_Owner= Animals.ID_Owner And Animals.ID_Cat=View.ID_Cat And View.ID = 1",dbSql); for (int i = 0 ; i < mQ->rowCount();i++) { QString top = QString::number(i+1).append("_").append(mQ->data(mQ->index(i,0)).toString().append("_").append(mQ->data(mQ->index(i,1)).toString().append("_").append(mQ->data(mQ->index(i,2)).toString().append("_").append(mQ->data(mQ->index(i,3)).toString().append("_")).append(mQ->data(mQ->index(i,4)).toString())))); qDebug() << top; t.append(top); } QAxObject *Wa = new QAxObject ("Word.Application"); QAxObject *Wd = Wa->querySubObject("Documents()"); Wd->querySubObject("Open(QVariant)",QDir::currentPath().append("\\Rep\\NygdaychieV_Gostinace.doc")); Wa->setProperty("Visible",true); QAxObject* ActD = Wa->querySubObject("ActiveDocument()") ; QAxObject* range = ActD->querySubObject("Tables(1)") ; QAxObject* row = range->querySubObject("Rows()") ; //-------------------------------------------------------------- QAxObject* cell = range->querySubObject("Cell(Row, Column)" , 0,0) ; QAxObject *celR = cell->querySubObject("Range()") ; qDebug() << t.size(); for (int i = 0 ;i < t.size();i++) { row->dynamicCall("Add()") ; qDebug()<< i ; QString f = t.at((i)); QStringList g = f.split("_"); qDebug()<< g.at(1); for (int j = 0 ; j < g.size() ; j++) { cell = range->querySubObject("Cell(Row, Column)" , i+1,j+1) ; celR = cell->querySubObject("Range()") ; celR->dynamicCall("InsertAfter(Text)" ,g.at(j)) ; } }return;
QAxObject *Wa = new QAxObject ("Word.Application"); QAxObject *Wd = Wa->querySubObject("Documents()"); Wd->querySubObject("Open(QVariant)",QDir::currentPath().append("\\Rep\\test.doc")); Wa->setProperty("Visible",true); QAxObject* ActD = Wa->querySubObject("ActiveDocument()") ; QAxObject* Range_1 = ActD->querySubObject("Range()") ; QAxObject* Tables = ActD->querySubObject("Tables()") ; QAxObject* NewTables = Tables->querySubObject("Add(Range, NumRows, NumColumns, DefaultTablesBehavior, AutoFitBehavior)", ActD->dynamicCall("Range()"),4,4,1,1) ; //QAxObject* Range_2 = ActD->querySubObject("Range()") ; NewTables->dynamicCall("Select()") ; NewTables->dynamicCall("Copy()");
QAxObject *Wa = new QAxObject ("Word.Application");QAxObject *Wd = Wa->querySubObject("Documents()");QString ex = QDir::currentPath().append("\\Rep\\test.doc");Wd->querySubObject("Open(QVariant)",ex );//OtchetV_CMIWa->setProperty("Visible",true);QAxObject* ActD = Wa->querySubObject("ActiveDocument()") ;QAxObject* range = ActD->querySubObject("Tables(1)") ;QAxObject* row = range->querySubObject("Rows()") ;QAxObject* cell = range->querySubObject("Cell(Row, Column)" , 0,0) ;QAxObject *celR = cell->querySubObject("Range()") ;QAxObject* selection = Wa->querySubObject("Selection") ; QAxObject* pswds=selection->querySubObject("ParagraphFormat()"); pswds->dynamicCall("SetAlignment(WdParagraphAlignment)" ,1) ;
QAxObject* cell = range->querySubObject("Cell(Row, Column)" , 3,1) ; QAxObject* row = range->querySubObject("Rows()"); row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; row->dynamicCall("Add()") ; QAxObject *celR = cell->querySubObject("Range()") ; celR = cell->querySubObject("Range()") ; celR->dynamicCall("InsertBreak()");