我需要在文檔中獲取當前頁面,並設置範圍。我發現有可能通過:如何從MS Word 2007中獲取枚舉類型值?
Range.Information(wdActiveEndPageNumber) //example in C#
但我有問題。在documentation中,信息作爲屬性可見。所以當我用
QString number = myRange->property("Information(wdActiveEndPageNumber)").toString()
我什麼都沒有。我也嘗試過dynamicCall,但要麼不行。簡單的屬性作爲文本或開始工作很好,但我不知道如何處理這些枚舉。
整個代碼:
QAxObject *word, *doc;
word = new QAxObject("Word.Application", this);
word->setProperty("DisplayAlerts", false);
word->setProperty("Visible", true);
doc = word->querySubObject("Documents");
doc->dynamicCall("Open(const QString&)", "path to file");
QAxObject *act = word->querySubObject("ActiveDocument");
QAxObject *next = act->querySubObject("Content");
next->dynamicCall("Select()");
next->dynamicCall("Copy()");
QClipboard *clip = QApplication::clipboard();
myTextEdit->setText(clip->text());
QString number = next->property("Information(3)").toString();
QMessageBox::information(this, tr("cos"), tr("%1").arg(number)); //here i need to know how many pages i've got
這是什麼API /庫? –
Qt,有它的標籤,但我打開任何解決方案 – Blood
我的意思是,什麼類型是myRange,你用什麼API來訪問Word? (的ActiveX?)。核心Qt不會做這樣的事情。 –