Runnable C# examples for IronWord, a .NET library for creating, reading, and editing DOCX files without Microsoft Word or Office Interop.
dotnet add package IronWordusing IronWord;
using IronWord.Models;
// Create a new document with a styled paragraph
var doc = new WordDocument();
var paragraph = new Paragraph();
paragraph.AddTextRun(new TextRun("Hello, IronWord!"));
paragraph.AddTextRun(new TextRun(" Bold goes here.", new TextStyle { IsBold = true }));
doc.AddParagraph(paragraph);
doc.SaveAs("hello.docx");To open an existing document instead, use new WordDocument("existing.docx"). Inserting images works similarly — construct an Image from a file or stream, set Width and Height, and add it to a paragraph with paragraph.AddImage(image).
For production use, set a license key via License.LicenseKey = "YOUR-KEY". Without one, documents include a watermark.
Each folder contains a self-contained .NET project you can open and run:
examples/— focused snippets demonstrating individual featuresget-started/— minimal first projects covering installation and basic document creationhow-to/— task-oriented guides for specific document operationsquickstart/— end-to-end project scaffoldstutorials/— longer walkthroughs combining multiple features (including thedocument-elementtutorial covering paragraphs, runs, images, shapes, and tables)
- Creating and loading DOCX files
- Adding paragraphs, text runs, and styled text (font, size, color, bold, italic, underline, strikethrough)
- Inserting images and shapes with positioning and text wrap
- Building and editing tables: rows, columns, cell merging, borders, shading
- Page setup: paper size, orientation, margins, background color
- Bullet and numbered lists with custom indentation and nesting
- Find-and-replace and content extraction for data processing
- Saving to file,
MemoryStream, orbyte[]for HTTP delivery
.NET 10, 9, 8, 7, 6, 5, .NET Core 2x/3x, .NET Standard 2, and .NET Framework 4.6.2+. Windows, macOS, Linux, Docker, Azure, and AWS. See the installation docs for environment-specific notes.
- Full documentation: ironsoftware.com/csharp/word/docs
- API reference: ironsoftware.com/csharp/word/object-reference/api
- Issues with these examples: file directly on this repository
- Product support: support@ironsoftware.com
This repository is maintained by Iron Software. IronWord is a commercial library — see licensing for terms and trial details.