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

如可將資料導入EXCEL的TEXTBOX中

缺席
jc601105
一般會員


發表:4
回覆:3
積分:6
註冊:2003-06-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-10-12 07:55:42 IP:211.74.xxx.xxx 訂閱
在這程式中
ActiveSheet.Shapes("Text Box 1").Select
Selection.Characters.Text = "21323"
轉成BCB要如何編碼

有去找過相關的程式碼,但還是不行

Shape = Sheet1.OlePropertyGet("Shapes");
//TextBox = Shape.OlePropertyGet("Textbox1").OleFunction("Select"); <--這段會出現'不明名稱'的錯誤

請問各位前輩 可否給點建議


下面是在GOOGLE大神所找到 ,WORD
[code cpp]
Variant WordApp,WordDocuments, ActiveDoc,Shape;true取得TextFrame 物件
TextFrame.OlePropertySet("TextRange", "Test");
//
設定文字方塊的內容

[/code]


<link rel="File-List" href="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\01\clip_filelist.xml" /><!--[if gte mso 9]><xml><br /> Normal 0 0 2 false false false MicrosoftInternetExplorer4

</xml><![endif]--><!--[if gte mso 9]><xml><br />

</xml><![endif]--><style type="text/css"><br /><!--
/* Font Definitions */
@font-face
{font-family:新細明體;
panose-1:2 2 3 0 0 0 0 0 0 0;
mso-font-alt:PMingLiU;
mso-font-charset:136;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:3 137232384 22 0 1048577 0;}
@font-face
{font-family:"\@新細明體";
panose-1:2 2 3 0 0 0 0 0 0 0;
mso-font-charset:136;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:3 137232384 22 0 1048577 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:none;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:新細明體;
mso-font-kerning:1.0pt;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style><!--[if gte mso 10]>
<style><br /> /* Style Definitions */
table.MsoNormalTable
{mso-style-name:表格內文;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style><br />
------
大宏
編輯記錄
jc601105 重新編輯於 2008-10-15 15:56:28, 註解 無‧
jc601105
一般會員


發表:4
回覆:3
積分:6
註冊:2003-06-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-10-15 15:53:51 IP:211.74.xxx.xxx 訂閱
巳找到了如可做輸入

[code cpp]
AnsiString name ;
int cnt ;
// 若先前尚未建立 Excel 物件, 則建立之.
// if (!bIsCreated)
// {
// 建立一個可見的 Excel 物件
Excel=CreateOleObject("Excel.Application");
Excel.OlePropertySet("Visible", true);
// }

// 開啟某個已存在的 workbooks 跟 workbook.
Workbooks=Excel.OlePropertyGet("Workbooks");
Workbook=Workbooks.OleFunction("Open", "c:\\lee\\book1.xls");

// 將該Excel 檔的 Worksheets 設給變數 Worksheets.
Worksheets=Workbook.OlePropertyGet("Worksheets");
Worksheet1=Worksheets.OlePropertyGet("Item", 1);
Shapes = Worksheet1.OlePropertyGet("Shapes");
cnt = Shapes.OlePropertyGet("Count");

for(int i=1;i<=cnt; i)
{
TextBox =Shapes.OleFunction("Item",i);
//Shapes.OleFunction("AddTextbox",5,30,20,20,200);
name = TextBox.OlePropertyGet("Name");
//TextBox =Shapes.OlePropertyGet("文字方塊1");
TextFrame = TextBox.OlePropertyGet("TextFrame");
Characters = TextFrame.OleFunction("Characters",1,100);
if(name == "Text Box 1")
{
Characters.OlePropertySet("Text","Test");
}
}
Excel.OleFunction("Quit");

[/code]
------
大宏
系統時間:2024-04-25 8:08:10
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!