How to convert xlsm to png
How to Convert an Xlsm File to a PNG Image
Sheetise provides a simple, high‑performance API that lets you turn an Excel macro‑enabled workbook (.xlsm) into a crisp PNG (Portable Network Graphics) picture. This is perfect for generating lightweight thumbnails, embedding spreadsheet previews in web pages, or creating lossless raster images for documentation without exposing the original data.
Why Use Sheetise for Xlsm‑to‑Png Conversion?
- Full fidelity – retains cell formatting, colours, charts, and embedded images.
- Lossless raster – PNG preserves every pixel without compression artefacts, making it ideal for screenshots and web graphics.
- Fast & scalable – optimised for .NET, runs on Windows, macOS, and Linux without requiring Office installations.
- Customisable resolution & transparency – set DPI and optionally enable an alpha channel for transparent backgrounds.
Getting Started
Add the Sheetise.ImageConverter package to your .NET project (via NuGet) and call the ImageConverter.Process method.
Sample C# Code
using Sheetise;
var loadOptions = new LoadOptions
{
// Path to the source Xlsm file
InputFile = @"D:\Reports\SalesDashboard.xlsm"
};
var saveOptions = new ImageSaveOptions
{
// Desired output file – .png extension selects the PNG format
OutputFile = @"D:\Images\SalesDashboard.png",
// Optional: control image resolution (DPI)
HorizontalResolution = 200,
VerticalResolution = 200,
// Optional: enable a transparent background (default is opaque white)
// BackgroundColor = "transparent"
};
ImageConverter.Process(loadOptions, saveOptions);The snippet loads SalesDashboard.xlsm and writes SalesDashboard.png using the specified DPI (and optional transparency).
Key Options for PNG Output
- HorizontalResolution / VerticalResolution – define the reference DPI; higher values give sharper on‑screen or printed results.
- BackgroundColor – set a solid colour (e.g.,
#FFFFFF) or"transparent"to enable an alpha channel. - CompressionLevel – PNG supports lossless compression; values typically range from 0 (quickest) to 9 (maximum compression).
Best Practices
- Use 150 – 200 DPI for web‑ready images; go higher (300 DPI or more) for print‑quality graphics.
- Enable a transparent background when the PNG will be overlaid on coloured UI elements.
- Verify the generated PNG in a browser or image editor to ensure colours, transparency, and resolution meet your expectations.