Create Transparent Image of Excel Worksheet

Contents
[ ]

以下のワークシートイメージでは、透明性が適用されていません。埋められていないセルは白色で描画されます。

透明度を適用しないワークシート画像

todo:image_alt_text

以下のワークシート画像では、透明度が適用されました。塗りつぶしのないセルは透明です。

透明度を適用した後のワークシート画像

todo:image_alt_text

次のサンプルコードを使用して、Excelワークシートの透明な画像を生成できます。

// 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");