i add a COM reference to my project by right clicking in the solution explorer on References->Add Reference. Click on the COM tab and look for the Microsoft Word 10.0 Object Library. Click Select and OK.
Then i included the following namespace
using Microsoft.Office.Core;
and typed
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
and i tried to build the application.i am getting the following error.
The type or namespace name 'Word' could not be found (are you missing a using directive or an assembly reference?)
for creating a word document is the presence of microsoft office is compulsory?
Please give me clarification .
Thanks in advance.
Scott LyslePosted Dec 14, 2007, 1:40 AM
Add the Office Core Object library and the Microsoft Word Object library: I ran this code in an asp.net 2.0 project and it went okay.
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using Microsoft.Office.Core; using Microsoft.Office.Interop.Word; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Microsoft.Office.Interop.Word.ApplicationClass oWordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); } }