Excelを高解像度画像に変換する
Contents
[
Hide
]
高解像度スクリーンの普及により、デフォルトの96 DPIで生成された画像はしばしばぼやけて不鮮明に見えます。高解像度スクリーンでの鮮明さを保つためには、より高いDPIで画像を生成することが重要です。Aspose.CellsはImageOrPrintOptions.HorizontalResolutionとImageOrPrintOptions.VerticalResolutionを設定できる機能を提供し、高品質な画像を作成して高解像度ディスプレイ上でも鮮明に見せることができます。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |