線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1838
推到 Plurk!
推到 Facebook!

在word的表格中插入圖片

尚未結案
hsiehwei
一般會員


發表:4
回覆:11
積分:3
註冊:2005-02-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-05-18 01:06:31 IP:61.219.xxx.xxx 未訂閱
我是使用wordApplication跟wordDocuments 我的程式是 Variant picposition, LinkToFile, SaveWithDocument; picposition = CustomerForm->WordApplication1->Selection->Range; // picposition = CustomerForm->WordDocument1->Tables->Item(CustomerForm->WordDocument1->Tables->Count)->Cell(i 2,2)->Range LinkToFile = false; SaveWithDocument = true; CustomerForm->WordDocument1->Tables->Item(CustomerForm->WordDocument1->Tables->Count)->Cell(2,2)->Range->InlineShapes->AddPicture("temp.jpg",LinkToFile, SaveWithDocument, picposition); 結果出現 E2285 Could not find a match for 'InlineShapes::AddPicture(char *,Variant,Variant,Variant)' 請問哪邊錯了嗎?
hsiehwei
一般會員


發表:4
回覆:11
積分:3
註冊:2005-02-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-05-18 20:40:38 IP:61.219.xxx.xxx 未訂閱
我把他改成    
引言: Variant Range, LinkToFile, SaveWithDocument; Range = WordApplication1->Selection->Range; // Range = WordDocument1->Tables->Item(CustomerForm->WordDocument1->Tables->Count)->Cell(i 2,2)->Range LinkToFile = false; SaveWithDocument = true; WordDocument1->Tables->Item(CustomerForm->WordDocument1->Tables->Count)->Cell(2,2)->Range->InlineShapes->AddPicture((wchar_t*)"C:\test.jpg",LinkToFile, SaveWithDocument, Range);
可以編譯了,但是執行會出現錯誤 this->AddPicture(FileName,LinkToFile, SaveWithDocument, Range,(Word_2k)::InlineShape**)&group)) Error:C0000005(-107374819)@i:\program files\cbuilder6\includes\vcl\word_2k.h\32012 然後指向utilcls.h的這一行 throw EOleException(msg, hr, file, _T(""), 0); 我寫了個小測試程式也是一樣的結果 void __fastcall TForm1::Button1Click(TObject *Sender) { WordApplication1->Connect(); WordApplication1->set_Visible(true); OleVariant Template,NewTemplate,ItemIndex,_WordDocumentType,_Visible; _AutoFitBehavior; Variant theTable, theCell; NewTemplate = false; Template = EmptyParam; _WordDocumentType = wdTypeDocument; _Visible = true; WordApplication1->Documents->Add(Template, NewTemplate, _WordDocumentType,_Visible); ItemIndex = 1; WordDocument1->ConnectTo(WordApplication1->Documents->Item(ItemIndex)); Variant Range, LinkToFile, SaveWithDocument; Range = WordApplication1->Selection->Range; LinkToFile = false; SaveWithDocument = true; WordApplication1->Selection->Range->InlineShapes->AddPicture((wchar_t*)"C:\test.jpg",LinkToFile, SaveWithDocument, Range); } 發表人 - hsiehwei 於 2005/05/18 20:56:26
hsiehwei
一般會員


發表:4
回覆:11
積分:3
註冊:2005-02-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-05-20 01:07:43 IP:61.219.xxx.xxx 未訂閱
自問自答 Variant _Range, _LinkToFile, _SaveWithDocument; _Range = WordApplication1->Selection->Range; _LinkToFile = false; _SaveWithDocument = true; String fileName = "C:\\test.jpg"; WordApplication1->Selection->Range->InlineShapes->AddPicture(StringToOleStr(fileName),_LinkToFile, _SaveWithDocument, _Range); 呵呵...>///<
系統時間:2024-05-17 10:06:16
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!