from aspose.cells import StyleFlag, Workbook
from aspose.pydrawing import Color

#  Create the workbook
workbook = Workbook()
# Get the first worksheet
ws = workbook.worksheets[0]
cells = ws.cells
# Setting the value to the cells
cell = cells.get("A1")
cell.put_value("Fruit")
cell = cells.get("B1")
cell.put_value("Count")
cell = cells.get("C1")
cell.put_value("Price")
cell = cells.get("A2")
cell.put_value("Apple")
cell = cells.get("A3")
cell.put_value("Mango")
cell = cells.get("A4")
cell.put_value("Blackberry")
cell = cells.get("A5")
cell.put_value("Cherry")
cell = cells.get("B2")
cell.put_value(5)
cell = cells.get("B3")
cell.put_value(3)
cell = cells.get("B4")
cell.put_value(6)
cell = cells.get("B5")
cell.put_value(4)
cell = cells.get("C2")
cell.put_value(5)
cell = cells.get("C3")
cell.put_value(20)
cell = cells.get("C4")
cell.put_value(30)
cell = cells.get("C5")
cell.put_value(60)
#  Access the worksheet
worksheet = workbook.worksheets[0]
#  Define the range
range = worksheet.cells.create_range("A1:C3")
#  Apply formatting to the range
style = workbook.create_style()
style.font.color = Color.red
style.font.is_bold = True
flag = StyleFlag()
flag.font = True
range.apply_style(style, flag)
#  Define the range
range2 = worksheet.cells.create_range("A4:C5")
#  Apply formatting to the range
style2 = workbook.create_style()
style2.font.color = Color.blue
style2.font.is_italic = True
range2.set_style(style2)
#  Save the modified workbook
workbook.save("output.xlsx")