Browse our Products

Aspose.Slides for .NET 20.5 Release Notes

KeySummaryCategory
SLIDESNET-41835Performance issues related to Aspose.SlidesInvestigation
SLIDESNET-41786Add the ability to validate password to modifyFeature
SLIDESNET-40011Align Multiple shapes in one lineFeature
SLIDESNET-38923Feature to identify read-protected and write-protected presentationsFeature
SLIDESNET-37280Support for Mathematical Equations (OMML)Feature
SLIDESNET-41621Importing Excel EMF image has broken aspect ratioEnhancement
SLIDESNET-38545Get real table row height, after the long text is added to a cellEnhancement
SLIDESNET-41893PowerPoint Waterfall Chart loses chart characteristicsBug
SLIDESNET-41881Graph issues while converting PPTX to PDFBug
SLIDESNET-41871Specifying First Slide Number break Hyperlinks in PDFBug
SLIDESNET-41870Gapwidth property not working as expectedBug
SLIDESNET-41867Error when trying to open PPT PresentationBug
SLIDESNET-41862The margins are changed when converting the ODP to PPTXBug
SLIDESNET-41861Chart improperly rendered in exported PDFBug
SLIDESNET-41858Portion.getRect() returns wrong value if TextFrame contains columnsBug
SLIDESNET-41837Japanese characters are rendered wrongBug
SLIDESNET-41830SVG is not getting imported in slide properlyBug
SLIDESNET-41812Roboto font is not rendered correctly in saved presentation and PDFBug
SLIDESNET-41795Font Format ‘Kerning’ Applied after mergingBug
SLIDESNET-41682Arrows are improperly rendered in generated thumbnailBug
SLIDESNET-41502Ppt changed after savingBug
SLIDESNET-41323Wrong paragraphs after cloningBug
SLIDESNET-40971Text losses boldness after load and save twiceBug
SLIDESNET-40968EMF image is not properly written as SVGBug
SLIDESNET-40393Bullets appeared when export into PPTBug
SLIDESNET-38424Graphic elements changed converting from pptx to pdfBug
SLIDESNET-33602PowerPoint 2010 Equations are transformed to image upon saveBug

Public API Changes

Presentation Shapes Alignment Support

Description

This new feature helps to change the placement of selected shapes on the slide. Align shapes to the margins or the edge of the slide or align them relative to each other.

todo:image_alt_text

To provide support of PowerPoint options from the picture above a new overloaded SlideUtil.AlignShapes method and ShapesAlignmentType enum have been added.

ShapesAlignmentType Enum

The ShapesAlignmentType determines the way to align shapes.

Possible values for the ShapesAlignmentType enum: AlignLeft, AlignRight, AlignCenter, AlignTop, AlignMiddle, AlignBottom, DistributeHorizontally, DistributeVertically.

SlideUtil.AlignShape() Method

The method changes the placement of selected shapes on the slide. Input parameters:

  • ShapesAlignmentType alignmentType - determines which type of alignment will be applied.
  • bool alignToSlide - if true, shapes will be aligned relative to the slide edges. Otherwise, shapes will be aligned relative to each other.
  • IBaseSlide slide - parent slide.
  • int[] shapeIndexes - indexes of shapes to be aligned.
  • IShapeCollection shapes - a collection of shapes to be aligned.

Example:

todo:image_alt_text

Let’s say we want to align shapes with indexes 1, 2, and 4 along the top border of the slide. Below is a code snippet of how to achieve that.

Example:

using (Presentation pres = new Presentation("example.pptx"))
{
    ISlide slide = pres.Slides[0];
    IShape shape1 = slide.Shapes[1];
    IShape shape2 = slide.Shapes[2];
    IShape shape3 = slide.Shapes[4];
    SlideUtil.AlignShapes(ShapesAlignmentType.AlignTop, **true**, pres.Slides[0], **new** int[]
    {
            slide.Shapes.IndexOf(shape1),
            slide.Shapes.IndexOf(shape2),
            slide.Shapes.IndexOf(shape3)
    });
}

todo:image_alt_text

Example:

Another option shows how to align the entire collection of shapes on the slide:

using (Presentation pres = new Presentation("example.pptx"))
{
    SlideUtil.AlignShapes(ShapesAlignmentType.AlignBottom, false, pres.Slides[0].Shapes);
}

Check the Write Protection Password via IPresentationInfo Interface

IsWriteProtected property and CheckWriteProtection method have been added to IPresentationInfo interface and PresentationInfo class. This property and method allow checking whether a presentation is protected by a password to modify. The password to modify is intended to set write protection on the presentation. Write protection restricts the ability to save the presentation to the same path using host applications.

Property and method declarations:

/// <summary>
/// Gets a value that indicates whether a binded presentation is write protected.
/// </summary>
/// <remarks>
/// If the presentation is protected by a password to open, the property value equals NotDefined.
/// See <see cref="NullableBool"/> enumeration.
/// </remarks>
NullableBool IsWriteProtected { **get**; }

/// <summary>
/// Checks whether a password to modify is correct for a write protected presentation.
/// </summary>
/// <param name="password">The password to check.</param>
/// <returns>
/// True if the presentation is write protected and the password is correct. False otherwise.
/// </returns>
/// <remarks>
/// 1. You should check the <see cref="IsWriteProtected"/> property before calling this method.
/// 2. When password is null or empty, this method returns false.
/// </remarks>
/// <exception cref="InvalidOperationException"/>
bool CheckWriteProtection(string password);

Example:

The example below demonstrates how to check the password to modify the presentation:

IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo(presentationFilePath); bool isWriteProtectedByPassword = info.IsWriteProtected == NullableBool.True && info.CheckWriteProtection(“my_password”);

Check the Write Protection Password via IProtectionManager Interface

CheckWriteProtection method has been added to the IProtectionManager interface and ProtectionManager class. This method allows checking whether a presentation is protected by a password to modify. The password to modify is intended to set write protection on the presentation. Write protection restricts the ability to save the presentation to the same path using host applications.

Method declaration:

/// <summary>
/// Determines whether a presentation is a password protected to modify.
/// </summary>
/// <param name="password">The password for checking.</param>
/// <returns>True if the password is valid; otherwise, false.</returns>
/// <remarks>
/// 1. You should check the <see cref="IsWriteProtected"/> property before calling this method.
/// 2. When the password is null or empty, this method returns false.
/// </remarks>
bool CheckWriteProtection(string password);

Example:

The example below demonstrates how to check a password to modify a presentation:

using (var presentation = new Presentation(presentationFilePath))
{
`   `bool isWriteProtected = presentation.ProtectionManager.CheckWriteProtection("my_password");
}

Check Presentation Open Protection via IPresentationInfo Interface

IsPasswordProtected property has been added to IPresentationInfo interface and PresentationInfo class. This property allows checking whether a presentation is protected to open. The presentation has protection to open when a password is set to the document.

Property declaration:

/// <summary>
/// Gets a value that indicates whether a binded presentation is protected by a password to open.
/// </summary>
bool IsPasswordProtected { get; }

Example:

The example below demonstrates how to check protection to open:

IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo(presentationFilePath);
if (info.IsPasswordProtected)
{
`    `Console.WriteLine("The presentation '" + presentationFilePath + "' is protected by password to open.");
}