レンダリング スライサー
Contents
[
Hide
]
考えられる使用シナリオ
Aspose.Cells は、スライサー形状のレンダリングをサポートしています。ワークシートを画像に変換するか、ワークブックを PDF または HTML 形式で保存すると、スライサーが適切にレンダリングされることがわかります。
レンダリング スライサー
次のサンプル コードは、サンプル Excel ファイル既存のスライサーが含まれています。スライサーのみをカバーする印刷領域を設定することで、ワークシートを画像に変換します。流れるイメージは出力画像レンダリングされたスライサーを示しています。ご覧のとおり、スライサーは適切にレンダリングされており、サンプルの Excel ファイルと同じように見えます。
サンプルコード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |