Convert Excel to High-Resolution Image

Contents
[ ]

With the increasing prevalence of high-resolution screens, images generated at the default 96 DPI often appear blurry and unclear. To ensure clarity on high-resolution screens, it’s essential to generate images at a higher DPI. Aspose.Cells offers the functionality to set ImageOrPrintOptions.HorizontalResolution and ImageOrPrintOptions.VerticalResolution, allowing you to create high-quality images from Excel files that look sharp on high-resolution displays.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Load the Excel file
Workbook workbook = new Workbook("input.xlsx");
// Create an instance of ImageOrPrintOptions
ImageOrPrintOptions options = new ImageOrPrintOptions
{
// Set horizontal and vertical resolution to 300 DPI
HorizontalResolution = 300,
VerticalResolution = 300,
// Set the image type
ImageType = ImageType.Png,
};
// Get the worksheet
Worksheet sheet = workbook.Worksheets[0];
// Create a SheetRender instance
SheetRender render = new SheetRender(sheet, options);
// Generate and save the image
render.ToImage(0, "output.png");