How to convert xlsm to png
How to Convert an Xlsm File to a Png Image
Sheetize 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 Sheetize for Xlsm‑to‑Png Conversion?
- Full fidelity – retains cell formatting, colors, charts, and embedded images.
- Lossless raster – PNG preserves every pixel without compression artifacts, making it ideal for screenshots and web graphics.
- Fast & scalable – optimized for .NET, runs on Windows, macOS, and Linux without requiring Office installations.
- Customizable resolution & transparency – set DPI and optionally enable an alpha channel for transparent backgrounds.
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 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 color (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 colored UI elements.
- Verify the generated PNG in a browser or image editor to ensure colors, transparency, and resolution meet your expectations.