How to convert XLTm to EMF

How to Convert an XLTm File to an EMF Image

Sheetize provides a simple, high‑performance API that lets you turn an Excel macro‑enabled template (.xltm) into a crisp EMF (Enhanced Metafile) picture. This is perfect for generating scalable graphics, embedding workbook previews in documentation, or creating vector‑based reports without exposing the original spreadsheet data.

Why Use Sheetize for XLTm‑to‑EMF Conversion?

  • Full fidelity – retains cell formatting, charts, and embedded images while producing a vector image that scales without loss.
  • Fast & scalable – optimized for .NET, runs on Windows, macOS, and Linux.
  • Customizable resolution – set DPI or scale factor to match your precision needs.
  • Zero‑dependency – no Office installations or external tools required.

Getting Started

Add the Sheetize.ImageConverter package to your .NET project (via NuGet) and call the ImageConverter.Process method.

Sample C# Code

using Sheetize;

var loadOptions = new LoadOptions
{
// Path to the source XLTm file
InputFile = @\"D:\\Templates\\InvoiceTemplate.xltm\"
};

var saveOptions = new ImageSaveOptions
{
// Desired output file – EMF extension selects the EMF format
OutputFile = @\"D:\\Images\\InvoiceTemplate.emf\",

// Optional: control image resolution (DPI) – EMF is vector, but DPI influences default size
HorizontalResolution = 300,
VerticalResolution = 300,

// Optional: scale factor for finer control (1.0 = 100%)
// ScaleFactor = 1.0
};

ImageConverter.Process(loadOptions, saveOptions);

The snippet loads InvoiceTemplate.xltm and writes InvoiceTemplate.emf using the specified resolution (and optional scale factor).

Key Options for EMF Output

  • HorizontalResolution / VerticalResolution – define the reference DPI; higher values give a larger default size before scaling.
  • ScaleFactor – multiplies the overall size of the generated EMF (e.g., 2.0 doubles the dimensions).
  • BackgroundColor – set a background color if the workbook contains transparent areas.

Best Practices

  1. Use 300 DPI or higher when the EMF will be printed; lower DPI is fine for on‑screen previews.
  2. Adjust ScaleFactor if the generated graphic appears too small or large in your target application.
  3. Open the resulting EMF in a vector‑graphics viewer (e.g., Inkscape or Windows Explorer) to verify that all elements render correctly.
 English