Converti Excel in Immagine ad Alta Risoluzione
Con la crescente diffusione degli schermi ad alta risoluzione, le immagini generate con il default 96 DPI spesso appaiono sfocate e non chiare. Per garantire la chiarezza sugli schermi ad alta risoluzione, è essenziale generare immagini a una risoluzione più elevata. Aspose.Cells offre la funzionalità di impostare ImageOrPrintOptions.HorizontalResolution e ImageOrPrintOptions.VerticalResolution, permettendoti di creare immagini di alta qualità da file Excel che si presentano nitide sui display ad alta risoluzione.
// 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"); |