from aspose.cells import BackgroundType, Workbook
from aspose.cells.pivot import PivotTableStyleType
from aspose.pydrawing import Color

#  For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
#  The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
#  Load a template file
workbook = Workbook(dataDir + "Book1.xls")
#  Get the first worksheet
worksheet = workbook.worksheets[0]
pivot = workbook.worksheets[0].pivot_tables[0]
pivot.pivot_table_style_type = PivotTableStyleType.PIVOT_TABLE_STYLE_DARK1
style = workbook.create_style()
style.font.name = "Arial Black"
style.foreground_color = Color.yellow
style.pattern = BackgroundType.SOLID
pivot.format_all(style)
#  Saving the Excel file
workbook.save(dataDir + "output.xls")