Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The method Workbook.CreateBuiltinStyle and the enumeration BuiltinStyleType make it convenient to use built-in styles. Here is a list of all possible built-in styles:
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Source directory path
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
// Output file paths
U16String output1Path = srcDir + u"Output.xlsx";
U16String output2Path = srcDir + u"Output.out.ods";
// Create a new workbook
Workbook workbook;
// Create a built-in style of type Title
Style style = workbook.CreateBuiltinStyle(BuiltinStyleType::Title);
// Get the first worksheet and its cells
Worksheet worksheet = workbook.GetWorksheets().Get(0);
Cells cells = worksheet.GetCells();
// Access cell A1 and set its value and style
Cell cell = cells.Get(u"A1");
cell.PutValue(u"Aspose");
cell.SetStyle(style);
// Auto-fit the first column and row
worksheet.AutoFitColumn(0);
worksheet.AutoFitRow(0);
// Save the workbook to the first output path
workbook.Save(output1Path);
std::cout << "File saved " << output1Path.ToUtf8() << std::endl;
// Save the workbook to the second output path
workbook.Save(output2Path);
std::cout << "File saved " << output2Path.ToUtf8() << std::endl;
Aspose::Cells::Cleanup();
return 0;
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.