Add Word Art Text with Built-in Styles with C++
Contents
[
Hide
]
Possible Usage Scenarios
You can add Word Art Text with Built-in Styles using Aspose.Cells. Please use ShapeCollection.AddWordArt() method for this purpose.
Add Word Art Text with Built-in Styles
The following sample code adds Word Art texts with different Built-in Styles. Please check the output excel file generated with this code. This is how the output excel file looks in Microsoft Excel.
#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 directory path
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
// Create workbook object
Workbook wb;
// Access first worksheet
Worksheet ws = wb.GetWorksheets().Get(0);
// Add Word Art Text with Built-in Styles
ws.GetShapes().AddWordArt(PresetWordArtStyle::WordArtStyle1, u"Aspose File Format APIs", 0, 0, 0, 0, 100, 800);
ws.GetShapes().AddWordArt(PresetWordArtStyle::WordArtStyle2, u"Aspose File Format APIs", 10, 0, 0, 0, 100, 800);
ws.GetShapes().AddWordArt(PresetWordArtStyle::WordArtStyle3, u"Aspose File Format APIs", 20, 0, 0, 0, 100, 800);
ws.GetShapes().AddWordArt(PresetWordArtStyle::WordArtStyle4, u"Aspose File Format APIs", 30, 0, 0, 0, 100, 800);
ws.GetShapes().AddWordArt(PresetWordArtStyle::WordArtStyle5, u"Aspose File Format APIs", 40, 0, 0, 0, 100, 800);
// Save the workbook in xlsx format
wb.Save(outDir + u"output_out.xlsx");
std::cout << "WordArt added successfully!" << std::endl;
Aspose::Cells::Cleanup();
}