スライサーの書式設定

考えられる使用シナリオ

Microsoft Excel では、列数を設定するか、スタイルなどを設定することで、スライサーをフォーマットできます。Aspose.Cells では、Slicer.NumberOfColumnsSlicer.StyleTypeプロパティ。

スライサーの書式設定

次のコードを参照してください。サンプル Excel ファイルスライサーが含まれています。スライサーにアクセスし、その列数とスタイル タイプを設定して、それを次のように保存します。出力エクセルファイル.スクリーンショットは、サンプル コードの実行後にスライサーがどのように見えるかを示しています。

todo:画像_代替_文章

サンプルコード

// 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("sampleFormattingSlicer.xlsx");
// Access first worksheet.
Worksheet ws = wb.Worksheets[0];
// Access the first slicer inside the slicer collection.
Aspose.Cells.Slicers.Slicer slicer = ws.Slicers[0];
// Set the number of columns of the slicer.
slicer.NumberOfColumns = 2;
// Set the type of slicer style.
slicer.StyleType = Aspose.Cells.Slicers.SlicerStyleType.SlicerStyleLight6;
// Save the workbook in output XLSX format.
wb.Save("outputFormattingSlicer.xlsx", SaveFormat.Xlsx);