Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
You can format the slicer in Microsoft Excel by setting its number of columns or by setting its style etc. Aspose.Cells for Python via .NET also allows you to do this using the Slicer.number_of_columns and Slicer.style_type properties.
Please see the following code, it loads the sample Excel file that contains a slicer. It accesses the slicer and sets its number of columns and style type and saves it as output Excel file. The screenshot shows how the slicer looks after the execution of the sample code.

| from aspose.cells import SaveFormat, Workbook | |
| from aspose.cells.slicers import SlicerStyleType | |
| # Load sample Excel file containing slicer. | |
| wb = Workbook("sampleFormattingSlicer.xlsx") | |
| # Access first worksheet. | |
| ws = wb.worksheets[0] | |
| # Access the first slicer inside the slicer collection. | |
| slicer = ws.slicers[0] | |
| # Set the number of columns of the slicer. | |
| slicer.number_of_columns = 2 | |
| # Set the type of slicer style. | |
| slicer.style_type = SlicerStyleType.SLICER_STYLE_LIGHT6 | |
| # Save the workbook in output XLSX format. | |
| wb.save("outputFormattingSlicer.xlsx", SaveFormat.XLSX) |
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.