Excelワークシートの透過画像を作成

Contents
[ ]

次のワークシート イメージでは、透明度が適用されていません。塗りつぶしの色がないセルは白で描画されます。

透明度を適用しないワークシート イメージ

todo:画像_代替_文章

一方、次のワークシート イメージでは、透明度が適用されています。塗りつぶしの色がないセルは透明です。

透明度適用後のワークシート イメージ

todo:画像_代替_文章

次のサンプル コードを使用して、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");