如何在 excel 中加入圖表

有關於C/C++的語法, 程式等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

如何在 excel 中加入圖表

文章 tim »

如何在 excel 中加入圖表

代碼: 選擇全部

    void __fastcall Tform1::Button1Click(TObject *Sender) 
    { 
      Variant ex, wb, ws, ch; 
      ex = CreateOleObject("Excel.Application"); 
      wb = ex.OlePropertyGet("WorkBooks").OleFunction("Open", "C:\1.xls"); 
      ws = wb.OlePropertyGet("WorkSheets", "Sheet1"); 
      ex.OlePropertySet("Visible", true); 
      ch = ex.OlePropertyGet("Charts").OleFunction("Add"); 
      ch.OlePropertySet("ChartType", 51); 
      ch.OleFunction("SetSourceData", ws.OlePropertyGet("Range","A1:B7"), 2); 
      ch.OleFunction("Location", 2, "Sheet1"); 
    } 

附上相關的資料與討論:
http://www.progz.ru/viewtopic.php?t=1237
http://www.cbuilder.ru/WinLesson/bles1_2.htm

參考連結:
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=34385
多多留言, 整理文章, 把經驗累積下來.....
回覆文章