スライサーのレンダリング

可能な使用シナリオ

Aspose.Cellsはスライサーのレンダリングをサポートしています。ワークシートを画像に変換したり、ワークブックをPDFまたはHTML形式で保存すると、スライサーが適切にレンダリングされます。

スライサーのレンダリング

次のサンプルコードは、既存のスライサーを含む サンプルExcelファイル を読み込みます。それからスライサーのみをカバーする印刷範囲を設定してワークシートを画像に変換します。生成された出力イメージは、正しくレンダリングされたスライサーを示しています。

todo:image_alt_text

サンプルコード

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Load sample Excel file containing slicer.
Workbook wb = new Workbook("sampleRenderingSlicer.xlsx");
// Access first worksheet.
Worksheet ws = wb.Worksheets[0];
// Set the print area because we want to render slicer only.
ws.PageSetup.PrintArea = "B15:E25";
// Specify image or print options, set one page per sheet and only area to true.
Aspose.Cells.Rendering.ImageOrPrintOptions imgOpts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
imgOpts.HorizontalResolution = 200;
imgOpts.VerticalResolution = 200;
imgOpts.ImageType = Aspose.Cells.Drawing.ImageType.Png;
imgOpts.OnePagePerSheet = true;
imgOpts.OnlyArea = true;
// Create sheet render object and render worksheet to image.
Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(ws, imgOpts);
sr.ToImage(0, "outputRenderingSlicer.png");