Aspose.Slides for C++ 21.4 Release Notes

Supported Platforms

  • Aspose.Slides for C++ for Windows x64 (Microsoft Visual C++).
  • Aspose.Slides for C++ for Windows x86 (Microsoft Visual C++).
  • Aspose.Slides for C++ for Linux (Clang).

New Features and Enhancements

Key Summary Category
SLIDESNET-42407 Constant size of slide text array from a presentation text Enhancement
SLIDESNET-41258 Ability to create 2D shapes with complex path Feature
SLIDESNET-34362 Support for drawing freeform or sketch using Aspose.Slides Feature
SLIDESNET-42457 Extend SlideUtil.AlignShape() to support alignment within GroupShape Enhancement
SLIDESNET-42191 Embedded font cannot be installed in resaved presentation Enhancement
SLIDESNET-30876 3-D effects on shapes are lost in exported PDF, TIFF Feature
SLIDESNET-41047 Add clone taking long time Enhancement

Other Improvements and Changes

Key Summary Category
SLIDESCPP-2690 Use Aspose.Slides for .NET 21.4 features Enhancement
SLIDESCPP-2822 Saving to disk is super slow Investigation

Public API Changes

get_PlayAcrossSlides(), set_PlayAcrossSlides(), get_RewindAudio() and set_RewindAudio() methods have been added to IAudioFrame interface

New get_PlayAcrossSlides(), set_PlayAcrossSlides(), get_RewindAudio() and set_RewindAudio() methods have been added to IAudioFrame interface and AudioFrame class.

The get_PlayAcrossSlides() and set_PlayAcrossSlides() methods allow determining whether audio is playing across the slides.

The get_RewindAudio() and set_RewindAudio() methods allow determining whether audio is automatically rewinded to start after playing.

The code snippet below demonstrates adding the AudioFrame and changing its properties:

auto pres = System::MakeObject<Presentation>();
auto slide = pres->get_Slides()->idx_get(0);
        
// Add Audio Frame
auto audioFrame = slide->get_Shapes()->AddAudioFrameLinked(50.0f, 50.0f, 100.0f, 100.0f, u"sampleaudio.wav");
        
// Set Audio to play across the slides
audioFrame->set_PlayAcrossSlides(true);
        
// Set Audio to automatically rewind to start after playing
audioFrame->set_RewindAudio(true);
        
pres->Save(u"AudioFrame_out.pptx", Export::SaveFormat::Pptx);

InClickSequence value has been added to AudioPlayModePreset enumeration

InClickSequence value has been added to AudioPlayModePreset enumeration. It represents In Click Sequence audio start play mode.

The code snippet below demonstrates adding the AudioFrame and changing its play mode:

auto pres = System::MakeObject<Presentation>();
auto slide = pres->get_Slides()->idx_get(0);

// Add Audio Frame
auto audioFrame = slide->get_Shapes()->AddAudioFrameLinked(50.0f, 50.0f, 100.0f, 100.0f, u"sampleaudio.wav");

// Set audio play mode to In Click Sequence
audioFrame->set_PlayMode(AudioPlayModePreset::InClickSequence);

pres->Save(u"AudioFrame_out.pptx", Export::SaveFormat::Pptx);

InClickSequence value has been added to VideoPlayModePreset enumeration

InClickSequence value has been added to VideoPlayModePreset enumeration. It represents In Click Sequence video start play mode.

The code snippet below demonstrates adding the VideoFrame and changing its play mode:

auto pres = System::MakeObject<Presentation>();
auto slide = pres->get_Slides()->idx_get(0);
        
// Add Video Frame
auto videoFrame = slide->get_Shapes()->AddVideoFrame(50.0f, 50.0f, 200.0f, 150.0f, u"samplevideo.wmv");
        
// Set video play mode to In Click Sequence
videoFrame->set_PlayMode(VideoPlayModePreset::InClickSequence);
        
pres->Save(u"VideoFrame_out.pptx", Export::SaveFormat::Pptx);

IOleObjectFrame::SetEmbeddedData() and IOleObjectFrame::get_EmbeddedData() methods have been added

New SetEmbeddedData() and get_EmbeddedData() methods have been added to the IOleObjectFrame interface and OleObjectFrame class.

These methods allow to get, set and change an embedded data and its type of OLE object.

The code snippet below demonstrates getting and changing OLE embedded data in existing OLE object:

auto pres = System::MakeObject<Presentation>(u"pres.pptx");
System::SharedPtr<OleObjectFrame> oleFrame;

// Get first slide of a presentation
auto slide = pres->get_Slides()->idx_get(0);

// Traversing all shapes for OLE frame
for (auto shape : System::IterateOver(slide->get_Shapes()))
{
    if (System::ObjectExt::Is<OleObjectFrame>(shape))
    {
        oleFrame = System::DynamicCast<OleObjectFrame>(shape);
    }
}

if (oleFrame != nullptr)
{
    // Create a file name with type of an embedded data
    auto embeddedFile = System::String(u"EmbeddedData.") + oleFrame->get_EmbeddedData()->get_EmbeddedFileExtension();

    // Save embedded data to a file
    System::IO::File::WriteAllBytes(embeddedFile, oleFrame->get_EmbeddedData()->get_EmbeddedFileData());

    // Create new data for embedding in OLE object
    auto data = System::IO::File::ReadAllBytes(u"book1.xlsx");
    auto newData = System::MakeObject<OleEmbeddedDataInfo>(data, u"xlsx");

    // Change embedding data in OleObjectFrame
    oleFrame->SetEmbeddedData(newData);
}

pres->Save(u"OleEdit_out.pptx", Export::SaveFormat::Pptx);

Please note that methods get_ObjectData(), set_ObjectData(), get_EmbeddedFileExtension() and get_EmbeddedFileData() of IOleObjectFrame interface marked as deprecated now so please use SetEmbeddedData() and get_EmbeddedData() methods instead of them. These deprecated methods will be removed after the release of version 21.11.

New overloads for the SlideUtil::AlignShapes() method have been added

New AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, System::SharedPtr slide) method has been added to the SlideUtil class. This overloading allows aligning all shapes within IBaseSlide.

auto pres = System::MakeObject<Presentation>();
auto slide = pres->get_Slides()->idx_get(0);

auto shape1 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100.0f, 100.0f, 100.0f, 100.0f);
auto shape2 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 200.0f, 100.0f, 100.0f);
auto shape3 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 300.0f, 300.0f, 100.0f, 100.0f);

SlideUtil::AlignShapes(ShapesAlignmentType::AlignBottom, true, pres->get_Slides()->idx_get(0));

pres->Save(u"output.pptx", Export::SaveFormat::Pptx);

New AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, System::SharedPtr groupShape) method has been added to the SlideUtil class. This overloading allows aligning all shapes within IGroupShape.

auto pres = System::MakeObject<Presentation>();
auto slide = pres->get_Slides()->idx_get(0);
auto groupShape = slide->get_Shapes()->AddGroupShape();

groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 350.0f, 50.0f, 50.0f, 50.0f);
groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 450.0f, 150.0f, 50.0f, 50.0f);
groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 550.0f, 250.0f, 50.0f, 50.0f);
groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 650.0f, 350.0f, 50.0f, 50.0f);
        
SlideUtil::AlignShapes(ShapesAlignmentType::AlignLeft, false, groupShape);

pres->Save(u"output.pptx", Export::SaveFormat::Pptx);

New AlignShapes(ShapesAlignmentType alignmentType, bool alignToSlide, System::SharedPtr groupShape, System::ArrayPtr<int32_t> shapeIndexes) method has been added to the SlideUtil class. This overloading allows aligning shapes with specified indexes within IGroupShape.

auto pres = System::MakeObject<Presentation>();
auto slide = pres->get_Slides()->idx_get(0);
auto groupShape = slide->get_Shapes()->AddGroupShape();

groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 350.0f, 50.0f, 50.0f, 50.0f);
groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 450.0f, 150.0f, 50.0f, 50.0f);
groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 550.0f, 250.0f, 50.0f, 50.0f);
groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 650.0f, 350.0f, 50.0f, 50.0f);
        
SlideUtil::AlignShapes(ShapesAlignmentType::AlignLeft, false, groupShape, System::MakeArray<int32_t>({ 0, 2 }));
        
pres->Save(u"output.pptx", Export::SaveFormat::Pptx);