Visual C#.NET: Read Word Document

How to read Word documents using C#.NET
Using Visual C# code to read Microsoft Word documents can be easily achieved if you use our Yiigo.Image for .NET. You may also read PDF documetns & HTML contents. Find more Word reading information on Yiigo.Image for .NET.
Yiigo.Image for .NET has those following functionalities:
  • Load, view any Word document from file, IStream and Stream
  • Extract text, font, and other information from Word document
  • convert Word documents to other formats
  • Save and print Word documents
This document provides comprehensive Visual C#.NET samples for guiding developers to read, print, convert Word files using Yiigo.Image for .NET. Find more Word viewing & conversion tutorials on VB.NET Word Reading, Web Imaging Viewer Word Reading Support and Read Word Documents in .NET Winforms.
Read Word Documents with C#.NET Sample Code

Requirements

Before reading Word documents in Visual C#.NET, make sure that you have installed.
  • Operating systems - Windows 7, Windows Vista, and Windows XP, etc
  • Compatible with .NET framework 2.0 and above versions
  • Support Visual Studio 2005, 2010 and other .NET development environments
  • Yiigo.Image for .NET installation

Start to Read Word Documents

  • Open and run your Microsoft Visual Studio;
  • Choose either "Visual C# Projects" in "New Project" dialog box;
  • Choose "Windows Application" in the "Templates" List and name it "YiigoImagingWordReadCsharp";
  • Right-click on the "References" folder, and select "Add Reference..." from the context menu in the "Solution Explorer" window;
  • In the "Add Reference" dialog box, select the ".NET" tab and browse to Yiigo.Imaging.Net.dll library;
  • Add it to your Visual C# applications;
  • Call Yiigo .NET Image Namespace & Copy those following codes:
using System.IO;
using System.Drawing.Printing;
using Yiigo.Imaging;
using Yiigo.Imaging.Processing;
using Yiigo.Imaging.WordRead;

// load & save a word document
YiigoImage doc= new YiigoImage();
doc.load(@"C:\ yiigo_example.docx");
doc.save(@"C:\ yiigo_example.docx");

//Extract text from Word
public void ExtractText();
{
doc.load(@"C:\ yiigo_example.docx");
doc.PageNumberStart = "0";
doc.PageNumberStop = "4";
doc.OutputFile = OutputFormat.txt;
doc.save(@"C:/extract.txt");
};
public void ExtractText(@"C:\ yiigo_example.docx", "0","4", (@"C:/extract.txt"));

// print a word document
public void Print();
{
doc.load(@"C:\ yiigo_example.docx");
doc.PageNumberStart = "0";
doc.PageNumberStop = "4";
Printer = (@"C:/ HP Color LaserJet 5550 PCL 6");
};
Printer. Print(@"C:\ yiigo_example.docx", "0","4", @"C:/ HP Color LaserJet 5550 PCL 6");
Products
Other Plugins
Image Viewer CoreBarcode PluginPDF Read & WriteTesseract OCR PluginForm Processing PluginJBIG2 CodecJPEG2000 CodecISIS ScannerTwain ScannerDICOM ReaderCAD Scanner