1
我無法讓我的設計表修改打開行時我有麻煩是var sheet =(Excel._Worksheet)swDoc.GetDesignTable; 。基本上我想要它做的是打開窗口並引用「設計表」的活動工作表。該API包含「DesignTable」類型。我被困了一段時間。任何幫助表示讚賞。Solidworks和Excel C#引用設計表
//Open Solidworks Design Table
SldWorks swApp;
swApp = null;
swApp = (SldWorks)Activator.CreateInstance(Type.GetTypeFromProgID("SldWorks.Application"));
ModelDoc2 swDoc = null;
bool boolstatus = false;
swDoc = ((ModelDoc2)(swApp.ActiveDoc));
boolstatus = swDoc.Extension.SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, false, 0, null, 0);
swDoc.InsertFamilyTableEdit();
var sheet = (Excel._Worksheet)swDoc.GetDesignTable;
//Generate Linear Guide Support in Solidworks
if (comboBox1.Text == "0")//No External Rails
{
sheet.Cells[6, 4] = "0"; //Cell Location [y-axis, x-axis]
}
我還試圖VAR片=(Excel._Worksheet)this.ActiveSheet; –