Read from word document line by line

Ok. I found the solution here. The final code is as follows: Application word = new Application(); Document doc = new Document(); object fileName = path; // Define an object to pass to the API for missing parameters object missing = System.Type.Missing; doc = word.Documents.Open(ref fileName, ref missing, ref missing, ref missing, ref missing, ref … Read more

Accessing Office Word object model through asp.net results in “failed due to the following error: 80070005 Access is denied.”

Ok, I resolved this problem with this steps: In the command line put DCOMCNFG Expand Console Root > Component Service > Computers, right-click on My Computer, And Select Properties In the Tab COM Security > Launch and Activation Permissions Click in Edit Default Add the User (Ex. IIS_IUSRS) or service Check Allow Local Launch and … Read more

How to read an excel file in C# without using Microsoft.Office.Interop.Excel libraries

I highly recommend CSharpJExcel for reading Excel 97-2003 files (xls) and ExcelPackage for reading Excel 2007/2010 files (Office Open XML format, xlsx). They both work perfectly. They have absolutely no dependency on anything. Sample using CSharpJExcel: Workbook workbook = Workbook.getWorkbook(new System.IO.FileInfo(fileName)); var sheet = workbook.getSheet(0); … var content = sheet.getCell(colIndex, rowIndex).getContents(); … workbook.close(); Sample using … Read more

Can I still use Microsoft.Office.Interop assemblies with office 2013?

PIAs are a historical artifact, required only by old .NET versions (before v4). They have been thoroughly and elegantly replaced by the “Embed Interop Types” feature, also known as the “No PIA” feature. Supported since Visual Studio 2010, you’ll find it back in the Properties window when you select a reference assembly. It defaults to … Read more