Я читаю tutorial on how to use control blocks to manipulate document in word.
проблема заявление:C# разработка офиса: Microsoft.Office.Tools.Word.Controls.Button, дающая ошибку
private Microsoft.Office.Tools.Word.Controls.Button button = null;
дает ошибку.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Word = Microsoft.Office.Interop.Word;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
namespace SecondWordAddIns {
public partial class ThisAddIn {
private Microsoft.Office.Tools.Word.Controls.Button button = null; // error here
private RichTextContentControl richTextControl = null;
private void ThisAddIn_Startup(object sender, System.EventArgs e) { }
private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { }
internal void toggleButton() { }
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
Сообщение об ошибке:
Ошибка 1 Тип или пространство имен имя «Управление» не существует в пространстве имен «Microsoft.Office.Tools.Word» (пропущена ссылка на сборку?) C: \ Users \ Root \ Documents \ Visual Studio 2010 \ Projects \ WordAddIn2 \ WordAddIn2 \ ThisAddIn.cs 14 45 WordAddIn2
Добавить код ошибки на ваш вопрос. –
'Вам не хватает ссылки на сборку?' - не так ли? –
Да, вы. Вам нужно добавить C: \ Program Files \ Reference Assemblies \ Microsoft \ VSTO40 \ v4.0.Framework \ Microsoft.Office.Tools.Word.v4.0.Utilities.dll –