Excel in hochauflösendes Bild umwandeln
Mit der zunehmenden Verbreitung hochauflösender Bildschirme erscheinen Bilder, die mit den Standard-DPI von 96 erstellt wurden, oft unscharf und undeutlich. Um auf hochauflösenden Bildschirmen Klarheit zu gewährleisten, ist es wichtig, Bilder bei höherem DPI zu erstellen. Aspose.Cells bietet die Möglichkeit, ImageOrPrintOptions.HorizontalResolution und ImageOrPrintOptions.VerticalResolution zu setzen, um hochwertige Bilder aus Excel-Dateien zu erstellen, die auf hochauflösenden Displays scharf aussehen.
// 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"); |