0

I developed one application for create and download msoffice 2007 .docx file in asp.net web application. Its working file in my system machine. its through error in server. Because of server doesn't have msoffice 2007. I developed this application using (Microsoft.Office.Interop.Word.dll,Microsoft.Office.Interop.Word and Microsoft.Office.Tools.dll ) this there .dll . I copied this .dll into bin folder(server machine) and also in global assembly. Stile i am getting same error i.e ( Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).)

code

            Word._Application oWord;
            Word._Document oDoc;
            oWord = new Word.Application();
            oWord.Visible = false;
            oDoc = oWord.Documents.Open(filePath); // open exist document template  .docx file
            object oRng;
            oRng = "SampleBookmark";
                 //Insert another paragraph.:
            Word.Paragraph _oPara;
            oRng = oDoc.Bookmarks.get_Item(ref oRng).Range;//getting exact location in word doc
            _oPara = oDoc.Content.Paragraphs.Add(ref oRng);
            _oPara.Range.Font.Bold = 0;
            _oPara.Range.ListFormat.ApplyBulletDefault();

            oDoc.Save();

Thanks, Praveen

Praveen G
  • 272
  • 1
  • 5
  • 13

1 Answers1

0

Please see How to use Microsoft.Office.Interop.Excel on a machine without installed MS Office?. You have to install a copy of Office on the server. Also, be aware that there can be problems with the license validity of server installs of MS Office.

Community
  • 1
  • 1
David Arno
  • 42,717
  • 16
  • 86
  • 131