WordReporter.NPOI 0.1.2

dotnet add package WordReporter.NPOI --version 0.1.2
                    
NuGet\Install-Package WordReporter.NPOI -Version 0.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WordReporter.NPOI" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WordReporter.NPOI" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="WordReporter.NPOI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WordReporter.NPOI --version 0.1.2
                    
#r "nuget: WordReporter.NPOI, 0.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WordReporter.NPOI@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WordReporter.NPOI&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=WordReporter.NPOI&version=0.1.2
                    
Install as a Cake Tool

Description

The WordReporter.NPOI NuGet package provides an easy way to generate Word documents based on templates using the NPOI library. It allows you to quickly and effortlessly fill templates with data and save them in .docx format.

Installation

You can install the package via the NuGet Package Manager by running the following command:

Install-Package WordReporter.NPOI

Or using the .NET CLI:

dotnet add package WordReporter.NPOI

Usage

Code Example

Here’s an example of how to use the package to generate a Word document based on a template:

// Path to the template and resulting file
string templatePath = "path_to_template.docx";
string resultPath = "path_to_result.docx";

// Data to be filled into the template
var data = new
{
    // Your data
};

// Create an instance of XWPFTemplate with the specified template
var template = new XWPFTemplate(templatePath);

// Generate the document using the provided data
template.Generate(data);

// Save the generated document to a file
using var t = new FileStream(resultPath, FileMode.Create, FileAccess.Write);
template.SaveAs(t);

Parameter Descriptions

  • templatePath: The path to the template file, which should be in .docx format.
  • resultPath: The path to the file where the generated document will be saved.
  • data: An object containing the data to fill the template. Ensure that the fields of the object correspond to the placeholders in the template.

Dependencies

  • .NET 8.0.
  • NPOI

License

This project is licensed under the Apache License, Version 2.0. You can find the full license text in the LICENSE file.

Additional Information

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 192 11/1/2024
0.1.0 178 11/1/2024