انشاء كائن نمط باستخدام فئة CellsFactory
Contents
[
Hide
]
انشاء كائن نمط باستخدام فئة CellsFactory
يُظهر الكود النموذجي التالي إنشاء كائن Style باستخدام CellsFactory ثم تعيين نمط افتراضي للمصنف. يرجى تنزيل ملف إكسل الناتج لمراجعة نتائج هذا الكود مرجعاً.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); |