How to Integrate Spire.Office into Your .NET Workflow

How to Integrate Spire.Office into Your .NET Workflow

This guide shows a concise, practical path to add Spire.Office to a .NET project, use its core libraries (Word, Excel, PDF), and automate common document tasks. Examples use C# and .NET 6+; adapt to older frameworks by selecting compatible DLLs or NuGet versions.

1. Choose edition and install

  • Decide: Free (with page/row limits) or commercial Spire.Office.
  • Install via NuGet (recommended) or download DLLs from the vendor.
    • NuGet (Package Manager):

      Code

      Install-Package Spire.Office
    • .NET CLI:

      Code

      dotnet add package Spire.Office

2. Project setup

  • Target .NET 6/7/8+ (or a supported framework listed by the package).
  • Add using directives per component you need:
    • Word: using Spire.Doc;
    • Excel: using Spire.Xls; (or Spire.Spreadsheet)
    • PDF: using Spire.Pdf;
  • If you downloaded DLLs, add references to the appropriate Bin folder matching your target framework.

3. Licensing

  • For production, obtain a license key from E-iceblue and apply per their docs (usually via license file or API call). Free edition works for development/testing but has limits.

4. Typical tasks and sample code

Note: these are minimal, ready-to-run snippets. Add error handling and dispose patterns for production.

  • Create a Word document and save as PDF “`csharp using Spire.Doc; using Spire.Doc.Documents;

var doc = new Document(); Section section = doc.AddSection(); Paragraph p = section.AddParagraph(); p.AppendText(“Hello from

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *