Spire.Doc for .NET

.NET Word API - Processing Word in C#, VB.NET, ASP.NET

  • Overview
  • Features
  • Examples
  • Guideline
  • Support
  • What's New
  • Live Demo

Professional .NET Word Library
Without Installing Microsoft Word

Over 1,000,000 Developers Are Already Using Our Libraries
To Create Their Amazing Applications.

Spire.Doc for .NET is a professional Word .NET library specifically designed for developers to create, read, write, convert, compare and print Word documents on any .NET platform (Target .NET Framework, .NET Core, .NET Standard, .NET 5.0, .NET 6.0, Xamarin & Mono Android) with fast and high quality performance.


As an independent Word .NET API, Spire.Doc for .NET doesn't need Microsoft Word to be installed on neither the development nor target systems. However, it can incorporate Microsoft Word document creation capabilities into any developers' .NET applications.


Spire.Doc for .NET is a proven reliable MS Word API for .NET which enables to perform many Word document processing tasks. It supports C#, VB.NET, ASP.NET and ASP.NET MVC. Spire.Doc supports Word 97-2003 /2007/2010/2013/2016/2019 and it has the ability to convert them to commonly used file formats like XML, RTF, TXT, XPS, EPUB, EMF, HTML and vice versa. Furthermore, it supports to convert Word Doc/Docx to PDF using C#, Word to SVG, Word to PostScript, Word to PCL (Printer Command Language) in high quality.

  • Convert

  • Compare

  • Extract

  • eSign

  • Watermark

  • Replace

  • Mail Merge

  • Highlight

  • Header

  • Form

Convert Word to PDF

PDF files are preferred over Word documents because they are safe, simple to open, and easy to manage on any device. PDF is the most popular file format that users would convert Word to.

Compare Documents

If you receive two nearly-identical Word documents, the ideal way to determine whether there are any differences between them is to compare the two documents.

Extract Text and Images

When you just need to get the information in a Word document regardless of its format and structure, you can simply extract the text and images from the document.

Digitally Sign Documents

A digital signature provides assurances about the validity and authenticity of your Word documents. Once a Word document is digitally signed, any changes to the document will invalidate the signature.

Add a Watermark

A watermark is used to declare confidentiality, copyright, or other attributes of the document, or as a decoration to make the document more attractive. You can add either text or image watermarks to Word documents.

Replace Text

The ability to replace existing text (or placeholders) in a Word document makes it possible for programmers to quickly generate Word reports or documents based on a template.

Mail Merge

Mail Merge is a handy feature that allows you to quickly produce multiple documents, such as letters or emails, using information stored in a list, spreadsheet or database.

Find and Highlight

If you want to emphasize some words, you can find and highlight them in a bright color so that the readers could catch them easily.

Headers and Footers

Headers and footers are useful for including information that you want to appear on every page of a document, such as company logo or page number.

Create a Form

Form fields make it easier to collect information. Users can enter information by choosing an item from a drop-down list, inserting text in a combo box, or checking a check box.

.NET

Standalone .NET API

100% independent .NET Word class library
Doesn't require Microsoft Office installed on system.

VERSION

  • Word 97-03
  • Word 2007
  • Word 2010
  • Word 2013
  • Word 2016
  • Word 2019

OPERATION

Powerful Toolset, Multichannel Support

  • Mail Merge, Create Field, Fill Field, Update Field

  • Protect, Encrypt, Decrypt

  • Create, Modify, Remove hyperlink

  • Insert, Edit, remove bookmark

  • Find Replace Highlight

  • Merge and Split Word document

  • Header and Footer

  • Insert, Reply, remove comment

  • Create & Update Table

  • Print Word Document

  • Image and Shape

  • Digital Signature

CONVERSION

Conversion File Documents with High Quality

  • PDF

  • XPS

  • EPUB

  • SVG

  • PCL

  • Image

Doc/Docx

  • ODT

  • XML

  • HTML

  • RTF

  • TXT

  • PNG

  • BMP

  • JPEG

  • EMF

  • TIFF

MAIN FUNCTION

Only Spire.Doc,
No Microsoft Office Automation

Spire.Doc for .NET is a totally independent .NET Word class library which doesn't require Microsoft Office installed on system. Microsoft Office Automation is proved to be unstable, slow and not scalable to produce MS Word documents. Spire.Doc for .NET is many times faster than Microsoft Word Automation and with much better stability and scalability.

Convert File Documents with High Quality

By using Spire.Doc for .NET, users can save Word Doc/Docx to stream, save as web response and convert Word Doc/Docx to XML, RTF, EMF, TXT, XPS, EPUB, HTML, SVG, ODT and vice versa. Spire.Doc for .NET also supports to convert Word Doc/Docx to PDF and HTML to image.

Richest Word Document Features Support

A common use of Spire.Doc for .NET is to create Word document dynamically from scratch. Almost all Word document elements are supported, including page, sections, headers, footers, digital signature, footnotes, paragraphs, lists, tables, text, fields, hyperlinks, bookmarks, comments, images, styles, background settings, printing features, document settings and protection. Furthermore, drawing objects including shapes, textboxes, images, OLE objects, Latex Math Symbols, MathML Code and controls are supported as well.

Simple & Easy to Process Pre-Existing Word Documents

Spire.Doc for .NET enables developers to process pre-existing Word documents. It supports search and replace function, alignment, page break, fill field, document concatenate, document copy, print, complex and deeply nested mail merge, etc.

High Performance

High quality conversion.
High quality printing.
High processing speed.

Other Technical Features

By using Spire.Doc, developers can build any type of a 32-bit or 64-bit .NET application including ASP.NET, Web Services, WinForms, Xamarin and Mono Android, to create and handle Word documents.

Pro Edition $999

Pro Edition supports converting files from Word to PDF, HTML to Word, Word to HTML, Word to XPS, Word to Text, Word to Image, Word to SVG and Word to XML(the Word can be either .Doc or .Docx).

Standard Edition $799

Unlike Pro Edition, the Standard Edition doesn't support appending HTML to Word, print or conversion of any kind mentioned above.

Standard Edition doesn't work on .NET Core, Microsoft Azure.

Free Edition $0

Free version is limited to 500 paragraphs and 25 tables. This limitation is enforced during reading or writing files.

When converting word documents to PDF and XPS files, you can only get the first 3 page of PDF file.

* The Differences between Standard and Pro Edition lie in the feature of Print function and File Conversion.

GET STARTED

Free Trials for All Progress Solutions

Here is a brief summary of Spire.Doc for .NET features.

Technical Features

Spire.Doc for .NET enables developers/programmers to build WinForms, Web Services, ASP.NET and other type for .NET applications from version 2.0 to 4.5, .NET 5.0 and .NET 6.0 on 32-bit or 64-bit system.From Spire.Doc v 6.7.4, Spire.Doc starts to support .NET Core, .NET standard, MonoAndroid and Xamarin.iOS.

Generating, Writing, Editing and Saving

Spire.Doc for .NET enables quick generating, saving, writing and editing Word documents.

Converting

Spire.Doc for .NET enables converting Word documents to most common and popular formats.

Inserting, Editing and Removing Objects

Spire.Doc for .NET enables to inserting, editing and removing external objects in Word.

Formatting

Spire.Doc for .NET enables formatting contents in documents, including character, paragraphs, pages and whole document.

Mail Merge

Spire.Doc for .NET enables executing mail merge function to create records, orders and reports.
  • Perform simple mail merge fields (name and value) to create single item.
  • Execute mail merge to create a group of data records with connecting customized data source.
  • Populate document with data from .NET data source including DataSet, DataTable, DataView or any other files (for example, xml) to create large amounts of records or report by using mail merge.

Feature Details

Support Word97~2003 Word2007 Word2010 Word2013 Word2016
Operation Create New Document Edit Existing Document
Save to file Save to stream Save as web response
Document Properties Setup Document Print Setup
Multiple Section Page Break
Document Copy Multiple Document Concatenate
Encrypt Document Decrypt Document
Globally Search Globally Replace
Mail Merge Nested Mail Merge Customize Mail Merge Fill Field
Format and Style Font Color Highlight
Indent List Text Alignment
Building Style Named Style
Content Image Hyperlink Comments Bookmark
Table Table of Content Foot Note Ole Object
Header (Text/Image/Table) Footer (Text/Image/Table)
CheckBoxFormField DropDownFormField TextFormField Textbox
TextWaterMark ImageWaterMark Field (91 types) HTML
Convert Src Type Open Save Dest Type
Doc Dot Docx Xml Txt Html PDF Rtf EPUB
Doc
Dot
Docx
Xml
Txt
Html
PDF × × × × × × × × × ×
Rtf
EPUB × × × × × × × × × ×
Not supported in Standard Edition

Beginners Guide is the first step towards learning the basic information of Spire.Doc for .NET

Program Guide lists the detailed features of our Spire.Doc for .NET and you can search for the information you want.

The Videos give an operation guide by video. You can check the produce step by step.

Main Functions contain the main features of our Spire.Doc for .NET and you can have brief information of it.

Frequently asked question for Spire.Doc of technical and function issues.

We guarantee one business day Forum questions Reply.

We guarantee one business day E-mail response.

Free Customized service for OEM Users.

Skype name: iceblue.support

Apply for a Free Trial License File.

To help you get started quickly, we offer free customized demos to our customers. Please contact support@e-iceblue.com for the free demo. Make sure the demo you want meets the below requirements.
  • It relates to our components stored on E-iceblue online store.
  • It costs less than 2 hours for us to complete it. If it costs more than 2 hours, please contact our sales@e-iceblue.com

If you have tried out Spire.Doc and found it useful, please consider sharing your experience with others. By sharing your testimonial with us, you will not only help others to make the right decision but will also to earn rewards from us. Please send your testimonials to sales@e-iceblue.com.

This is the list of changelogs of Spire.Doc New release and hotfix. You can get the detail information of each version's new features and bug solutions.

Download Spire.Doc to start a free trial:

Hot Fix Version: 12.1.17

Category ID Description
New feature SPIREDOC-9979
SPIREDOC-10058
The left and right indentation function of the paragraph supports the option of setting the number of characters.
// Set left indentation by character count
paragraph.Format.LeftIndentChars = 10;
// Set right indentation by character count
paragraph.Format.RightIndentChars = 10;
Bug SPIREDOC-3363 Fixes the issue that the content format was incorrect when converting Word documents to PDF documents.
Bug SPIREDOC-3363
SPIREDOC-10083
Fixes the issue that the font changed when converting Word documents to PDF documents.
Bug SPIREDOC-9136 Fixes the issue that the document structure tags were lost when converting Word documents to PDF documents.
Bug SPIREDOC-9718 Fixes the issue that the fonts of formula content in saved Docx documents had extra italic effects.
Bug SPIREDOC-9756 Fixes the issue that the program threw System.ArgumentException when converting Word documents to HTML documents.
Bug SPIREDOC-10001 Fixes the issue that table border changed when converting Word documents to PDF documents.
Bug SPIREDOC-10016 Fixes the issue that there was an extra blank paragraph after replacing bookmark content.
Bug SPIREDOC-10084 Fixes the issue that font bold style was lost when converting Word documents to PDF documents.
Bug SPIREDOC-10110 Fixes the issue that the program threw System.ArgumentOutOfRangeException when loading Doc documents.
Bug SPIREDOC-10111 Fixes the issue that content was indented when converting Word documents to PDF documents.
Bug SPIREDOC-10119 Fixes the issue that getting codes in cross-reference fields failed.
Bug SPIREDOC-10132 Fixes the issue that the program threw System.ArgumentOutOfRangeException when getting FixedLayoutDocument objects in blank documents.
Bug SPIREDOC-10195 Fixes the issue that the program threw System.NullReferenceException when deleting bookmark content after copying documents.

Hot Fix Version: 12.1.5

Category ID Description
Adjustment - Removes MonoAndroid package and Xamarin.iOS package; netstand 2.0 package is now available for both platforms.
Adjustment - The following changes have been made to the document password function:

1. In previous versions, when dealing with password-protected documents, users were able to open and save documents with the provided password, but this also resulted in the loss of the password. The update fixes this problem. Now, after saving a document, you must re-enter the password to open it. If you want to remove the open password from the document, please use the Document.RemoveEncryption() method. This change provides more secure handling of encrypted documents.

2. New WriteProtection operation: Previous versions of the SDK did not support WriteProtection operations on Word documents, resulting in the loss of WriteProtection data when parsing the document. However, this update addresses this limitation and introduces several methods for handling WriteProtection. The following methods support handle WriteProtection efficiently:

  • Document.SetWriteProtection(string password): sets WriteProtection for the document using the specified password.
  • Document.SetWriteProtection(string password, bool recommended): sets WriteProtection for the document using the specified password and allows to enable or disable read-only recommendation.
  • Document.UnWriteProtection(): completely remove WriteProtection from the document.
  • Document.UnWriteProtection(string password): attempts to remove WriteProtection from the document using the supplied password.
  • Document.HasWriteProtection(): Checks if the document is write-protected.
These new methods allow you to easily manage the WriteProtection settings of Word documents, increasing the security and control of document editing.
Bug - Fixes the issue that some data was lost when loading a document after creating a new Document() object and applying a LicenseKey.
Bug - Fixes some issues that were related to form revisions.

Hot Fix Version: 11.12.4

Category ID Description
New feature - Adds text shaping function for converting Word to PostScript (.NET 4.6.2 or later version supported).
Document document = new Document();
document.LoadFromFile("input.docx");
document.LayoutOptions.UseHarfBuzzTextShaper = true; // Enable with true, disable with false
document.SaveToFile("output.ps", FileFormat.PostScript);

Hot Fix Version: 11.12.2

Category ID Description
New feature - Supports text shaping in Word to PCL conversion (.NET 4.6.2 or later version supported).
Document document = new Document();
document.LoadFromFile("input.docx");
document.LayoutOptions.UseHarfBuzzTextShaper = true; // Enable with true, disable with false
document.SaveToFile("output.pcl", FileFormat.PCL);
New feature SPIREDOC-10007 Supports determining if a document is encrypted.
Document.IsPassWordProtected("sample.docx");
Bug SPIREDOC-9615 Fixes the issue that line breaks were not correctly positioned after converting Word to PDF .
Bug SPIREDOC-9859
SPIREDOC-9890
Fixes the issue that Latex formulas were not parsed correctly.
Bug SPIREDOC-9976 Fixes the issue that finding text with regular expression failed to match.
Bug SPIREDOC-9981 Fixes the issue that table borders were missing after converting Word to XPS.
Bug SPIREDOC-9997 Fixes the issue that symbols were incorrectly recognized as English characters when converting HTML to Word.
Bug SPIREDOC-10029 Fixes the issue that the result calculated from the populated data was incorrect after executing mail merge.
Bug SPIREDOC-10036 Fixes the issue that the content of the table header was cropped when converting Word to PDF.
Bug SPIREDOC-10037 Fixes the issue that the width of the table was changed after adding rows to the table and converting it to PDF.
Bug SPIREDOC-10039 Fixes the issue that the program threw System.ArgumentException when copying bookmark contents.
Bug SPIREDOC-10081 Fixes the issue that the program threw System.NullReferenceException when copying bookmark content.

Hot Fix Version: 11.11.0

Category ID Description
Bug SPIREDOC-9369 Fixes the issue that the content formatting was incorrect after converting Word to PDF.
Bug SPIREDOC-9456 Fixes the issue that the pagination was incorrect after converting Word to PDF.
Bug SPIREDOC-9594 Fixes the issue that the content was not correct after converting HTML to PDF.
Bug SPIREDOC-9716 Fixes the issue that the program threw System.ArgumentException when converting ODT to PDF.
Bug SPIREDOC-9764 Fixes the issue that the page numbers of the table of contents were incorrectly positioned after merging Word documents and converting them to PDF.
Bug SPIREDOC-9765 Fixes the issue that the formatting of the table of contents was incorrect after merging Word documents and converting them to PDF.
Bug SPIREDOC-9869 Fixes the issue that images were not displayed after converting HTML to PDF.
Bug SPIREDOC-9906 Fixes the issue that the content of OLE objects cloned from RTF documents to Docx documents was not displayed completely.
Bug SPIREDOC-9909 Fixes the issue that the program threw System.InvalidOperationException when converting Word to image/PDF.
Bug SPIREDOC-9923 Fixes the issue that the newly added rows were not aligned after adding new rows to a Word table and converting it to PDF.
Bug SPIREDOC-9924 Fixes the issue that the program threw System.IndexOutOfRangeException when modifying the content of a Word table and converting the document to PDF.
Bug SPIREDOC-9934 Fixes the issue that editing restrictions were lost after saving a Doc format document as a new document.

Hot Fix Version: 11.10.7

Category ID Description
Bug SPIREDOC-9831 Fixes the issue that Thai characters were not aligned and wrapped when converting Word to PDF.

Hot Fix Version: 11.10.3

Category ID Description
New feature - Added the feature of text formatting when converting Word to PDF (mainly for handling Thai characters and Tibetan characters), and support for .NET 4.6.2 and above, .NET Core, and .NET Standard platforms.
Document doc = new Document();
doc.LoadFromFile(fileName);
doc.LayoutOptions.UseHarfBuzzTextShaper = true;
doc.SaveToFile(pdfFileName, Spire.Doc.FileFormat.PDF)

Hot Fix Version: 11.9.19

Category ID Description
Bug SPIREDOC-9455 Fixes the issue that the content was incorrect after adding a footer copied from another document to a document and then converting it to a PDF document.
Bug SPIREDOC-9466 Fixes the issue that extra shapes appeared after loading a document and saving it as a new document.
Bug SPIREDOC-9699 Fixes the issue that the font of a document changed after updating the fields in the document and converting it to PDF.
Bug SPIREDOC-9743 Fixes the issue that extra pictures appeared after loading a document and saving it as a new document.
Bug SPIREDOC-9767 Fixes the issue that recognizing the Latex formula code "therefore" failed.
Bug SPIREDOC-9800 Fixes the issue that the program threw System.StackOverflowException when loading a document.
Bug SPIREDOC-9833 Fixes the issue that the content was garbled after converting Doc documents to PDF documents.
Bug SPIREDOC-9834 Fixes the issue that the program threw System.NullReferenceException when converting Docx documents to PDF documents.
Bug SPIREDOC-9836 Fixes the issue that the program threw System.NullReferenceException when replacing text.
Bug SPIREDOC-9852 Fixes the issue that extra pictures appeared after replacing text and saving the document to PDF.
Bug SPIREDOC-9861 Fixes the issue that the program failed to recognize the "<" MathML format in HTML content.
Bug SPIREDOC-9869 Fixes the issue that pictures were lost after converting an HTML document to a PDF document.
Bug SPIREDOC-9878 Fixes the issue that the symbols were rotated after converting Docx documents to PDF documents.

Hot Fix Version: 11.8.18

Category ID Description
New feature SPIREDOC-9778 Improves the efficiency of document storage.
Bug SPIREDOC-9769 Fixes the issue that the content layout of the result documents generated in .NET 7.0 projects was incorrect.

Hot Fix Version: 11.8.11

Category ID Description
New feature SPIREDOC-9057 Supports converting math formulas to OfficeMathMLCode.
    Document doc = new Document();
            doc.LoadFromFile("1.docx");
            StringBuilder stringBuilder = new StringBuilder();

            foreach (Section section in doc.Sections)
            {
                foreach (Paragraph par in section.Body.Paragraphs)
                {
                    foreach (DocumentObject obj in par.ChildObjects)
                    {
                        OfficeMath omath = obj as OfficeMath;
                        if (omath == null) continue;
                        string mathml = omath.ToOfficeMathMLCode();
                        stringBuilder.Append(mathml);
                        stringBuilder.Append("\r
");
                    }
                }
            }
            File.WriteAllText("1.txt", stringBuilder.ToString());
            doc.Close();
New feature SPIREDOC-9710 Supports adding hyperlinks to images in mail merge.
Document doc = new Document();
                doc.LoadFromFile("Test.docx");
                var fieldNames = new string[] { "MyImage" };
                var fieldValues = new string[] { "logo.png" };

                doc.MailMerge.MergeImageField += new MergeImageFieldEventHandler(MailMerge_MergeImageField);

                doc.MailMerge.Execute(fieldNames, fieldValues);

                doc.SaveToFile("result.docx", FileFormat.Docx);
            }

            void MailMerge_MergeImageField(object sender, MergeImageFieldEventArgs field)
            {
                string filePath = field.FieldValue as string;
                if (!string.IsNullOrEmpty(filePath))
                {
                    field.Image = Image.FromFile(filePath);
                    field.ImageLink = "https://www.e-iceblue.com/";
                }

            }
Bug SPIREDOC-6013 Fixes the issue that loading Word documents threw a System.InvalidOperationException exception.
Bug SPIREDOC-8541 Fixes the issue that converting Word to PDF caused inconsistent pagination.
Bug SPIREDOC-8587 Fixes the issue that converting Word to PDF threw a System.NullReferenceException exception.
Bug SPIREDOC-9197 Fixes the issue that exporting Docx files from Sparrow and converting them to HTML files failed.
Bug SPIREDOC-9213 Fixes the issue that page number fields could not be automatically updated after insertion.
Bug SPIREDOC-9253 Fixes the issue that list characters were displayed incorrectly when converting HTML to Doc.
Bug SPIREDOC-9310 Fixes the issue that line break tags were ignored when converting HTML to Doc.
Bug SPIREDOC-9400 Fixes the issue that logos were lost when converting Docx to PDF.
Bug SPIREDOC-9627 Fixes the issue that loading RTF documents threw a System.NullReferenceException exception.
Bug SPIREDOC-9640 Fixes the issue that the symbol "~" in LaTeX formulas was parsed incorrectly.
Bug SPIREDOC-9641 Fixes the issue that TOC was split across multiple pages when converting Word to PDF.
Bug SPIREDOC-9684 Fixes the issue that images were blurry when converting Docx to HTML.
Bug SPIREDOC-9712 Fixes the issue that extra text appeared when converting Word to PDF.
Bug SPIREDOC-9755 Fixes the issue that content was inconsistent after loading and saving a document.
Bug SPIREDOC-9761 Fixes the issue that the program hung when inserting HTML strings.
Request free customized demo just for you.

Tab 1

Upload

Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
fileerrors

Convert to

Source file:
filename
Target file type:

Tab 2

Upload

Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
fileerrors

Convert to

Source file:
filename
Search Text:

Tab 3

Tab 4

Data

e-iceblue

Option

Header Back Color:
Row Back Color:
Alternation Back Color:
Border Color:
downloads

Tab 5

Agreement Start Date:
Agreement End Date:
Agreement Extension Date:
Documentation Start Date:
Documentation End Date:
downloads

Tab 6

Upload

Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
Source file:
filename
fileerrors

Set text watermark

Text:
Font:
Font Size:
Color:
downloads

Set image watermark

Image:
Click here to browse files
downloads

If you don't find the function you want, please fill in a form to request a free demo from us. Make sure the demo you want meets the following requirements:

  • It is a small project that implements a particular scenario.
  • It relates to our libraries stored on E-iceblue online store.
  • It costs less than 2 hours for us to complete it.
  • It is not a bug report.
  • It is not a feature request.