I am developing a information sharing application in asp.net. I would like to open new MSWorld Document through c# coding in asp.net.
so I have added reference "Microsoft world 11.0", but still unable to import namespace " Microsoft.Office.World;". What can I do for solve my problem. pls help me as early as possible. thanx

Working on .net framework 2005
C#,asp.net

Dani AI

Generated

For : the namespace in the Interop is Microsoft.Office.Interop.Word — not Microsoft.Office.World. Adding the COM entry "Microsoft Word 11.0 Object Library" (Word 2003) in Visual Studio -> Project -> Add Reference -> COM creates the interop assembly that is referenced with using Microsoft.Office.Interop.Word;. ’s suggestion to add the COM reference is correct, but the import will fail if the reference wasn’t actually created, the namespace is misspelled, or Office isn’t installed where the code runs.

Common causes and quick checks:

  • Office must be installed on the machine doing the automation (adding a COM reference alone is not enough).
  • Look under Solution Explorer -> References for Microsoft.Office.Interop.Word or Interop.Microsoft.Word.
  • Set the project Platform target to x86 (most Office installs are 32-bit; 64-bit mismatch causes runtime errors).
  • Remove and re-add the COM reference if a wrong version was picked.
  • Check Event Viewer / ASP.NET logs for COM/permission failures when running under IIS.

Example (local testing only — do not use in high-load web servers):

using Microsoft.Office.Interop.Word;
using System.Runtime.InteropServices;

var app = new Application();
var doc = app.Documents.Add();
doc.Content.Text = "Test";
doc.SaveAs(@"C:\temp\Test.doc");
doc.Close();
app.Quit();
Marshal.ReleaseComObject(doc);
Marshal.ReleaseComObject(app);

Caution and alternatives: Microsoft does not support automating Office from web servers. For production web apps prefer server-safe approaches: the Open XML SDK (generate .docx), a server library such as Aspose.Words, or stream HTML as a Word document to the browser:

Response.Clear();
Response.ContentType = "application/msword";
Response.AddHeader("content-disposition","attachment; filename=export.doc");
Response.Write("<html><body>Report</body></html>");
Response.End();

Follow ’s COM-reference step, confirm the correct Microsoft.Office.Interop.Word namespace and platform target, and choose a non-Interop approach for any production ASP.NET deployment.

just add the reference under com tab microsoft word 11.0 object library.

I have already added this library but still it is not working.

wat kind of erroe u r getting in this.can u plz me in detail

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.