
右键OFFICE 开始菜单,
选择自动定义快速访问工具栏
d出窗口后选择左边的加载项
你会看到有个 Load Test Excel 的东东 就是这个出错
选择COM加载项 点击旁边的按钮转到,显示COM加载项页,将那个 Load Test Excel 删除掉,确定重新登录Excel搞掂。
要使用 Excel 中的内置属性,请使用以下属性:
在文档级项目中,使用 ThisWorkbook 类的 BuiltinDocumentProperties 属性。
在 VSTO 外接程序项目中,使用 MicrosoftOfficeInteropExcelWorkbook 对象的 BuiltinDocumentProperties 属性。
这些属性将返回 T:MicrosoftOfficeCoreDocumentProperties 对象,该对象为 T:MicrosoftOfficeCoreDocumentProperty 对象的集合。可以使用集合的 Item 属性,按名称或索引检索该集合中的特定属性。
下面的代码示例演示了如何更改文档级项目中的内置 Revision Number 属性。
若要更改在 Excel 中的修订号属性
将内置文档属性分配给变量。
C#
VB
MicrosoftOfficeCoreDocumentProperties properties;
properties = (MicrosoftOfficeCoreDocumentProperties)
GlobalsThisWorkbookBuiltinDocumentProperties;
MicrosoftOfficeCoreDocumentProperty prop;
prop = properties["Revision Number"];
以 1 递增 Revision Number 属性。
C#
VB
if (propValue == null)
{
propValue = 1;
}
else
{
int revision;
if (intTryParse((string)propValue, out revision))
{
propValue = revision + 1;
MessageBoxShow("Revision Number = " + revision);
}
else
{
MessageBoxShow("Revision Number = invalid value");
}
}
在 Word 中设置文档属性
若要使用 Word 中的内置属性,请使用以下属性:
在文档级项目中,使用 ThisDocument 类的 BuiltInDocumentProperties 属性。
在 VSTO 外接程序项目中,使用 MicrosoftOfficeInteropWordDocument 对象的P:MicrosoftOfficeInteropWord_DocumentBuiltInDocumentProperties 属性。
这些属性将返回 T:MicrosoftOfficeCoreDocumentProperties 对象,该对象为 T:MicrosoftOfficeCoreDocumentProperty 对象的集合。可以使用集合的 Item 属性,按名称或索引检索该集合中的特定属性。
下面的代码示例演示了如何更改文档级项目中的内置 Subject 属性。
若要更改主题属性
将内置文档属性分配给变量。
C#
VB
MicrosoftOfficeCoreDocumentProperties properties;
properties = (MicrosoftOfficeCoreDocumentProperties)
GlobalsThisDocumentBuiltInDocumentProperties;
将 Subject 属性更改为“白皮书”。
C#
VB
// Set the Subject property
properties["Subject"]Value = "Whitepaper";
private void button1_Click(object sender, EventArgs e) { FileStream stream = null; SqlConnection conn = null; SqlCommand cmd = null; try { richTextBox1SaveFile("temprtf"); stream = new FileStream("temprtf", FileModeOpen, FileAccessRead); int size = ConvertToInt32(streamLength); Byte[] rtf = new Byte[size]; streamRead(rtf, 0, size); conn = new SqlConnection("Data Source=d30 \\sqlexpress;Initial Catalog=Image;Integrated Security=True;"); connOpen(); cmd = new SqlCommand("UPDATE pic SET picture=@Photo WHERE ID=1", conn); SqlParameter paramRTF = new SqlParameter("@Photo", SqlDbTypeImage, rtfLength, ParameterDirectionInput, false, 0, 0, null, DataRowVersionCurrent, rtf); cmdParametersAdd(paramRTF); int rowsUpdated = ConvertToInt32(cmdExecuteNonQuery()); MessageBoxShow(StringFormat("{0} rows updated", rowsUpdated)); } catch (Exception ex) { MessageBoxShow(exMessage); } finally { if (stream != null) streamClose(); if (cmd != null) cmdParametersClear(); if (conn != null) connClose(); } } private void button2_Click(object sender, EventArgs e) { richTextBox1Clear(); SqlConnection cn = null; SqlCommand cmd = null; SqlDataReader reader = null; try { cn = new SqlConnection("Data Source=d30 \\sqlexpress;Initial Catalog=Image;Integrated Security=True;"); cnOpen(); cmd = new SqlCommand("SELECT picture FROM pic WHERE ID=1", cn); reader = cmdExecuteReader(); readerRead(); if (readerHasRows) { if (!readerIsDBNull(0)) { Byte[] rtf = new Byte[ConvertToInt32((readerGetBytes(0, 0, null, 0, Int32MaxValue)))]; long bytesReceived = readerGetBytes(0, 0, rtf, 0, rtfLength); ASCIIEncoding encoding = new ASCIIEncoding(); richTextBox1Rtf = encodingGetString(rtf, 0, ConvertToInt32(bytesReceived)); } } } catch (Exception ex) { MessageBoxShow(exMessage); } finally { if (reader != null) readerClose(); if (cn != null) cnClose(); } }
以上就是关于打开office2010 是提示从:全部的内容,包括:打开office2010 是提示从:、Delphi中如何调用“接口”,以读取TWordDocument.BuiltInDocumentProperties、急求C#窗体 *** 作VSTO如何向word模板中的特定文本框添加图文信息等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)