Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The following sample code changes the character spacing of the text box in an Excel file to 4 points and then saves it to disk.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::Drawing;
int main()
{
Aspose::Cells::Startup();
// Source directory path
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
// Output directory path
U16String outDir(u"..\\Data\\02_OutputDirectory\\"");
// Load your Excel file into a Workbook object
Workbook wb(srcDir + u"sampleChangeTextBoxOrShapeCharacterSpacing.xlsx");
// Access the text box, which is also a shape object, from the shapes collection
Shape shape = wb.GetWorksheets().Get(0).GetShapes().Get(0);
// Access the first font setting object via the GetRichFormattings() method
FontSetting fs = shape.GetRichFormattings()[0];
// Set the character spacing to 4 points
fs.GetTextOptions().SetSpacing(4);
// Save the workbook in XLSX format
wb.Save(outDir + u"outputChangeTextBoxOrShapeCharacterSpacing.xlsx", SaveFormat::Xlsx);
std::cout << "Character spacing changed successfully!" << std::endl;
Aspose::Cells::Cleanup();
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.