Creare un oggetto di stile utilizzando la classe CellsFactory

Crea un oggetto Style utilizzando la classe CellsFactory

Il codice esempio seguente crea un oggetto Stile utilizzando la classe CellsFactory e imposta poi lo Stile Predefinito del workbook. È possibile scaricare il file Excel di output per vedere i risultati di questo codice.

const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Create a Style object using CellsFactory class
const cf = new AsposeCells.CellsFactory();
const st = cf.createStyle();
// Set the Style fill color to Yellow
st.setPattern(AsposeCells.BackgroundType.Solid);
st.setForegroundColor(AsposeCells.Color.Yellow);
// Create a workbook and set its default style using the created Style object
const wb = new AsposeCells.Workbook();
wb.setDefaultStyle(st);
// Save the workbook
wb.save(path.join(dataDir, "output_out.xlsx"));