Create Style object using CellsFactory class

Create Style object using CellsFactory class

The following sample code creates Style object using CellsFactory class and then sets the Default Style of the workbook. Please download the output excel file to see the results of this code for your reference.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create a Style object using CellsFactory class
CellsFactory cf = new CellsFactory();
Style st = cf.CreateStyle();
// Set the Style fill color to Yellow
st.Pattern = BackgroundType.Solid;
st.ForegroundColor = Color.Yellow;
// Create a workbook and set its default style using the created Style object
Workbook wb = new Workbook();
wb.DefaultStyle = st;
// Save the workbook
wb.Save(dataDir + "output_out.xlsx");