This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/pdf-generation/spreadsheet-template-to-pdf-ua.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Generating PDF/UA from Excel templates | Nutrient .NET SDK

This guide explains how to process an Excel template with JSON data and convert the generated workbook to PDF/UA.

Use this workflow for invoices, statements, reports, and other workbooks that share the same worksheet structure. The template keeps layout, formulas, and formatting in the Excel file, while the JSON model provides the variable content.

PDF/UA (Universal Accessibility) helps generated PDFs meet accessibility requirements for standards and policies such as Section 508, ADA, and EN 301 549.

Download sample

Preparing the project

Initialize licensing before you process templates or convert documents:

using GdPicture14;
LicenseManager license = new LicenseManager();
license.RegisterKEY(""); // Set your license key

Setting up template processing

Create a GdPictureOfficeTemplater instance and load the JSON data model:

GdPictureOfficeTemplater templater = new GdPictureOfficeTemplater();
templater.SetTemplate(System.IO.File.ReadAllText("input_spreadsheet_model.json"));

The templater uses the JSON values to replace placeholders in the Excel template.

Loading and processing the template document

Process the Excel template in three steps.

Step 1 — Loading the template

Load the .xlsx template before applying the JSON model:

templater.LoadFromFile(@"input_spreadsheet.xlsx");

LoadFromFile reads the workbook into memory and detects the Excel format.

Step 2 — Processing template markers

Apply the data model to resolve placeholders and loop rows:

templater.Process();

Process resolves placeholders using the JSON model, repeats loop rows for collection data, and preserves cell types, formatting, and layout.

Step 3 — Saving the processed XLSX

Save the generated workbook as a new .xlsx file:

templater.SaveToFile(@"output.xlsx");

SaveToFile writes the processed result as a new Excel workbook.

Converting to PDF/UA

Convert the processed XLSX file to a PDF/UA document:

using GdPictureDocumentConverter converter = new GdPictureDocumentConverter();
converter.LoadFromFile(@"output.xlsx");
converter.SaveAsPDF(@"output.pdf", PdfConformance.PDF_UA_1);

The converter loads the generated workbook and writes output.pdf with PDF/UA-1 conformance.

Key features

This workflow covers the following tasks:

  • Generate a workbook from an Excel template and JSON data.
  • Replace placeholders and repeat row loops.
  • Preserve cell types for numbers, dates, percentages, and Booleans.
  • Preserve formatting and layout from the source template.
  • Convert the generated XLSX file to PDF/UA.

Conclusion

You now have a workflow for generating an Excel workbook from JSON data and converting it to PDF/UA. Use this pattern when you have a fixed worksheet design and variable content that comes from a data model.