我编写了一个例程,复制word文档并将其粘贴到c ++中的新word文档中(Borland Builder 5)
tbSearch->Text = "{axis1[d]} ";
Variant vk_this_doc_select = wrdDoc1.OleFunction( "Select" ); // wir selektieren dessen Inhalt des geöffneten Dokuments
wordSelection = zuladendesDokument.OlePropertyGet("Selection"); // tun es in den ZwischenSpeicher der Applikation
wordSelection.OleFunction( "Copy" ); // und kopieren es
Variant vk_converted_document_select = wrdDoc.OleFunction( "Select" ); // wir machen die Selektion im alten Dokument
Variant vk_converted_document_selection = wrdApp.OlePropertyGet( "Selection" );
Variant wordSelectionFind = vk_converted_document_selection.OlePropertyGet( "Find" ); // setzen den Zeiger
wordSelectionFind.OleFunction( "Execute", tbSearch->Text, false, false, false, false, false, true, 1, false, wordSelection, 2, false, false, false, false );
该例程运行良好,但在插入例程中,word文档的图形部分被破坏。
我还试图通过
插入word文档k_converted_document_selection.OleFunction( "PasteSpecial"), 0, false, 0, false, 0);
此处格式正常,但粘贴文档的位置错误(每次都在文档的开头。
所以我有两个问题:
过了一会儿(并且松开了2到10个神经细胞 fg )我得到了自己的答案,所以我将结果发布到下一个,处理这个问题(抱歉我的英语不好)。希望任何人都可以使用它......
tbSearch->Text = "{axis3[d]}" ;
Variant vk_this_doc_select = wrdDoc1.OleFunction( "Select" );// select the contain of the document to be insert
wordSelection = zuladendesDokument.OlePropertyGet("Selection"); // select
wordSelection.OleFunction( "Copy" ); // copy
Variant vk_converted_document_select = wrdDoc.OleFunction( "Select" ); // select the first document
Variant vk_converted_document_selection = wrdApp.OlePropertyGet( "Selection" );
Variant wordSelectionFind = vk_converted_document_selection.OlePropertyGet( "Find" );
// now the trick with is the solution: find the position you want, but do nothing ("")
wordSelectionFind.OleFunction( "Execute", tbSearch->Text, false, false, false, false, false, true, 1, false, "", 1, true, true, true, true );
vk_converted_document_selection.OleFunction( "PasteSpecial", 0, false, 0, false, 0); // now the pointer in the document is found, means PasteSpecial will insert the document at the right place