Regira Office.Word provides Word document creation from templates, conversion, merging, and content extraction.
| Project | Package | Backend | Create | Convert | Merge | Extract |
|---|---|---|---|---|---|---|
Common.Office |
(transitive) | Shared abstractions | — | — | — | — |
Word.Spire |
Regira.Office.Word.Spire |
FreeSpire.Doc | ✓ | ✓ | ✓ | ✓ |
Word.Mini |
Regira.Office.Word.Mini |
MiniWord | ✓ | — | — | — |
<!-- Full-featured (recommended) -->
<PackageReference Include="Regira.Office.Word.Spire" Version="6.*" />
<!-- Lightweight create-only -->
<PackageReference Include="Regira.Office.Word.Mini" Version="6.*" />
IWordService word = new Regira.Office.Word.Spire.WordManager();
byte[] templateBytes = await File.ReadAllBytesAsync("template.docx");
IMemoryFile doc = await word.Create(new WordTemplateInput
{
Template = templateBytes.ToMemoryFile(),
GlobalParameters = new Dictionary<string, object>
{
["CustomerName"] = "Alice",
["InvoiceDate"] = DateTime.Today.ToString("d")
}
});
```csharp no-compile
Task
### IWordConverter
```csharp no-compile
Task<IMemoryFile> Convert(WordTemplateInput input, FileFormat format, CancellationToken cancellationToken = default);
Task<IMemoryFile> Convert(WordTemplateInput input, ConversionOptions options, CancellationToken cancellationToken = default);
```csharp no-compile
Task
### IWordTextExtractor / IWordImageExtractor / IWordToImagesService
```csharp no-compile
Task<string> GetText(WordTemplateInput input, CancellationToken cancellationToken = default);
Task<IEnumerable<WordImage>> GetImages(WordTemplateInput input, CancellationToken cancellationToken = default);
Task<IEnumerable<IImageFile>> ToImages(WordTemplateInput input, CancellationToken cancellationToken = default); // one image per page
Composite of all the above. Word.Spire.WordManager implements this. An [Obsolete] alias IWordManager : IWordService remains for backward compatibility.
| Property | Type | Description |
|---|---|---|
Template |
IMemoryFile |
Source .docx template |
GlobalParameters |
IDictionary<string, object>? |
Simple `` replacements |
CollectionParameters |
IDictionary<string, ICollection<IDictionary<string, object>>>? |
Table row data — key matches a table placeholder in the template |
Images |
ICollection<WordImage>? |
Image replacements (matched by name) |
DocumentParameters |
IDictionary<string, WordTemplateInput>? |
Insert nested documents at bookmarks |
Headers |
ICollection<WordHeaderFooterInput>? |
Page headers |
Footers |
ICollection<WordHeaderFooterInput>? |
Page footers |
Options |
InputOptions? |
Processing behaviour flags |
| Property | Type | Default | Description |
|---|---|---|---|
InheritFont |
bool |
false |
Apply template’s Normal style font to inserted content |
HorizontalAlignment |
HorizontalAlignment? |
null |
Force text alignment |
RemoveEmptyParagraphs |
bool |
false |
Strip blank paragraphs after substitution |
EnforceEvenAmountOfPages |
bool |
false |
Insert page break if page count is odd |
| Property | Type | Default | Description |
|---|---|---|---|
OutputFormat |
FileFormat |
Docx |
Target format |
AutoScaleTables |
bool |
true |
Resize tables to fit new page width |
AutoScalePictures |
bool |
true |
Resize images to fit new page width |
Settings |
DocumentSettings? |
null |
Override page size / orientation / margins |
| Property | Type | Default | Description |
|---|---|---|---|
PageSize |
PageSize |
A4 |
Paper format |
PageOrientation |
PageOrientation |
Portrait |
Orientation |
Margins |
Margins? |
null |
Override margins (in points) |
Docx Doc Dotx Dot Docm Dotm Pdf Html Rtf Odt EPub Jpeg Png
| Property | Type | Description |
|---|---|---|
Name |
string |
Matches image placeholder name in the template |
File |
IMemoryFile? |
Image bytes |
Size |
ImageSize? |
Override image dimensions |
HorizontalAlignment |
HorizontalAlignment? |
Optional image alignment |
| Property | Type | Description |
|---|---|---|
Template |
IMemoryFile |
Template fragment for the header/footer |
Type |
HeaderFooterType |
Default, FirstPage, Even, Odd |
WordManager implements IWordService — the full capability set. Supports HTML parameters (html_* prefix in GlobalParameters injects raw HTML). Converts to PDF, HTML, RTF, ODT, EPUB, and image formats. Handles nested document insertion via DocumentParameters.
Limit: FreeSpire.Doc free edition supports documents up to 500 paragraphs or 25 tables.
WordCreator implements only IWordCreator. Lightweight — uses MiniWord, no conversion or extraction. Works only on net10.0.