تحويل Excel إلى صورة عالية الدقة
مع زيادة انتشار شاشات عالية الدقة ، يبدو أن الصور التي تم إنشاؤها بدقة 96 نقطة في البوصة غالبًا ما تكون غير واضحة وغير واضحة. لضمان وضوح الشاشات ذات الدقة العالية ، من الضروري إنشاء صور بدقة أعلى. توفر Aspose.Cells وظيفة تعيين ImageOrPrintOptions.HorizontalResolution و ImageOrPrintOptions.VerticalResolution ، مما يتيح لك إنشاء صور عالية الجودة من ملفات Excel تبدو حادة على الشاشات عالية الدقة.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// 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 | |
options.setHorizontalResolution(300); | |
options.setVerticalResolution(300); | |
// Set the image type | |
options.setImageType(ImageType.PNG); | |
// Get the worksheet | |
Worksheet sheet = workbook.getWorksheets().get(0); | |
// Create a SheetRender instance | |
SheetRender render = new SheetRender(sheet, options); | |
// Generate and save the image | |
render.toImage(0, "output.png"); |