Free .NET Library for Creating Word Processing Documents

Read, Write, Manipulate & Convert Word files via Open Source .NET API.

NetOffice is an open source API that allows .NET developers to automate Microsoft Office and develop Microsoft Office Add-ins. Using the API, the developer can use all the features included in MS Office versions 2000, 2002, 2003, 2007, 2010, 2013 and 2016. The API is based on COM-architecture wher you retrieve COM proxy objects in your application and you have to free every COM proxy object. The main advantage of using NetOffice is the ability to work with different version of Microsoft Office at a single time and it offers protection mechanism for management of COM proxies.

Using the API, you can develop application for both 32-bit and 64-bit operating system. You can use the NetOffice assemblies in all the scenarios and without any worries. The API provides a bunch of of libraries to manipulate office documents. In order to work with Microsoft Word document, you need to WordApi.dll with OfficeApi.ddl, VBIDEApi.dll, and NetOffice.dll as dependencies.

Previous Next

Getting Started with NetOffice

First of all, you require to have .NET Framework 4.5 or above. After that, please download the repository manually from GitHub or install it from NuGet.

Installation  NetOffice from NuGet

 Install-Package NetOfficeFw.Word

Create Word Document using Free C# API

NetOffice allows .NET programmers to create Microsoft Word File programmatically. In order to create and word file, first you need to initialize an Word.Application and turn off message boxes. After your word applicaiont is started you can add a new document in it using WordApplicaiton.Documents.Add() method. You can insert text in your newly created word file using WrodApplication.Selection.TypeText() method and set font using WordApplicaiton.Selection.Font() method. Once you are done with your document, you can save it using Document.SaveAs() method.

Installation  NetOffice from NuGet

 Install-Package NetOfficeFw.Word

Create a Table in Word using C#

NetOffice allows .NET programmers to add Tables in Microsoft Word File programmatically. In order to add tables in word file first you need to initialize an Word.Application and turn off message boxes and add new document using WordApplicaiton.Documents.Add() method. You can insert table in your newly created word file by initializing Word.Table and set table range using Tables.Add(wordApplication.Selection.Range, 3, 2) method. You can inset text in your cells by selecting a specific cell using table.Cell(1, 1).Select() and insert text in it. Once you are done with your document, you can save it using Document.SaveAs() method.