FileFormat.Words for .NET
Simplify Document Creation and Customization with .NET API
A user-friendly, easy and Open Source C# .NET API that lets you create and edit Microsoft Word Document files without needing Microsoft Word.
FileFormat.Words for .NET is an easy and user-friendly Open-Source .NET API designed for effortless creation and customization of Microsoft Word documents. This intuitive C# library lets you generate and manipulate Word documents using just a few lines of code.
The installation process of this lightweight solution is seamless and offers a stack of features to cater to all your document requirements. FileFormat.Words leverage the OpenXML SDK, a technology endorsed by Microsoft. FileFormat.Words for .NET serves as a convenient wrapper that simplifies the utilization of its advanced capabilities.
Designed with developers in mind, this Open-Source .NET library empowers you to extend its capabilities by leveraging the OpenXML SDK library. FileFormat.Words for .NET. Handling FileFormat.Words for .NET is straightforward, thanks to its user-friendly design. The library boasts a range of intelligent features, including adding new paragraphs, applying text formatting, inserting, resizing, and rotating images, extracting images, modifying document properties, and much more.
Explore our GitHub repository to contribute, suggest improvements, and enhance this Open Source API: https://github.com/fileformat-words/FileFormat.Words-for-.NET
Getting Started with FileFormat.Words for .NET
The recommend way to install FileFormat.Words for .NET is using NuGet. Please use the following command for a smooth installation.
Install FileFormat.Words for .NET via NuGet
NuGet\Install-Package FileFormat.Words
You can also download it directly from github.Creating a Word Document Programmatically
The following code snippet creates an empty Word document programmatically.
Create a word document via .NET API
// Create an instance of the Document class.
Document doc = new Document();
// Invoke the Save method to save the Word document onto the disk.
doc.Save("/Docs.docx");
Add some text to a Word document
The following code snippet adds some text to a document programmatically.
Create a word document paragraph via .NET API
// Create an instance of the Document class.
using (Document doc = new Document())
{
//Initialize the constructor with the Document class object.
Body body = new Body(doc);
// Instantiate an instance of the Paragraph class.
Paragraph para1 = new Paragraph();
// Set the text of the paragraph.
para1.AddRun(new Run { Text = $"This is a Paragraph." });
// Invoke AppendChild method of the body class to add a paragraph to the document.
body.AppendChild(para1);
// Call the Save method to save the Word document onto the disk.
doc.Save("/Docs.docx");
}
More Code Examples and Resources
Explore more detailed code examples at FileFormat Gists. For all resources including API reference and articles, please visit GitHub Pages.