Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Aspose.Slides for C++
This gist exceeds the recommended number of files (~10). To access all files, please clone this gist.
Added Gist for Aspose.Slides for C++
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
const String templatePath = u"../templates/AccessSlides.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<IDocumentProperties> documentProperties = pres->get_DocumentProperties();
System::Console::WriteLine(u"Category : {0}" , documentProperties->get_Category());
System::Console::WriteLine(u"Current Status : {0}", documentProperties->get_ContentStatus());
System::Console::WriteLine(u"Creation Date : {0}", documentProperties->get_CreatedTime().ToString());
System::Console::WriteLine(u"Author : {0}", documentProperties->get_Author());
System::Console::WriteLine(u"Description : {0}", documentProperties->get_Comments());
System::Console::WriteLine(u"KeyWords : {0}", documentProperties->get_Keywords());
System::Console::WriteLine(u"Last Modified By : {0}", documentProperties->get_LastSavedBy());
System::Console::WriteLine(u"Supervisor : {0}", documentProperties->get_Manager());
System::Console::WriteLine(u"Modified Date : {0}", documentProperties->get_LastSavedTime().ToString());
System::Console::WriteLine(u"Presentation Format : {0}", documentProperties->get_PresentationFormat());
System::Console::WriteLine(u"Last Print Date : {0}",documentProperties->get_LastPrinted().ToString());
System::Console::WriteLine(u"Is Shared between producers : {0}", documentProperties->get_SharedDoc());
System::Console::WriteLine(u"Subject : {0}", documentProperties->get_Subject());
System::Console::WriteLine(u"Title : {0}", documentProperties->get_Title());
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/SmartArt.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Traverse through every shape inside first slide
for(int x=0;x<pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count();x++)
{
SharedPtr<IShape> shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x);
if (System::ObjectExt::Is<Aspose::Slides::SmartArt::SmartArt>(shape))
{
System::SharedPtr<Aspose::Slides::SmartArt::SmartArt> smart = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArt>(shape);
// Traverse through all nodes inside SmartArt
for (int i = 0; i < smart->get_AllNodes()->get_Count(); i++)
{
// Accessing SmartArt node at index i
System::SharedPtr<Aspose::Slides::SmartArt::SmartArtNode> node0 = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArtNode>(smart->get_AllNodes()->idx_get(i));
// Traversing through the child nodes in SmartArt node at index i
for (int j = 0; j < node0->get_ChildNodes()->get_Count(); j++)
{
// Accessing the child node in SmartArt node
System::SharedPtr<Aspose::Slides::SmartArt::SmartArtNode> node = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArtNode>(node0->get_ChildNodes()->idx_get(j));
// Printing the SmartArt child node parameters
System::Console::WriteLine(u"j = " + node->get_TextFrame()->get_Text()+u", Text = "+ node->get_Level()+u", Position = "+ node->get_Position());
}
}
}
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AccessChildNodeSpecificPosition_out.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Add SmartArt BasicProcess
System::SharedPtr<Aspose::Slides::SmartArt::ISmartArt> smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::StackedList);
if (smart->get_AllNodes()->get_Count() > 0)
{
// Accessing SmartArt node at index 0
SharedPtr<Aspose::Slides::SmartArt::ISmartArtNode> node0 = smart->get_AllNodes()->idx_get(0);
//Accessing child node collection
auto nodeCollection =node0->get_ChildNodes();
SharedPtr<SmartArtNode> foundChild;
int position = 1;
System::SharedPtr<Aspose::Slides::SmartArt::ISmartArtNode> node = node0->get_ChildNodes()->idx_get(position);
// Printing the SmartArt child node parameters
System::Console::WriteLine(u"j = " + node->get_TextFrame()->get_Text() + u", Text = " + node->get_Level() + u", Position = " + node->get_Position());
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
//const String outPath = u"../out/EmbeddedVideoFrame_out.pptx";
const String templatePath = u"../templates/AltText.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
for (int i = 0; i < slide->get_Shapes()->get_Count(); i++)
{
// Accessing the shape collection of slides
System::SharedPtr<IShape> shape = slide->get_Shapes()->idx_get(i);
if (System::ObjectExt::Is<GroupShape>(shape))
{
// Accessing the group shape.
SharedPtr<GroupShape> grphShape = DynamicCast<Aspose::Slides::GroupShape>(shape);
for (int j = 0; j < grphShape->get_Shapes()->get_Count(); j++)
{
SharedPtr<IShape> shape2 = grphShape->get_Shapes()->idx_get(j);
String st = shape2->get_AlternativeText();
// Accessing the AltText property
System::Console::WriteLine(u"Shape Name : " + st);
}
}
}
// The path to the documents directory.
const String outPath = u"../templates/pres.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
for (int x = 0; x < pres->get_LayoutSlides()->get_Count(); x++)
{
SharedPtr<IShapeCollection> shapeCollection = pres->get_LayoutSlides()->idx_get(x)->get_Shapes();
for (int i = 0; i < shapeCollection->get_Count(); i++) {
SharedPtr<IShape> shape = shapeCollection->idx_get(i);
System::Console::WriteLine(shape->get_FillFormat());
}
for (int j = 0; j < shapeCollection->get_Count(); j++) {
SharedPtr<IShape> shape = shapeCollection->idx_get(j);
System::Console::WriteLine(shape->get_LineFormat());
}
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
const String templatePath = u"../templates/AccessModifyingProperties.pptx";
System::SharedPtr<Presentation> presentation = System::MakeObject<Presentation>(templatePath);
// Create a reference to DocumentProperties object associated with Prsentation
System::SharedPtr<IDocumentProperties> documentProperties = presentation->get_DocumentProperties();
for (int32_t i = 0; i < documentProperties->get_CountOfCustomProperties(); i++)
{
System::Console::WriteLine(u"Custom Property Name : {0}", documentProperties->GetCustomPropertyName(i));
System::Console::WriteLine(u"Custom Property Vlaue : {0}", documentProperties->idx_get(documentProperties->GetCustomPropertyName(i)));
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/excelFromOLE_out.xlsx";
const String templatePath = u"../templates/AccessingOLEObjectFrame.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Cast the shape to OleObjectFrame
SharedPtr<OleObjectFrame> oof = DynamicCast<Aspose::Slides::OleObjectFrame>(slide->get_Shapes()->idx_get(0));
// Read the OLE Object and write it to disk
if (oof != NULL)
{
System::ArrayPtr<uint8_t> buffer = oof->get_ObjectData();
{
System::SharedPtr<System::IO::FileStream> stream = System::MakeObject<System::IO::FileStream>(outPath, System::IO::FileMode::Create, System::IO::FileAccess::Write, System::IO::FileShare::Read);
stream->Flush();
stream->Close();
}
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
// The path to the documents directory.
const String outPath = u"../out/AccessOpenDoc_out.pptx";
const String dataDir = u"../templates/AccessOpenDoc.odp";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>(dataDir);
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
const String templatePath = u"../templates/AccessProperties.pptx";
System::SharedPtr<LoadOptions> loadOptions = System::MakeObject<LoadOptions>();
loadOptions->set_Password(u"pass");
loadOptions->set_OnlyLoadDocumentProperties ( true);
System::SharedPtr<Presentation> presentation = System::MakeObject<Presentation>(templatePath, loadOptions);
System::SharedPtr<IDocumentProperties> docProps = presentation->get_DocumentProperties();
System::Console::WriteLine(u"Name of Application : {0}", docProps->get_NameOfApplication());
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/AddSlides.pptx";
// Instantiate Presentation class
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Getting Slide ID
int id = pres->get_Slides()->idx_get(0)->get_SlideId();
// Accessing Slide by ID
SharedPtr<IBaseSlide> slide = pres->GetSlideById(id);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/AddSlides.pptx";
// Instantiate Presentation class
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Accessing Slide by ID
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/Comments1.pptx";
// Instantiate Presentation class
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
//Accessing comments collection
const int commentsCount = pres->get_CommentAuthors()->get_Count();
for (int i = 0; i < commentsCount; i++)
{
auto author = pres->get_CommentAuthors()->idx_get(i);
//std::cout << "Comments from: " << author->get_Name() << std::endl;
System::Console::WriteLine(u"Comments from: " + author->get_Name());
for (int j = 0; j < author->get_Comments()->get_Count(); j++)
{
auto comment = author->get_Comments()->idx_get(j);
System::Console::WriteLine(u"Comment: " + comment->get_Text());
}
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/AddSlides.pptx";
// Instantiate Presentation class that represents the presentation file
// Instantiate Presentation class
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Instantiate SlideCollection calss
SharedPtr<ISlideCollection> slds = pres->get_Slides();
// Accessing a slide using its slide index
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
//Prinitng slide number
printf("Accessed Slide Number : %d\n", slide->get_SlideNumber());
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/SmartArt.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Traverse through every shape inside first slide
//foreach(IShape shape in pres.Slides[0].Shapes)
for (int x = 0; x<pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++)
{
SharedPtr<IShape> shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x);
if (System::ObjectExt::Is<Aspose::Slides::SmartArt::SmartArt>(shape))
{
System::SharedPtr<Aspose::Slides::SmartArt::SmartArt> smart = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArt>(shape);
// Traverse through all nodes inside SmartArt
for (int i = 0; i < smart->get_AllNodes()->get_Count(); i++)
{
// Accessing SmartArt node at index i
System::SharedPtr<Aspose::Slides::SmartArt::SmartArtNode> node = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArtNode>(smart->get_AllNodes()->idx_get(i));
// Printing the SmartArt node parameters
System::Console::WriteLine(u"j = " + node->get_TextFrame()->get_Text() + u", Text = " + node->get_Level() + u", Position = " + node->get_Position());
}
}
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/SmartArt.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Traverse through every shape inside first slide
for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++)
{
SharedPtr<IShape> shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x);
if (System::ObjectExt::Is<Aspose::Slides::SmartArt::SmartArt>(shape))
{
System::SharedPtr<Aspose::Slides::SmartArt::SmartArt> smart = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArt>(shape);
System::Console::WriteLine(u"Smart Art Name = " + smart->get_Name());
// Checking SmartArt Layout
if (smart->get_Layout() == SmartArtLayoutType::BasicBlockList)
{
System::Console::WriteLine(u"Do some thing here....");
}
}
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/SmartArt.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Traverse through every shape inside first slide
for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++)
{
SharedPtr<IShape> shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x);
if (System::ObjectExt::Is<Aspose::Slides::SmartArt::SmartArt>(shape))
{
System::SharedPtr<Aspose::Slides::SmartArt::SmartArt> smart = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArt>(shape);
System::Console::WriteLine(u"Smart Art Name = " + smart->get_Name());
}
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddArrowShapedLine_out.pptx";
const String templatePath = u"../templates/AltText.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add an autoshape of type line
SharedPtr<IAutoShape> shape = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 50, 150, 300, 0);
// Apply some formatting on the line
shape->get_LineFormat()->set_Style(LineStyle::ThickBetweenThin);
shape->get_LineFormat()->set_Width( 10);
shape->get_LineFormat()->set_DashStyle ( LineDashStyle::DashDot);
shape->get_LineFormat()->set_BeginArrowheadLength ( LineArrowheadLength::Short);
shape->get_LineFormat()->set_BeginArrowheadStyle ( LineArrowheadStyle::Oval);
shape->get_LineFormat()->set_EndArrowheadLength ( LineArrowheadLength::Long);
shape->get_LineFormat()->set_EndArrowheadStyle ( LineArrowheadStyle::Triangle);
shape->get_LineFormat()->get_FillFormat()->set_FillType ( FillType::Solid);
shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Maroon());
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddArrowShapedLineToSlide_out.pptx";
const String templatePath = u"../templates/AltText.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add an autoshape of type line
SharedPtr<IAutoShape> shape = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 50, 150, 300, 0);
// Apply some formatting on the line
shape->get_LineFormat()->set_Style(LineStyle::ThickBetweenThin);
shape->get_LineFormat()->set_Width(10);
shape->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot);
shape->get_LineFormat()->set_BeginArrowheadLength(LineArrowheadLength::Short);
shape->get_LineFormat()->set_BeginArrowheadStyle(LineArrowheadStyle::Oval);
shape->get_LineFormat()->set_EndArrowheadLength(LineArrowheadLength::Long);
shape->get_LineFormat()->set_EndArrowheadStyle(LineArrowheadStyle::Triangle);
shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid);
shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Maroon());
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AudioFrameEmbed_out.pptx";
const String filePath = u"../templates/sampleaudio.wav";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Load the wav sound file to stream
System::SharedPtr<System::IO::FileStream> stream = System::MakeObject<System::IO::FileStream>(filePath, System::IO::FileMode::Open, System::IO::FileAccess::Read);
// Add Audio Frame
System::SharedPtr<IAudioFrame> af = slide->get_Shapes()->AddAudioFrameEmbedded(50, 150, 100, 100, stream);
// Set Play Mode and Volume of the Audio
af->set_PlayMode(AudioPlayModePreset::Auto);
af->set_Volume (AudioVolumeMode::Loud);
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
// supposed we have the large image file we want to include into the presentation
System::String pathToLargeImage = u"../templates/largeImage.jpg";
// create a new presentation which will contain this image
auto pres = System::MakeObject<Presentation>();
auto fileStream = System::MakeObject<System::IO::FileStream>(pathToLargeImage, System::IO::FileMode::Open);
// let's add the image to the presentation - we choose KeepLocked behavior, because we not
// have an intent to access the "largeImage.png" file.
auto img = pres->get_Images()->AddImage(fileStream, LoadingStreamBehavior::KeepLocked);
pres->get_Slides()->idx_get(0)->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, 0.0f, 0.0f, 300.0f, 200.0f, img);
// save the presentation. Despite that the output presentation will be
// large, the memory consumption will be low the whole lifetime of the pres object
pres->Save(u"../out/presentationWithLargeImage.pptx", Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddBlobToPresentation_out.pptx";
const String filePath = u"../templates/Wildlife.mp4";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
//Loading very large video
auto data = GetFileByteData(filePath);
// Load the video file to stream
System::SharedPtr<System::IO::Stream> stream = System::MakeObject<System::IO::FileStream>(filePath, System::IO::FileMode::Open, System::IO::FileAccess::Read);
// Embedd vide inside presentation
System::SharedPtr<IVideo> video = pres->get_Videos()->AddVideo(stream, LoadingStreamBehavior::KeepLocked);
//Adding video
slide->get_Shapes()->AddVideoFrame(0, 0, 480, 270, video);
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/BoxAndWhisker_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
System::SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::BoxAndWhisker, 50, 50, 500, 400);
chart->get_ChartData()->get_Categories()->Clear();
chart->get_ChartData()->get_Series()->Clear();
System::SharedPtr<IChartDataWorkbook> wb = chart->get_ChartData()->get_ChartDataWorkbook();
wb->Clear(0);
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A1", System::ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A2", System::ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A3", System::ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A4", System::ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A5", System::ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A6", System::ObjectExt::Box<System::String>(u"Category 1")));
System::SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->Add(Aspose::Slides::Charts::ChartType::BoxAndWhisker);
series->set_QuartileMethod(Aspose::Slides::Charts::QuartileMethodType::Exclusive);
series->set_ShowMeanLine(true);
series->set_ShowMeanMarkers(true);
series->set_ShowInnerPoints(true);
series->set_ShowOutlierPoints(true);
series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(wb->GetCell(0, u"B1", System::ObjectExt::Box<int32_t>(15)));
series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(wb->GetCell(0, u"B2", System::ObjectExt::Box<int32_t>(41)));
series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(wb->GetCell(0, u"B3", System::ObjectExt::Box<int32_t>(16)));
series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(wb->GetCell(0, u"B4", System::ObjectExt::Box<int32_t>(10)));
series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(wb->GetCell(0, u"B5", System::ObjectExt::Box<int32_t>(23)));
series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(wb->GetCell(0, u"B6", System::ObjectExt::Box<int32_t>(16)));
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddColumnInTexBoxes_out.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);
// Add an AutoShape of Rectangle type
SharedPtr<IAutoShape> ashp = sld->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 300, 300);
// Add TextFrame to the Rectangle
ashp->AddTextFrame(u"All these columns are limited to be within a single text container -- you can add or delete text and the new or remaining text automatically adjusts itself to flow within the container. You cannot have text flow from one container to other though -- we told you PowerPoint's column options for text are limited!");
// Accessing the text frame
SharedPtr<ITextFrame> txtFrame = ashp->get_TextFrame();
// Get text format of TextFrame
SharedPtr<ITextFrameFormat> format = txtFrame->get_TextFrameFormat();
// Specify number of columns in TextFrame
format->set_ColumnCount(3);
// Specify spacing between columns
format->set_ColumnSpacing ( 10);
// Save PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
// The path to the documents directory.
const String outPath = u"../out/ColumnsTest.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);
// Add an AutoShape of Rectangle type
SharedPtr<IAutoShape> ashp = sld->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 300, 300);
// Add TextFrame to the Rectangle
ashp->AddTextFrame(u"All these columns are limited to be within a single text container -- you can add or delete text and the new or remaining text automatically adjusts itself to flow within the container. You cannot have text flow from one container to other though -- we told you PowerPoint's column options for text are limited!");
// Accessing the text frame
SharedPtr<ITextFrame> txtFrame = ashp->get_TextFrame();
// Get text format of TextFrame
SharedPtr<ITextFrameFormat> format = txtFrame->get_TextFrameFormat();
// Specify number of columns in TextFrame
format->set_ColumnCount(2);
//// Specify spacing between columns
//format->set_ColumnSpacing(10);
// Save PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/ErrorBarsCustomValues_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);
// Add chart with default data
SharedPtr<IChart> chart = sld->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Bubble, 0, 0, 500, 500,true);
// Adding custom Error chart and setting its format
SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->idx_get(0);
SharedPtr<IErrorBarsFormat> errBarX = series->get_ErrorBarsXFormat();
SharedPtr<IErrorBarsFormat> errBarY = series->get_ErrorBarsYFormat();
errBarX->set_IsVisible(true);
errBarY->set_IsVisible(true);
errBarX->set_ValueType(ErrorBarValueType::Custom);
errBarY->set_ValueType(ErrorBarValueType::Custom);
// Accessing chart series data point and setting error bars values for individual point
SharedPtr<IChartDataPointCollection> points = series->get_DataPoints();
points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForXPlusValues(DataSourceType::DoubleLiterals);
points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForXMinusValues(DataSourceType::DoubleLiterals);
points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForYPlusValues (DataSourceType::DoubleLiterals);
points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForYMinusValues(DataSourceType::DoubleLiterals);
// Setting error bars for chart series points
for (int i = 0; i < points->get_Count(); i++)
{
points->idx_get(i)->get_ErrorBarsCustomValues()->get_XMinus()->set_AsLiteralDouble(i + 1);
points->idx_get(i)->get_ErrorBarsCustomValues()->get_XPlus()->set_AsLiteralDouble (i + 1);
points->idx_get(i)->get_ErrorBarsCustomValues()->get_YMinus()->set_AsLiteralDouble( i + 1);
points->idx_get(i)->get_ErrorBarsCustomValues()->get_YPlus()->set_AsLiteralDouble ( i + 1);
}
// Saving presentation
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddDoughnutCallout_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add chart with default data
SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Doughnut, 0, 0, 500, 500);
int seriesIndex = 0;
// Setting the index of chart data sheet
int defaultWorksheetIndex = 0;
// Getting the chart data worksheet
SharedPtr<IChartDataWorkbook> fact = chart->get_ChartData()->get_ChartDataWorkbook();
// Delete default generated series and categories
chart->get_ChartData()->get_Series()->Clear();
chart->get_ChartData()->get_Categories()->Clear();
chart->set_HasLegend(false);
////////////
while (seriesIndex < 15)
{
SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->Add(fact->GetCell(0, 0, seriesIndex + 1, ObjectExt::Box<System::String>(u"SERIES" + seriesIndex)), chart->get_Type());
series->set_Explosion(0);
series->get_ParentSeriesGroup()->set_DoughnutHoleSize (20);
series->get_ParentSeriesGroup()->set_FirstSliceAngle ( 351);
seriesIndex++;
}
int categoryIndex = 0;
while (categoryIndex < 15)
{
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(0, categoryIndex + 1, 0, ObjectExt::Box<System::String>(u"CATEGORY" + categoryIndex)));
int i = 0;
while (i < chart->get_ChartData()->get_Series()->get_Count())
{
SharedPtr<IChartSeries> iCS = chart->get_ChartData()->get_Series()->idx_get(i);
SharedPtr<IChartDataPoint> dataPoint = iCS->get_DataPoints()->AddDataPointForDoughnutSeries(fact->GetCell(0, categoryIndex + 1, i + 1, ObjectExt::Box<double>(1)));
dataPoint->get_Format()->get_Fill()->set_FillType (FillType::Solid);
dataPoint->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid);
dataPoint->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_White());
dataPoint->get_Format()->get_Line()->set_Width( 1);
dataPoint->get_Format()->get_Line()->set_Style (LineStyle::Single);
dataPoint->get_Format()->get_Line()->set_DashStyle(LineDashStyle::Solid);
if (i == chart->get_ChartData()->get_Series()->get_Count() - 1)
{
SharedPtr<IDataLabel> lbl = dataPoint->get_Label();
lbl->get_TextFormat()->get_TextBlockFormat()->set_AutofitType (TextAutofitType::Shape);
lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->set_FontBold (NullableBool::True);
lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->set_LatinFont(MakeObject<FontData>(u"DINPro-Bold"));
lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->set_FontHeight ( 12);
lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->get_FillFormat()->set_FillType (FillType::Solid);
lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color (System::Drawing::Color::get_LightGray());
lbl->get_DataLabelFormat()->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_White());
lbl->get_DataLabelFormat()->set_ShowValue ( false);
lbl->get_DataLabelFormat()->set_ShowCategoryName ( true);
lbl->get_DataLabelFormat()->set_ShowSeriesName(false);
//lbl.DataLabelFormat.ShowLabelAsDataCallout = true;
lbl->get_DataLabelFormat()->set_ShowLeaderLines (true);
lbl->get_DataLabelFormat()->set_ShowLabelAsDataCallout ( false);
chart->ValidateChartLayout();
lbl->set_X((float)lbl->get_X() + (float)0.5);
lbl->set_Y((float)lbl->get_Y() + (float)0.5);
}
i++;
}
categoryIndex++;
}
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddEmbeddedFonts_out.pptx";
const String templatePath = u"../templates/EmbeddedFonts.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
SharedPtr<IFontsManager> fontsManager = pres->get_FontsManager();
// get all embedded fonts
ArrayPtr<SharedPtr<IFontData>>embeddedFonts = fontsManager->GetEmbeddedFonts();
ArrayPtr<SharedPtr<IFontData>>allFonts = fontsManager->GetFonts();
auto enumerator_0 = allFonts->GetEnumerator();
decltype(enumerator_0->get_Current()) font = enumerator_0->get_Current();
while (enumerator_0->MoveNext() && (font = enumerator_0->get_Current(), true))
{
//if (font_0->get_FontName() == font->get_FontName())
if (embeddedFonts->Contains(font))
{
fontsManager->AddEmbeddedFont(font, EmbedFontCharacters::All);
}
}
// save the presentation without embedded "Calibri" font
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/ErrorBars_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);
// Add chart with default data
SharedPtr<IChart> chart = sld->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Bubble, 0, 0, 500, 500, true);
// Adding custom Error chart and setting its format
SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->idx_get(0);
SharedPtr<IErrorBarsFormat> errBarX = series->get_ErrorBarsXFormat();
SharedPtr<IErrorBarsFormat> errBarY = series->get_ErrorBarsYFormat();
errBarX->set_IsVisible(true);
errBarY->set_IsVisible(true);
errBarX->set_ValueType(ErrorBarValueType::Fixed);
errBarX->set_Value( 0.1f);
errBarY->set_ValueType(ErrorBarValueType::Percentage);
errBarX->set_Value(5);
errBarX->set_Type (ErrorBarType::Plus);
errBarY->get_Format()->get_Line()->set_Width(2);
errBarX->set_HasEndCap ( true);
// Saving presentation
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/FunnelChart_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
System::SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Funnel, 50, 50, 500, 400);
chart->get_ChartData()->get_Categories()->Clear();
chart->get_ChartData()->get_Series()->Clear();
System::SharedPtr<IChartDataWorkbook> wb = chart->get_ChartData()->get_ChartDataWorkbook();
wb->Clear(0);
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A1", System::ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A2", System::ObjectExt::Box<System::String>(u"Category 2")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A3", System::ObjectExt::Box<System::String>(u"Category 3")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A4", System::ObjectExt::Box<System::String>(u"Category 4")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A5", System::ObjectExt::Box<System::String>(u"Category 5")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A6", System::ObjectExt::Box<System::String>(u"Category 6")));
System::SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->Add(Aspose::Slides::Charts::ChartType::Funnel);
series->get_DataPoints()->AddDataPointForFunnelSeries(wb->GetCell(0, u"B1", System::ObjectExt::Box<int32_t>(50)));
series->get_DataPoints()->AddDataPointForFunnelSeries(wb->GetCell(0, u"B2", System::ObjectExt::Box<int32_t>(100)));
series->get_DataPoints()->AddDataPointForFunnelSeries(wb->GetCell(0, u"B3", System::ObjectExt::Box<int32_t>(200)));
series->get_DataPoints()->AddDataPointForFunnelSeries(wb->GetCell(0, u"B4", System::ObjectExt::Box<int32_t>(300)));
series->get_DataPoints()->AddDataPointForFunnelSeries(wb->GetCell(0, u"B5", System::ObjectExt::Box<int32_t>(400)));
series->get_DataPoints()->AddDataPointForFunnelSeries(wb->GetCell(0, u"B6", System::ObjectExt::Box<int32_t>(500)));
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/HistogramChart_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
System::SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Histogram, 50, 50, 500, 400);
chart->get_ChartData()->get_Categories()->Clear();
chart->get_ChartData()->get_Series()->Clear();
System::SharedPtr<IChartDataWorkbook> wb = chart->get_ChartData()->get_ChartDataWorkbook();
wb->Clear(0);
System::SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->Add(Aspose::Slides::Charts::ChartType::Histogram);
series->get_DataPoints()->AddDataPointForHistogramSeries(wb->GetCell(0, u"A1", System::ObjectExt::Box<int32_t>(15)));
series->get_DataPoints()->AddDataPointForHistogramSeries(wb->GetCell(0, u"A2", System::ObjectExt::Box<int32_t>(-41)));
series->get_DataPoints()->AddDataPointForHistogramSeries(wb->GetCell(0, u"A3", System::ObjectExt::Box<int32_t>(16)));
series->get_DataPoints()->AddDataPointForHistogramSeries(wb->GetCell(0, u"A4", System::ObjectExt::Box<int32_t>(10)));
series->get_DataPoints()->AddDataPointForHistogramSeries(wb->GetCell(0, u"A5", System::ObjectExt::Box<int32_t>(-23)));
series->get_DataPoints()->AddDataPointForHistogramSeries(wb->GetCell(0, u"A6", System::ObjectExt::Box<int32_t>(16)));
chart->get_Axes()->get_HorizontalAxis()->set_AggregationType(Aspose::Slides::Charts::AxisAggregationType::Automatic);
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/HistogramParetoChart_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
System::SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Histogram, 50, 50, 500, 400);
chart->get_ChartData()->get_Series()->Add(Aspose::Slides::Charts::ChartType::ParetoLine);
chart->get_Axes()->get_SecondaryVerticalAxis()->set_NumberFormat(u"0%");
chart->get_Axes()->get_SecondaryVerticalAxis()->set_MaxValue(1);
chart->get_Axes()->get_SecondaryVerticalAxis()->set_IsAutomaticMaxValue(false);
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
System::String svgPath = u"../templates/sample.svg";
System::String outPptxPath = u"../out/presentation.pptx";
auto p = System::MakeObject<Presentation>();
System::String svgContent = System::IO::File::ReadAllText(svgPath);
System::SharedPtr<ISvgImage> svgImage = System::MakeObject<SvgImage>(svgContent);
System::SharedPtr<IPPImage> ppImage = p->get_Images()->AddImage(svgImage);
p->get_Slides()->idx_get(0)->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, 0.0f, 0.0f, static_cast<float>(ppImage->get_Width()), static_cast<float>(ppImage->get_Height()), ppImage);
p->Save(outPptxPath, Aspose::Slides::Export::SaveFormat::Pptx);
System::String svgPath = u"../templates/sample.svg";
System::String outPptxPath = u"../out/presentation.pptx";
System::String baseDir = u"../templates/";
auto p = System::MakeObject<Presentation>();
System::String svgContent = System::IO::File::ReadAllText(System::MakeObject<System::Uri>(System::MakeObject<System::Uri>(baseDir), u"image1.svg")->get_AbsolutePath());
System::SharedPtr<ISvgImage> svgImage = System::MakeObject<SvgImage>(svgContent, System::MakeObject<ExternalResourceResolver>(), baseDir);
System::SharedPtr<IPPImage> ppImage = p->get_Images()->AddImage(svgImage);
p->get_Slides()->idx_get(0)->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, 0.0f, 0.0f, static_cast<float>(ppImage->get_Width()), static_cast<float>(ppImage->get_Height()), ppImage);
p->Save(outPptxPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/Image_In_TableCell_out.pptx";
const String ImagePath = u"../templates/Tulips.jpg";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> islide = pres->get_Slides()->idx_get(0);
// Define columns with widths and rows with heights
System::ArrayPtr<double> dblCols= System::MakeObject<System::Array<double>>(4,150 );
System::ArrayPtr<double> dblRows = System::MakeObject<System::Array<double>>(4,100 );
System::ArrayPtr<double> total_for_Cat = System::MakeObject<System::Array<double>>(5, 0);
// Add table shape to slide
auto tbl = islide->get_Shapes()->AddTable(50, 50, dblCols, dblRows);
// Get the picture
auto bitmap = MakeObject<System::Drawing::Bitmap>(ImagePath);
// Add image to presentation's images collection
SharedPtr<IPPImage> imgx = pres->get_Images()->AddImage(bitmap);
// Add image to first table cell
tbl->idx_get(0,0)->get_FillFormat()->set_FillType (FillType::Picture);
tbl->idx_get(0,0)->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode ( PictureFillMode::Stretch);
tbl->idx_get(0,0)->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(imgx);
// Save PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
// The path to the documents directory.
const String outPath = u"../out/AddCustomLines.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
SharedPtr<IChart> chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100, 100, 500, 400);
SharedPtr<IAutoShape> shape = chart->get_UserShapes()->get_Shapes()->AddAutoShape(ShapeType::Line, 0, chart->get_Height() / 2, chart->get_Width(), 0);
shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid);
shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red());
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
void AddingEMZImagesToImageCollection()
{
// The path to the documents directory.
const String outPath = u"../out/AddingEMZImagesToImageCollection_out.pptx";
const String filePath = u"../templates/2.emz";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
auto data = GetFileByteData(filePath);
SharedPtr<IPPImage> imgx = pres->get_Images()->AddImage(data);
//Adding picture frame with EMZ image
auto m = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 0, 0, pres->get_SlideSize()->get_Size().get_Width(), pres->get_SlideSize()->get_Size().get_Height(), imgx);
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
}
ArrayPtr<uint8_t> GetFileByteData(System::String fileNameZip)
{
System::SharedPtr<System::IO::FileStream> fs = System::IO::File::OpenRead(fileNameZip);
System::ArrayPtr<uint8_t> buffer = System::MakeArray<uint8_t>(fs->get_Length(), 0);
fs->Read(buffer, 0, buffer->get_Length());
return buffer;
}
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddingSuperscriptAndSubscriptTextInTextFrame_out.pptx";
//const String templatePath = u"../templates/DefaultFonts.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);
// Add an AutoShape of Rectangle type
SharedPtr<IAutoShape> ashp = sld->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 300, 300);
// Add TextFrame to the Rectangle
SharedPtr<ITextFrame> tf = ashp->AddTextFrame(String::Empty);
tf->get_Paragraphs()->Clear();
// Adding the first Paragraph
SharedPtr<Paragraph> superPar = MakeObject<Paragraph>();
SharedPtr<Portion> portion1 = MakeObject<Portion>(u"SlideTitle");
superPar->get_Portions()->Add(portion1);
SharedPtr<Portion> superPortion = MakeObject<Portion>();
superPortion->get_PortionFormat()->set_Escapement(30);
superPortion->set_Text(u"TM");
superPar->get_Portions()->Add(superPortion);
// Adding the first Paragraph
SharedPtr<Paragraph> subPar = MakeObject<Paragraph>();
SharedPtr<Portion> portion2 = MakeObject<Portion>(u"a");
subPar->get_Portions()->Add(portion2);
SharedPtr<Portion> subPortion = MakeObject<Portion>();
subPortion->get_PortionFormat()->set_Escapement(-25);
subPortion->set_Text(u"i");
subPar->get_Portions()->Add(subPortion);
//Adding to text frame
ashp->get_TextFrame()->get_Paragraphs()->Add(superPar);
ashp->get_TextFrame()->get_Paragraphs()->Add(subPar);
// Save PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/AddSlides.pptx";
const String outPath = u"../out/AddLayoutSlides.pptx";
// Instantiate Presentation class that represents the presentation file
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
// Try to search by layout slide type
SharedPtr<IMasterLayoutSlideCollection> layoutSlides = pres->get_Masters()->idx_get(0)->get_LayoutSlides();
SharedPtr<ILayoutSlide> layoutSlide;
if (layoutSlides->GetByType(SlideLayoutType::TitleAndObject) != NULL)
{
layoutSlide = layoutSlides->GetByType(SlideLayoutType::TitleAndObject);
}
else if (layoutSlides->GetByType(SlideLayoutType::Title) != NULL)
{
layoutSlide = layoutSlides->GetByType(SlideLayoutType::Title);
}
if (layoutSlide == NULL)
{
// The situation when a presentation doesn't contain some type of layouts.
// presentation File only contains Blank and Custom layout types.
// But layout slides with Custom types has different slide names,
// like "Title", "Title and Content", etc. And it is possible to use these
// names for layout slide selection.
// Also it is possible to use the set of placeholder shape types. For example,
// Title slide should have only Title pleceholder type, etc.
for (int i = 0; i<layoutSlides->get_Count(); i++)
{
SharedPtr<ILayoutSlide> titleAndObjectLayoutSlide = layoutSlides->idx_get(i);
if (titleAndObjectLayoutSlide->get_Name().Equals(u"Title and Object"))
{
layoutSlide = titleAndObjectLayoutSlide;
break;
}
}
if (layoutSlide == NULL)
{
for (int i = 0; i < layoutSlides->get_Count(); i++)
{
SharedPtr<ILayoutSlide> titleLayoutSlide = layoutSlides->idx_get(i);
if (titleLayoutSlide->get_Name().Equals(u"Title"))
{
layoutSlide = titleLayoutSlide;
break;
}
}
if (layoutSlide == NULL)
{
layoutSlide = layoutSlides->GetByType(SlideLayoutType::Blank);
if (layoutSlide == NULL)
{
layoutSlide = layoutSlides->Add(SlideLayoutType::TitleAndObject, u"Title and Object");
}
}
}
}
// Adding empty slide with added layout slide
pres->get_Slides()->InsertEmptySlide(0, layoutSlide);
// Save the PPTX file to the Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddNodes_out.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Add SmartArt BasicProcess
System::SharedPtr<Aspose::Slides::SmartArt::ISmartArt> smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::StackedList);
if (smart->get_AllNodes()->get_Count() > 0)
{
// Accessing SmartArt node at index 0
System::SharedPtr<Aspose::Slides::SmartArt::ISmartArtNode> node = smart->get_AllNodes()->AddNode();
// Add Text
node->get_TextFrame()->set_Text(u"Test");
// SharedPtr<ISmartArtNodeCollection> nodeCollection = System::DynamicCast_noexcept<ISmartArtNodeCollection>(node->get_ChildNodes()); ;
auto nodeCollection = node->get_ChildNodes() ;
// Adding new child node at end of parent node
SharedPtr<ISmartArtNode> chNode = nodeCollection->AddNode();
// Add Text
chNode->get_TextFrame()->set_Text(u"Sample Text Added");
}
// Save Presentation
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddNodesSpecificPosition_out.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Add SmartArt BasicProcess
System::SharedPtr<Aspose::Slides::SmartArt::ISmartArt> smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::StackedList);
if (smart->get_AllNodes()->get_Count() > 0)
{
// Accessing SmartArt node at index 0
System::SharedPtr<Aspose::Slides::SmartArt::SmartArtNode> node0 = System::DynamicCast_noexcept<Aspose::Slides::SmartArt::SmartArtNode>(smart->get_AllNodes()->idx_get(0));
// SharedPtr<ISmartArtNodeCollection> node0Collection = System::DynamicCast_noexcept<ISmartArtNodeCollection>(node0->get_ChildNodes()); ;
SharedPtr<ISmartArtNodeCollection> node0Collection = node0->get_ChildNodes() ;
// Adding new child node at position 2 in parent node
SharedPtr<ISmartArtNode> chNode = node0Collection->AddNodeByPosition(2);
// Add Text
chNode->get_TextFrame()->set_Text(u"Sample Text Added");
}
// Save Presentation
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddNotesSlideWithNotesStyle_out.pptx";
const String templatePath = u"../templates/AccessSlides.pptx";
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
//Accessing Master note slide
SharedPtr<IMasterNotesSlide> notesMaster = pres->get_MasterNotesSlideManager()->get_MasterNotesSlide();
if (notesMaster != NULL)
{
// Get MasterNotesSlide text style
SharedPtr<ITextStyle> notesStyle = notesMaster->get_NotesStyle();
//Set symbol bullet for the first level paragraphs
SharedPtr<IParagraphFormat> paragraphFormat = notesStyle->GetLevel(0);
paragraphFormat->get_Bullet()->set_Type(BulletType::Symbol);
}
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddOLEObjectFrame_out.pptx";
const String filePath = u"../templates/book1.xlsx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Save file to memory stream
{
System::SharedPtr<System::IO::Stream> fileStream = System::IO::File::OpenRead(filePath);
System::SharedPtr<System::IO::MemoryStream> MemStream = MakeObject< System::IO::MemoryStream>();
System::ArrayPtr<uint8_t> buffer = System::MakeObject<System::Array<uint8_t>>(4 * 1024, 0);
int32_t len;
while ((len = fileStream->Read(buffer, 0, buffer->get_Length())) > 0)
{
MemStream->Write(buffer, 0, len);
}
MemStream->set_Position(0);
// Add an Ole Object Frame shape
System::SharedPtr<IOleObjectFrame> oof = slide->get_Shapes()->AddOleObjectFrame(0, 0, 720, 540, u"Excel.Sheet.12", MemStream->ToArray());
}
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>();
// Add comment
System::SharedPtr<ICommentAuthor> author1 = pres->get_CommentAuthors()->AddAuthor(u"Author_1", u"A.A.");
System::SharedPtr<IComment> comment1 = author1->get_Comments()->AddComment(u"comment1", pres->get_Slides()->idx_get(0), System::Drawing::PointF(10.0f, 10.0f), System::DateTime::get_Now());
// Add reply for comment1
System::SharedPtr<ICommentAuthor> author2 = pres->get_CommentAuthors()->AddAuthor(u"Autror_2", u"B.B.");
System::SharedPtr<IComment> reply1 = author2->get_Comments()->AddComment(u"reply 1 for comment 1", pres->get_Slides()->idx_get(0), System::Drawing::PointF(10.0f, 10.0f), System::DateTime::get_Now());
reply1->set_ParentComment(comment1);
// Add reply for comment1
System::SharedPtr<IComment> reply2 = author2->get_Comments()->AddComment(u"reply 2 for comment 1", pres->get_Slides()->idx_get(0), System::Drawing::PointF(10.0f, 10.0f), System::DateTime::get_Now());
reply2->set_ParentComment(comment1);
// Add reply to reply
System::SharedPtr<IComment> subReply = author1->get_Comments()->AddComment(u"subreply 3 for reply 2", pres->get_Slides()->idx_get(0), System::Drawing::PointF(10.0f, 10.0f), System::DateTime::get_Now());
subReply->set_ParentComment(reply2);
System::SharedPtr<IComment> comment2 = author2->get_Comments()->AddComment(u"comment 2", pres->get_Slides()->idx_get(0), System::Drawing::PointF(10.0f, 10.0f), System::DateTime::get_Now());
System::SharedPtr<IComment> comment3 = author2->get_Comments()->AddComment(u"comment 3", pres->get_Slides()->idx_get(0), System::Drawing::PointF(10.0f, 10.0f), System::DateTime::get_Now());
System::SharedPtr<IComment> reply3 = author1->get_Comments()->AddComment(u"reply 4 for comment 3", pres->get_Slides()->idx_get(0), System::Drawing::PointF(10.0f, 10.0f), System::DateTime::get_Now());
reply3->set_ParentComment(comment3);
// Display hierarchy on console
System::SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
auto comments = slide->GetSlideComments(nullptr);
for (int32_t i = 0; i < comments->get_Length(); i++)
{
System::SharedPtr<IComment> comment = comments[i];
while (comment->get_ParentComment() != nullptr)
{
System::Console::Write(u"\t");
comment = comment->get_ParentComment();
}
System::Console::Write(u"{0} : {1}", System::ObjectExt::Box<System::String>(comments[i]->get_Author()->get_Name()), System::ObjectExt::Box<System::String>(comments[i]->get_Text()));
System::Console::WriteLine();
}
pres->Save(u"../out/parent_comment.pptx", Aspose::Slides::Export::SaveFormat::Pptx);
// Remove comment1 and all its replies
comment1->Remove();
pres->Save(u"../out/remove_comment.pptx", Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddPlainLineToSlide_out.pptx";
const String templatePath = u"../templates/AltText.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add an autoshape of type line
SharedPtr<IAutoShape> shape = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 50, 150, 300, 0);
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddRelativeScaleHeightPictureFrame_out.pptx";
const String filePath = u"../templates/Tulips.jpg";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Load Image to be added in presentaiton image collection
// Get the picture
auto bitmap = MakeObject<System::Drawing::Bitmap>(filePath);
// Add image to presentation's images collection
SharedPtr<IPPImage> imgx = pres->get_Images()->AddImage(bitmap);
// Add picture frame to slide
SharedPtr<IPictureFrame> pf = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50, 50, 100, 100, imgx);
// Setting relative scale width and height
pf->set_RelativeScaleHeight (0.8);
pf->set_RelativeScaleWidth(1.35);
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddSimplePictureFrames_out.pptx";
const String filePath = u"../templates/Tulips.jpg";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Load Image to be added in presentaiton image collection
// Get the picture
auto bitmap = MakeObject<System::Drawing::Bitmap>(filePath);
// Add image to presentation's images collection
SharedPtr<IPPImage> imgx = pres->get_Images()->AddImage(bitmap);
// Add picture frame to slide
SharedPtr<IPictureFrame> pf = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50, 50, 100, 100, imgx);
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
//Presentation path
const String outPath = u"../out/AddComments.pptx";
// Instantiate Presentation class
SharedPtr<Presentation>pres = MakeObject<Presentation>();
SharedPtr<ILayoutSlide>layout = pres->get_LayoutSlides()->idx_get(0);
pres->get_Slides()->AddEmptySlide(layout);
// Adding Author
SharedPtr<ICommentAuthor> author = pres->get_CommentAuthors()->AddAuthor(u"Mudassir", u"MF");
// Position of comments
System::Drawing::PointF point = System::Drawing::PointF(0.2f, 0.2f);
// Adding slide comment for an author on slide 1
author->get_Comments()->AddComment(u"Hello Mudassir, this is slide comment", pres->get_Slides()->idx_get(0), point, System::DateTime::get_Now());
// Adding slide comment for an author on slide 1
author->get_Comments()->AddComment(u"Hello Mudassir, this is second slide comment", pres->get_Slides()->idx_get(1), point, DateTime::get_Now());
// Accessing ISlide 1
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../templates/AddSlides.pptx";
// Instantiate Presentation class that represents the presentation file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Instantiate SlideCollection calss
SharedPtr<ISlideCollection> slds = pres->get_Slides();
for (int i = 0; i < pres->get_LayoutSlides()->get_Count(); i++)
{
// Add an empty slide to the Slides collection
slds->AddEmptySlide(pres->get_LayoutSlides()->idx_get(i));
}
// Save the PPTX file to the Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddStockChart_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add chart with default data
SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::OpenHighLowClose, 0, 0, 500, 500);
// Setting the index of chart data sheet
int defaultWorksheetIndex = 0;
// Getting the chart data worksheet
SharedPtr<IChartDataWorkbook> fact = chart->get_ChartData()->get_ChartDataWorkbook();
// Delete default generated series and categories
chart->get_ChartData()->get_Series()->Clear();
chart->get_ChartData()->get_Categories()->Clear();
// Add Catrgories
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 1, 0, ObjectExt::Box<System::String>(u"A")));
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 2, 0, ObjectExt::Box<System::String>(u"B")));
chart->get_ChartData()->get_Categories()->Add(fact->GetCell(defaultWorksheetIndex, 3, 0, ObjectExt::Box<System::String>(u"C")));
// Now, Adding a new series
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 1, ObjectExt::Box<System::String>(u"Open")), chart->get_Type());
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 2, ObjectExt::Box<System::String>(u"High")), chart->get_Type());
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 3, ObjectExt::Box<System::String>(u"Low")), chart->get_Type());
chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 0, 4, ObjectExt::Box<System::String>(u"Close")), chart->get_Type());
// Take first chart series
SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->idx_get(0);
// Now populating first series data
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 1, 1, ObjectExt::Box<double>(72)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 2, 1, ObjectExt::Box<double>(25)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 3, 1, ObjectExt::Box<double>(38)));
series = chart->get_ChartData()->get_Series()->idx_get(1);
// Now populating 2nd series data
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 1, 2, ObjectExt::Box<double>(172)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 2, 2, ObjectExt::Box<double>(57)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 3, 2, ObjectExt::Box<double>(57)));
series = chart->get_ChartData()->get_Series()->idx_get(2);
// Now populating 2nd series data
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 1, 3, ObjectExt::Box<double>(12)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 2, 3, ObjectExt::Box<double>(12)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 3, 3, ObjectExt::Box<double>(13)));
series = chart->get_ChartData()->get_Series()->idx_get(3);
// Now populating 2nd series data
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 1, 4, ObjectExt::Box<double>(25)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 2, 4, ObjectExt::Box<double>(38)));
series->get_DataPoints()->AddDataPointForStockSeries(fact->GetCell(defaultWorksheetIndex, 3, 4, ObjectExt::Box<double>(50)));
//Setting series group
chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->get_UpDownBars()->set_HasUpDownBars (true);
chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->get_HiLowLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid);
for(int i=0;i<chart->get_ChartData()->get_Series()->get_Count();i++)
{
series = chart->get_ChartData()->get_Series()->idx_get(i);
series->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill);
}
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/SunburstChart_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
System::SharedPtr<IChart> chart=slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Sunburst, 50, 50, 500, 400);
chart->get_ChartData()->get_Categories()->Clear();
chart->get_ChartData()->get_Series()->Clear();
System::SharedPtr<IChartDataWorkbook> wb = chart->get_ChartData()->get_ChartDataWorkbook();
wb->Clear(0);
//branch 1
System::SharedPtr<IChartCategory> leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C1", System::ObjectExt::Box<System::String>(u"Leaf1")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem1"));
leaf->get_GroupingLevels()->SetGroupingItem(2, System::ObjectExt::Box<System::String>(u"Branch1"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C2", System::ObjectExt::Box<System::String>(u"Leaf2")));
leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C3", System::ObjectExt::Box<System::String>(u"Leaf3")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem2"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C4", System::ObjectExt::Box<System::String>(u"Leaf4")));
//branch 2
leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C5", System::ObjectExt::Box<System::String>(u"Leaf5")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem3"));
leaf->get_GroupingLevels()->SetGroupingItem(2, System::ObjectExt::Box<System::String>(u"Branch2"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C6", System::ObjectExt::Box<System::String>(u"Leaf6")));
leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C7", System::ObjectExt::Box<System::String>(u"Leaf7")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem4"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C8", System::ObjectExt::Box<System::String>(u"Leaf8")));
System::SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->Add(Aspose::Slides::Charts::ChartType::Sunburst);
series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowCategoryName(true);
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D1", System::ObjectExt::Box<int32_t>(4)));
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D2", System::ObjectExt::Box<int32_t>(5)));
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D3", System::ObjectExt::Box<int32_t>(3)));
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D4", System::ObjectExt::Box<int32_t>(6)));
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D5", System::ObjectExt::Box<int32_t>(9)));
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D6", System::ObjectExt::Box<int32_t>(9)));
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D7", System::ObjectExt::Box<int32_t>(4)));
series->get_DataPoints()->AddDataPointForSunburstSeries(wb->GetCell(0, u"D8", System::ObjectExt::Box<int32_t>(3)));
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/TreemapChart_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
System::SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Treemap, 50, 50, 500, 400);
chart->get_ChartData()->get_Categories()->Clear();
chart->get_ChartData()->get_Series()->Clear();
System::SharedPtr<IChartDataWorkbook> wb = chart->get_ChartData()->get_ChartDataWorkbook();
wb->Clear(0);
//branch 1
System::SharedPtr<IChartCategory> leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C1", System::ObjectExt::Box<System::String>(u"Leaf1")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem1"));
leaf->get_GroupingLevels()->SetGroupingItem(2, System::ObjectExt::Box<System::String>(u"Branch1"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C2", System::ObjectExt::Box<System::String>(u"Leaf2")));
leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C3", System::ObjectExt::Box<System::String>(u"Leaf3")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem2"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C4", System::ObjectExt::Box<System::String>(u"Leaf4")));
//branch 2
leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C5", System::ObjectExt::Box<System::String>(u"Leaf5")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem3"));
leaf->get_GroupingLevels()->SetGroupingItem(2, System::ObjectExt::Box<System::String>(u"Branch2"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C6", System::ObjectExt::Box<System::String>(u"Leaf6")));
leaf = chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C7", System::ObjectExt::Box<System::String>(u"Leaf7")));
leaf->get_GroupingLevels()->SetGroupingItem(1, System::ObjectExt::Box<System::String>(u"Stem4"));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"C8", System::ObjectExt::Box<System::String>(u"Leaf8")));
System::SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->Add(Aspose::Slides::Charts::ChartType::Treemap);
series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowCategoryName(true);
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D1", System::ObjectExt::Box<int32_t>(4)));
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D2", System::ObjectExt::Box<int32_t>(5)));
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D3", System::ObjectExt::Box<int32_t>(3)));
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D4", System::ObjectExt::Box<int32_t>(6)));
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D5", System::ObjectExt::Box<int32_t>(9)));
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D6", System::ObjectExt::Box<int32_t>(9)));
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D7", System::ObjectExt::Box<int32_t>(4)));
series->get_DataPoints()->AddDataPointForTreemapSeries(wb->GetCell(0, u"D8", System::ObjectExt::Box<int32_t>(3)));
series->set_ParentLabelLayout(Aspose::Slides::Charts::ParentLabelLayoutType::Overlapping);
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddVBAMacros_out.pptm";
// Load the desired the presentation
SharedPtr<Presentation> presentation = MakeObject<Presentation>();
// Create new VBA Project
presentation->set_VbaProject(MakeObject<VbaProject>());
// Add empty module to the VBA project
SharedPtr<IVbaModule> module = presentation->get_VbaProject()->get_Modules()->AddEmptyModule(u"Module");
// Set module source code
module->set_SourceCode(u"Sub Test(oShape As Shape) MsgBox \"Test\" End Sub");
// Create reference to <stdole>
SharedPtr<VbaReferenceOleTypeLib> stdoleReference =
MakeObject<VbaReferenceOleTypeLib>(u"stdole", u"*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\\Windows\\system32\\stdole2.tlb#OLE Automation");
// Create reference to Office
SharedPtr<VbaReferenceOleTypeLib> officeReference =
MakeObject<VbaReferenceOleTypeLib>(u"Office", u"*\\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE14\\MSO.DLL#Microsoft Office 14.0 Object Library");
// Add references to the VBA project
presentation->get_VbaProject()->get_References()->Add(stdoleReference);
presentation->get_VbaProject()->get_References()->Add(officeReference);
// Save PPTX to Disk
presentation->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptm);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddVideoFrame_out.pptx";
const String filePath = u"../templates/Wildlife.mp4";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Load the wav sound file to stream
System::SharedPtr<System::IO::FileStream> stream = System::MakeObject<System::IO::FileStream>(filePath, System::IO::FileMode::Open, System::IO::FileAccess::Read);
// Add Video Frame
System::SharedPtr<IVideoFrame> vf = slide->get_Shapes()->AddVideoFrame(50, 150, 300, 150, filePath);
// Set Play Mode and Volume of the Video
vf->set_PlayMode (VideoPlayModePreset::Auto);
vf->set_Volume ( AudioVolumeMode::Loud);
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AddVideoFrameFromWebSource_out.pptx";
const String filePath = u"../templates/video1.avi";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add Video Frame from web source
System::SharedPtr<IVideoFrame> vf = slide->get_Shapes()->AddVideoFrame(10, 10, 427, 240,u"https://www.youtube.com/embed/Tj75Arhq5ho");
// Set Play Mode and Volume of the Video
vf->set_PlayMode(VideoPlayModePreset::Auto);
//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/WaterfallChart_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>();
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
System::SharedPtr<IChart> chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Waterfall, 50, 50, 500, 400);
chart->get_ChartData()->get_Categories()->Clear();
chart->get_ChartData()->get_Series()->Clear();
System::SharedPtr<IChartDataWorkbook> wb = chart->get_ChartData()->get_ChartDataWorkbook();
wb->Clear(0);
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A1", System::ObjectExt::Box<System::String>(u"Category 1")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A2", System::ObjectExt::Box<System::String>(u"Category 2")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A3", System::ObjectExt::Box<System::String>(u"Category 3")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A4", System::ObjectExt::Box<System::String>(u"Category 4")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A5", System::ObjectExt::Box<System::String>(u"Category 5")));
chart->get_ChartData()->get_Categories()->Add(wb->GetCell(0, u"A6", System::ObjectExt::Box<System::String>(u"Category 6")));
System::SharedPtr<IChartSeries> series = chart->get_ChartData()->get_Series()->Add(Aspose::Slides::Charts::ChartType::Waterfall);
series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true);
series->get_DataPoints()->AddDataPointForWaterfallSeries(wb->GetCell(0, u"B1", System::ObjectExt::Box<int32_t>(15)));
series->get_DataPoints()->AddDataPointForWaterfallSeries(wb->GetCell(0, u"B2", System::ObjectExt::Box<int32_t>(-41)));
series->get_DataPoints()->AddDataPointForWaterfallSeries(wb->GetCell(0, u"B3", System::ObjectExt::Box<int32_t>(16)));
series->get_DataPoints()->AddDataPointForWaterfallSeries(wb->GetCell(0, u"B4", System::ObjectExt::Box<int32_t>(10)));
series->get_DataPoints()->AddDataPointForWaterfallSeries(wb->GetCell(0, u"B5", System::ObjectExt::Box<int32_t>(-23)));
series->get_DataPoints()->AddDataPointForWaterfallSeries(wb->GetCell(0, u"B6", System::ObjectExt::Box<int32_t>(16)));
series->get_DataPoints()->idx_get(5)->set_SetAsTotal(true);
series->set_ShowConnectorLines(false);
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/ExistingChart.pptx";
const String outPath = u"../out/AnimatingCategoriesElements_out.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add chart with default data
auto chart = DynamicCast<Aspose::Slides::Charts::Chart>(slide->get_Shapes()->idx_get(0));
// Animate categories' elements
slide->get_Timeline()->get_MainSequence()->AddEffect(chart, EffectType::Fade, EffectSubtype::None, EffectTriggerType::AfterPrevious);
auto sequence = DynamicCast<Aspose::Slides::Animation::Sequence>(slide->get_Timeline()->get_MainSequence());
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 2, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 2, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType:: ByElementInCategory, 2, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 2, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/ExistingChart.pptx";
const String outPath = u"../out/AnimatingSeries.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add chart with default data
auto chart = DynamicCast<Aspose::Slides::Charts::Chart>(slide->get_Shapes()->idx_get(0));
// Animate series
slide->get_Timeline()->get_MainSequence()->AddEffect(chart, EffectType::Fade, EffectSubtype::None, EffectTriggerType::AfterPrevious);
auto sequence = DynamicCast<Aspose::Slides::Animation::Sequence>(slide->get_Timeline()->get_MainSequence());
sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 0,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 1,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 2,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 3,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/ExistingChart.pptx";
const String outPath = u"../out/AnimatingSeriesElements.pptx";
//Instantiate Presentation class that represents PPTX file
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
//Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add chart with default data
auto chart = DynamicCast<Aspose::Slides::Charts::Chart>(slide->get_Shapes()->idx_get(0));
// Animate series elements
slide->get_Timeline()->get_MainSequence()->AddEffect(chart, EffectType::Fade, EffectSubtype::None, EffectTriggerType::AfterPrevious);
auto sequence = DynamicCast<Aspose::Slides::Animation::Sequence>(slide->get_Timeline()->get_MainSequence());
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious);
// Write the presentation file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
const String templatePath = u"../templates/Presentation1.pptx";
const String outPath = u"../out/animationEffectinParagraph.pptx";
auto presentation = System::MakeObject<Presentation>(templatePath);
// select paragraph to add effect
auto autoShape = System::DynamicCast<Aspose::Slides::IAutoShape>(presentation->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0));
auto paragraph = autoShape->get_TextFrame()->get_Paragraphs()->idx_get(0);
// add Fly animation effect to selected paragraph
auto effect = presentation->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence()->AddEffect(
paragraph,
Aspose::Slides::Animation::EffectType::Fly,
Aspose::Slides::Animation::EffectSubtype::Left,
Aspose::Slides::Animation::EffectTriggerType::OnClick);
presentation->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AnimationsOnOLEObject_out.pptx";
const String templatePath = u"../templates/AccessingOLEObjectFrame.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
//Accessing OLE Object
System::SharedPtr<IOleObjectFrame> ole = System::DynamicCast<Aspose::Slides::IOleObjectFrame>(pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0));
//Applying animation effects
System::SharedPtr<IEffect> effect = pres->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence()->AddEffect(ole, Aspose::Slides::Animation::EffectType::OLEObjectOpen, Aspose::Slides::Animation::EffectSubtype::None, Aspose::Slides::Animation::EffectTriggerType::OnClick);
//System::SharedPtr<IEffect> effect = pres->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence()->AddEffect(ole, Aspose::Slides::Animation::EffectType::OLEObjectEdit, Aspose::Slides::Animation::EffectSubtype::None, Aspose::Slides::Animation::EffectTriggerType::OnClick);
//System::SharedPtr<IEffect> effect = pres->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence()->AddEffect(ole, Aspose::Slides::Animation::EffectType::OLEObjectShow, Aspose::Slides::Animation::EffectSubtype::None, Aspose::Slides::Animation::EffectTriggerType::OnClick);
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
//Now loading the presentaiton with effects
System::SharedPtr<Presentation> pres2 = System::MakeObject<Presentation>(outPath);
System::SharedPtr<IShape> shape = pres2->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0);
System::ArrayPtr<System::SharedPtr<IEffect>> effects = pres2->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence()->GetEffectsByShape(shape);
if (effects->get_Length() > 0 && effects[0]->get_PresetClassType() == Aspose::Slides::Animation::EffectPresetClassType::OLEActionVerbs)
System::Console::WriteLine(u"This shape has the OLE Action Verb effect");
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/AnimationsOnShapes_out.pptx";
const String templatePath = u"../templates/ConnectorLineAngle.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Accessing shapes collection for selected slide
SharedPtr<IShapeCollection> shapes = slide->get_Shapes();
// Now create effect "PathFootball" for existing shape from scratch.
SharedPtr<IAutoShape> ashp = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 150, 150, 250, 25);
ashp->AddTextFrame(u"Animated TextBox");
// Add PathFootBall animation effect
slide->get_Timeline()->get_MainSequence()->AddEffect(ashp, EffectType::PathFootball,
EffectSubtype::None, EffectTriggerType::AfterPrevious);
// Create some kind of "button".
SharedPtr<IAutoShape> shapeTrigger = slide->get_Shapes()->AddAutoShape(ShapeType::Bevel, 10, 10, 20, 20);
// Create sequence of effects for this button.
SharedPtr<ISequence> seqInter = slide->get_Timeline()->get_InteractiveSequences()->Add(shapeTrigger);
// Create custom user path. Our object will be moved only after "button" click.
SharedPtr<IEffect> fxUserPath = seqInter->AddEffect(ashp, EffectType::PathUser, EffectSubtype::None, EffectTriggerType::OnClick);
// Created path is empty so we should add commands for moving.
SharedPtr<MotionEffect> motionBhv = DynamicCast<MotionEffect>(fxUserPath->get_Behaviors()->idx_get(0));
// SharedPtr<PointF> point = MakeObject<PointF >(0.076, 0.59);
const PointF point = PointF (0.076, 0.59);
System::ArrayPtr<PointF> pts = System::MakeObject<System::Array<PointF>>(1, point);
motionBhv->get_Path()->Add(MotionCommandPathType::LineTo, pts, MotionPathPointsType::Auto, true);
//PointF point2[1] = { -0.076, -0.59 };
const PointF point2 = PointF(-0.076, -0.59 );
System::ArrayPtr<PointF> pts2 = System::MakeObject<System::Array<PointF>>(1, point2);
motionBhv->get_Path()->Add(MotionCommandPathType::LineTo, pts2, MotionPathPointsType::Auto, false);
motionBhv->get_Path()->Add(MotionCommandPathType::End, nullptr, MotionPathPointsType::Auto, false);
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/Apply3DRotationEffectOnShape_out.pptx";
const String templatePath = u"../templates/ConnectorLineAngle.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Accessing shapes collection for selected slide
SharedPtr<IShapeCollection> shapes = slide->get_Shapes();
// Now create effect "PathFootball" for existing shape from scratch.
SharedPtr<IAutoShape> autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30, 30, 200, 200);
autoShape->get_ThreeDFormat()->set_Depth (6);
autoShape->get_ThreeDFormat()->get_Camera()->SetRotation(40, 35, 20);
autoShape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::IsometricLeftUp);
autoShape->get_ThreeDFormat()->get_LightRig()->set_LightType ( LightRigPresetType::Balanced);
autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 30, 300, 200, 200);
autoShape->get_ThreeDFormat()->set_Depth(6);
autoShape->get_ThreeDFormat()->get_Camera()->SetRotation(0, 35, 20);
autoShape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::IsometricLeftUp);
autoShape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Balanced);
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/ApplyBevelEffects_out.pptx";
const String templatePath = u"../templates/ConnectorLineAngle.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Accessing shapes collection for selected slide
SharedPtr<IShapeCollection> shapes = slide->get_Shapes();
// Now create effect "PathFootball" for existing shape from scratch.
SharedPtr<IAutoShape> autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 30, 30, 100, 100);
autoShape->get_FillFormat()->set_FillType ( FillType::Solid);
autoShape->get_FillFormat()->get_SolidFillColor()->set_Color ( Color::get_Green());
SharedPtr<ILineFillFormat> format = autoShape->get_LineFormat()->get_FillFormat();
format->set_FillType ( FillType::Solid);
format->get_SolidFillColor()->set_Color(Color::get_Orange());
autoShape->get_LineFormat()->set_Width ( 2.0);
// Set ThreeDFormat properties of shape
autoShape->get_ThreeDFormat()->set_Depth(4);
autoShape->get_ThreeDFormat()->get_BevelTop()->set_BevelType (BevelPresetType::Circle);
autoShape->get_ThreeDFormat()->get_BevelTop()->set_Height ( 6);
autoShape->get_ThreeDFormat()->get_BevelTop()->set_Width ( 6);
autoShape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront);
autoShape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::ThreePt);
autoShape->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top);
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
const String templatePath = u"../templates/HelloWorld.pptx";
const String templateThemePath = u"../templates/Theme1Word.pptx";
const String outPptxFileName = u"../out/ApplyingExternalThemeToDependingSlides_out.ppt";
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
pres->get_Masters()->idx_get(0)->ApplyExternalThemeToDependingSlides(templateThemePath);
pres->Save(outPptxFileName, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/ApplyInnerShadow_out.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);
// Add an AutoShape of Rectangle type
SharedPtr<IAutoShape> ashp = sld->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 150, 75, 150, 50);
// Add TextFrame to the Rectangle
ashp->AddTextFrame(u" ");
// Accessing the text frame
SharedPtr<ITextFrame> txtFrame = ashp->get_TextFrame();
// Create the Paragraph object for text frame
SharedPtr<IParagraph> paragraph = txtFrame->get_Paragraphs()->idx_get(0);
// Create Portion object for paragraph
SharedPtr<IPortion> portion = paragraph->get_Portions()->idx_get(0);
portion->set_Text(u"Aspose TextBox");
portion->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid);
portion->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black());
portion->get_PortionFormat()->set_FontHeight(50);
SharedPtr<IPortionFormat> pf = portion->get_PortionFormat();
// Enable InnerShadowEffect
SharedPtr<IEffectFormat> ef = pf->get_EffectFormat();
ef->EnableInnerShadowEffect();
// Set all necessary parameters
ef->get_InnerShadowEffect()->set_BlurRadius ( 8.0);
ef->get_InnerShadowEffect()->set_Direction(90.0);
ef->get_InnerShadowEffect()->set_Distance ( 6.0);
ef->get_InnerShadowEffect()->get_ShadowColor()->set_B (189);
// Set ColorType as Scheme
ef->get_InnerShadowEffect()->get_ShadowColor()->set_ColorType (ColorType::Scheme);
// Set Scheme Color
ef->get_InnerShadowEffect()->get_ShadowColor()->set_SchemeColor ( SchemeColor::Accent1);
// Save PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/ApplyOuterShadow_out.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);
// Add an AutoShape of Rectangle type
SharedPtr<IAutoShape> ashp = sld->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 150, 75, 150, 50);
// Add TextFrame to the Rectangle
ashp->AddTextFrame(u" ");
// Accessing the text frame
SharedPtr<ITextFrame> txtFrame = ashp->get_TextFrame();
// Create the Paragraph object for text frame
SharedPtr<IParagraph> paragraph = txtFrame->get_Paragraphs()->idx_get(0);
// Create Portion object for paragraph
SharedPtr<IPortion> portion = paragraph->get_Portions()->idx_get(0);
portion->set_Text(u"Aspose TextBox");
portion->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid);
portion->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black());
portion->get_PortionFormat()->set_FontHeight(50);
SharedPtr<IPortionFormat> pf = portion->get_PortionFormat();
// Enable InnerShadowEffect
SharedPtr<IEffectFormat> ef = pf->get_EffectFormat();
ef->EnableOuterShadowEffect();
// Set all necessary parameters
ef->get_OuterShadowEffect()->set_BlurRadius(6.0);
ef->get_OuterShadowEffect()->set_Direction(123.0);
ef->get_OuterShadowEffect()->set_Distance(5.0);
ef->get_OuterShadowEffect()->get_ShadowColor()->set_G(200);
// Set ColorType as Scheme
ef->get_OuterShadowEffect()->get_ShadowColor()->set_ColorType(ColorType::Scheme);
// Set Scheme Color
ef->get_OuterShadowEffect()->get_ShadowColor()->set_SchemeColor(SchemeColor::Dark1);
// Save PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
// The path to the documents directory.
const String templatePath = u"../templates/RectPicFrame.pptx";
const String outPath = u"../out/ProtectedSample.pptx";
//Instatiate Presentation class that represents a PPTX
SharedPtr<Presentation> pres = MakeObject<Presentation>(templatePath);
//ISlide object for accessing the slides in the presentation
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
//IShape object for holding temporary shapes
SharedPtr<IShape> shape;
//Traversing through all the slides in the presentation
for (int slideCount = 0; slideCount < pres->get_Slides()->get_Count(); slideCount++)
{
slide = pres->get_Slides()->idx_get(slideCount);
//Travesing through all the shapes in the slides
for (int count = 0; count < slide->get_Shapes()->get_Count(); count++)
{
shape = slide->get_Shapes()->idx_get(count);
if (System::ObjectExt::Is<IAutoShape>(shape)) {
//Type casting to Auto shape and getting auto shape lock
SharedPtr<IAutoShape> aShp = DynamicCast<Aspose::Slides::IAutoShape>(shape);
SharedPtr<IAutoShapeLock> autoShapeLock = DynamicCast<Aspose::Slides::IAutoShapeLock>(aShp->get_ShapeLock());
//Applying shapes locks
autoShapeLock->set_PositionLocked(true);
autoShapeLock->set_SelectLocked(true);
autoShapeLock->set_SizeLocked(true);
}
//if shape is group shape
else if (System::ObjectExt::Is<IGroupShape>(shape)) {
//Type casting to group shape and getting group shape lock
SharedPtr<IGroupShape> group = DynamicCast<Aspose::Slides::IGroupShape>(shape);
SharedPtr<IGroupShapeLock> groupShapeLock = DynamicCast<Aspose::Slides::IGroupShapeLock>(group->get_ShapeLock());
//Applying shapes locks
groupShapeLock->set_GroupingLocked(true);
groupShapeLock->set_PositionLocked(true);
groupShapeLock->set_SelectLocked(true);
groupShapeLock->set_SizeLocked(true);
}
//if shape is a connector
else if (System::ObjectExt::Is<IConnector>(shape)) {
//Type casting to connector shape and getting connector shape lock
SharedPtr<IConnector> conn = DynamicCast<Aspose::Slides::IConnector>(shape);
SharedPtr<IConnectorLock> connLock = DynamicCast<Aspose::Slides::IConnectorLock>(conn->get_ShapeLock());
//Applying shapes locks
connLock->set_PositionMove(true);
connLock->set_SelectLocked(true);
connLock->set_SizeLocked(true);
}
//if shape is picture frame
else if (System::ObjectExt::Is<IPictureFrame>(shape)) {
//Type casting to pitcture frame shape and getting picture frame shape lock
SharedPtr<IPictureFrame> pic = DynamicCast<Aspose::Slides::IPictureFrame>(shape);
SharedPtr<IPictureFrameLock> picLock = DynamicCast<Aspose::Slides::IPictureFrameLock>(pic->get_ShapeLock());
//Applying shapes locks
picLock->set_PositionLocked(true);
picLock->set_SelectLocked(true);
picLock->set_SizeLocked(true);
}
}
}
//Saving the presentation file
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);
For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String templatePath = u"../templates/AssistantNode.pptx";
const String outPath = u"../out/ChangeAssitantNode_out.pptx";
// Load the desired the presentation