Creare un oggetto di stile utilizzando la classe CellsFactory

Crea un oggetto Style utilizzando la classe CellsFactory

Il seguente codice di esempio crea un oggetto Style utilizzando la classe CellsFactory e imposta lo stile predefinito del foglio di lavoro. Si prega di scaricare il file Excel di output per vedere i risultati di questo codice a titolo di riferimento.

Codice di Esempio

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(CreateStyleobjectusingCellsFactoryclass.class) + "articles/";
// Create a Style object using CellsFactory class
CellsFactory cf = new CellsFactory();
Style st = cf.createStyle();
// Set the Style fill color to Yellow
st.setPattern(BackgroundType.SOLID);
st.setForegroundColor(Color.getYellow());
// Create a workbook and set its default style using the created Style
// object
Workbook wb = new Workbook();
wb.setDefaultStyle(st);
// Save the workbook
wb.save(dataDir + "CreateStyleobject_out.xlsx");