Skapa Style objekt med hjälp av CellsFactory klassen

Skapa Style-objekt med hjälp av CellsFactory-klassen

Följande exempel skapar ett Style -objekt med hjälp av CellsFactory -klass och sätter sedan standardstilen för arbetsboken. Ladda gärna ner den utdata-Excel-filen för att se resultaten av detta exempel.

from aspose.cells import BackgroundType, CellsFactory, Workbook
from aspose.pydrawing import Color
# The path to the documents directory.
dataDir = "./"
# Create a Style object using CellsFactory class
cf = CellsFactory()
st = cf.create_style()
# Set the Style fill color to Yellow
st.pattern = BackgroundType.SOLID
st.foreground_color = Color.yellow
# Create a workbook and set its default style using the created Style object
wb = Workbook()
wb.default_style = st
# Save the workbook
wb.save(dataDir + "output_out.xlsx")