Free .NET Library for Creating Word Processing Documents
Read, Write, Manipulate & Convert Word Documents 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 where you retrieve COM proxy objects in your application and you have to free e 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.
The API allows to 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 libraries to manipulate office documents. In order to work with Microsoft Word document, you need WordApi.dll with OfficeApi.ddl, VBIDEApi.dll, and NetOffice.dll as dependencies.
At A Glance
An overview of NetOffice features.
- Create Word
- Set Font
- Insert Images
- Insert Tables
- Insert Graphs
- Table of contents
NetOffice supports popular Word Processing file formats listed below.
NetOffice works with .NET Framework 4.0 or higher.
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
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 application 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.
Create a Table in Word using C#
NetOffice allows to add tables in Microsoft Word File programmatically. Initialize Word.Application and turn off message boxes and add new document using WordApplicaiton.Documents.Add() method. You can insert table in 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.