Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reading word file in c#

I have a word document I want to parse with C#. There are plenty of tutorials out there, but I have a hard time deciding what library to use. I found the following dlls:

  1. Microsoft.Office.Interop.Word
  2. Microsoft.Office.Tools.Word
  3. Microsoft.Office.Tools.Word.v4.0.Utilities
  4. COM Microsoft Word 12.0 Object Library
  5. Open XML sdk

These are all I found on the web. Which one should I use? Which of those are obsolete?

like image 845
user194076 Avatar asked Nov 11 '11 21:11

user194076


People also ask

What is reading a file in C?

Reading a File Given below is the simplest function to read a single character from a file − int fgetc( FILE * fp ); The fgetc() function reads a character from the input file referenced by fp. The return value is the character read, or in case of any error, it returns EOF.

What does Fscanf do in C?

fscanf Function in C This function is used to read the formatted input from the given stream in the C language. Syntax: int fscanf(FILE *ptr, const char *format, ...) fscanf reads from a file pointed by the FILE pointer (ptr), instead of reading from the input stream.


1 Answers

You can also do it using NetOffice

Site: http://netoffice.codeplex.com/

Using it you don't need to worry about versions and "Syntactically and semantically identical to the Microsoft Interop Assemblies" so you do your coding the same way.

Some other advantages:

  • Office integration without version limitations
  • All objects, methods,properties and events of the Office versions 2000, 2002, 2003, 2007,2010 are included
  • Attribute concept and XML source documentation for information which Office version(s) are offering the particular method or property
  • No training if you already know the Office object model, use your existing PIA code
  • Reduced and more readable code with automatic management of COM proxies
  • No deployment hurdles, no problematic registration, no dependencies, no interop assemblies, no need for VSTO
  • Usable with .NET version 2.0 or higher
  • Easy Addin Development
like image 108
Carlos Quintanilla Avatar answered Sep 22 '22 03:09

Carlos Quintanilla