Create Transparent Image of Excel Worksheet
Aşağıdaki çalışma sayfası görüntüsünde şeffaflık uygulanmamıştır. Dolgu rengi olmayan hücreler beyaz olarak çizilmiştir.
Şeffaflık uygulanmamış çalışma sayfası görüntüsü
Ancak aşağıdaki çalışma sayfası görüntüsünde şeffaflık uygulanmıştır. Dolgu rengi olmayan hücreler şeffaf olarak çizilmiştir.
Şeffaflık uygulandıktan sonra çalışma sayfası görüntüsü
Excel çalışma kitabınızın şeffaf bir görüntüsünü oluşturmak için aşağıdaki örnek kodu kullanabilirsiniz.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(CreateTransparentImage.class) + "TechnicalArticles/"; | |
// Create workbook object from source file | |
Workbook wb = new Workbook(dataDir + "aspose-sample.xlsx"); | |
// Apply different image or print options | |
ImageOrPrintOptions imgOption = new ImageOrPrintOptions(); | |
imgOption.setImageType(ImageType.PNG); | |
imgOption.setHorizontalResolution(200); | |
imgOption.setVerticalResolution(200); | |
imgOption.setOnePagePerSheet(true); | |
// Apply transparency to the output image | |
imgOption.setTransparent(true); | |
// Create image after apply image or print options | |
SheetRender sr = new SheetRender(wb.getWorksheets().get(0), imgOption); | |
sr.toImage(0, dataDir + "CTransparentImage_out.png"); |