إنشاء كائن نمط باستخدام فئة CellsFactory باستخدام C++
Contents
[
Hide
]
انشاء كائن نمط باستخدام فئة CellsFactory
يتم إنشاء كائن نمط Style باستخدام فئة CellsFactory ثم ضبط النمط الافتراضي لمفكرة العمل. يرجى تحميل ملف الإكسل الناتج لمعاينة نتائج هذا الكود للمرجع الخاص بك.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
// Source directory path
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
// Output directory path
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
// Create a Style object using CellsFactory class
CellsFactory cf;
Style st = cf.CreateStyle();
// Set the Style fill color to Yellow
st.SetPattern(BackgroundType::Solid);
st.SetForegroundColor(Color::Yellow());
// Create a workbook and set its default style using the created Style object
Workbook wb;
wb.SetDefaultStyle(st);
// Save the workbook
wb.Save(outDir + u"output_out.xlsx");
std::cout << "Workbook saved successfully!" << std::endl;
Aspose::Cells::Cleanup();
}