Browse our Products

Aspose.Slides for .NET 17.5 Release Notes

KeySummaryCategory
SLIDESNET-38576Size of SWF generated is too highInvestigation
SLIDESNET-38499PowerPoint to SVG with shape IDInvestigation
SLIDESNET-38379Implement using HeaderFooterManager for slide/master/layoutFeature
SLIDESNET-38608Exception on saving presentationBug
SLIDESNET-38593Exported file cannot be opened via Aspose.SlidesBug
SLIDESNET-38584Exception on converting PPTX to PDFBug
SLIDESNET-38572PPTX not converted properly to tiffBug
SLIDESNET-38570Incorrect Presentation instantiating with empty string passwordBug
SLIDESNET-38568PPT not converted properly to PDFBug
SLIDESNET-38553Text changed to asteriskBug
SLIDESNET-38550Changes in Workbook doesn’t get savedBug
SLIDESNET-38548PPT to tiff not properly convertedBug
SLIDESNET-38547Conversion to PDF with low quality of imagesBug
SLIDESNET-38537Adding Doughnut chart from scratch does not workBug
SLIDESNET-38536PPT not converted properly to PDFBug
SLIDESNET-38527PPT not converted properly to PDFBug
SLIDESNET-38526Zoom problem in generated presentationBug
SLIDESNET-38520Images are not properly generated from PPTBug
SLIDESNET-38516Text are changed after saving PPTBug
SLIDESNET-38514Text becomes shorter after saving PPTBug
SLIDESNET-38504PPT changed after savingBug
SLIDESNET-38464Problems editing chart after saving PPTXBug
SLIDESNET-38454Table width is changed after saving fileBug
SLIDESNET-38422Incorrect font when rendering to HTMLBug
SLIDESNET-38299Footer is not working properlyBug
SLIDESNET-37736Footer failed to apply in presentationBug
SLIDESNET-36678Text gets biggerBug

Public API Changes

HeaderFooterManager specialized classes and interfaces have been added

IBaseHeaderFooterManager, IBaseSlideHeaderFooterManager, IMasterSlideHeaderFooterManager, ILayoutSlideHeaderFooterManager, ISlideHeaderFooterManager, IPresentationHeaderFooterManager interfaces and BaseHeaderFooterManager, BaseSlideHeaderFooterManager, MasterSlideHeaderFooterManager, LayoutSlideHeaderFooterManager, SlideHeaderFooterManager, PresentationHeaderFooterManager classes have been added. These types allow managing Header Footer settings of different presentation elements.

The base IBaseHeaderFooterManager interface of all listed types has following properties and methods.

These properties allow getting value indicating that a footer, page number and date-time placeholders are present:

bool IsFooterVisible { get; }
bool IsSlideNumberVisible { get; }
bool IsDateTimeVisible { get; }

These methods allow changing footer, page number and date-time placeholders visibility:

void SetFooterVisibility(bool isVisible);
void SetSlideNumberVisibility(bool isVisible);
void SetDateTimeVisibility(bool isVisible);

These methods allow setting text to footer and date-time placeholder:

void SetFooterText(string text);
void SetDateTimeText(string text);

In addition, IMasterSlideHeaderFooterManager and ILayoutSlideHeaderFooterManager have following properties and methods to manage instance own and all childs elements Header and Footer settings.

These methods allow changing master/layout slide footer, page number, date-time placeholder and all child footer placeholders visibility. Child placeholders mean placeholders are contained on depending layout slides and depending slides. Depending layout slides and slides use and depend on master slide:

void SetFooterAndChildFootersVisibility(bool isVisible);
void SetSlideNumberAndChildSlideNumbersVisibility(bool isVisible);
void SetDateTimeAndChildDateTimesVisibility(bool isVisible);

These methods allow setting text to master/layout slide footer and date-time placeholder and all child footer placeholders. Child placeholders mean placeholders are contained on depending layout slides and depending slides. Depending layout slides and slides use and depend on master slide:

void SetFooterAndChildFootersText(string text);
void SetDateTimeAndChildDateTimesText(string text);

New properties have been added to access the added types.

IMasterSlideHeaderFooterManager IMasterSlide.HeaderFooterManager { get; }
ILayoutSlideHeaderFooterManager ILayoutSlide.HeaderFooterManager { get; }
ISlideHeaderFooterManager ISlide.HeaderFooterManager { get; }

The type of the property has been changed

IPresentationSlideHeaderFooterManager IPresentation.HeaderFooterManager { get; }

IHeaderFooterManager and class HeaderFooterManager have been marked as Obsolete.

Usage examples:

using (Presentation presentation = new Presentation("presentation.ppt"))
{
  IBaseSlideHeaderFooterManager headerFooterManager = presentation.Slides[0].HeaderFooterManager;
  if (!headerFooterManager.IsFooterVisible) // Property IsFooterVisible is used for indicating that a slide footer placeholder is not present.
  {
    headerFooterManager.SetFooterVisibility(true); // Method SetFooterVisibility is used for making a slide footer placeholder visible.
  }
  if (!headerFooterManager.IsSlideNumberVisible) // Property IsSlideNumberVisible is used for indicating that a slide page number placeholder is not present.
  {
    headerFooterManager.SetSlideNumberVisibility(true); // Method SetSlideNumberVisibility is used for making a slide page number placeholder visible.
  }
  if (!headerFooterManager.IsDateTimeVisible) // Property IsDateTimeVisible is used for indicating that a slide date-time placeholder is not present.
  {
    headerFooterManager.SetDateTimeVisibility(true); // Method SetFooterVisibility is used for making a slide date-time placeholder visible.
  }
  headerFooterManager.SetFooterText("Footer text"); // Method SetFooterText is used for setting text to slide footer placeholder.
  headerFooterManager.SetDateTimeText("Date and time text"); // Method SetDateTimeText is used for setting text to slide date-time placeholder.
}
using (Presentation presentation = new Presentation("presentation.ppt"))
{
  IMasterSlideHeaderFooterManager headerFooterManager = presentation.Masters[0].HeaderFooterManager;
  headerFooterManager.SetFooterAndChildFootersVisibility(true); // Method SetFooterAndChildFootersVisibility is used for making a master slide and all child footer placeholders visible.
  headerFooterManager.SetSlideNumberAndChildSlideNumbersVisibility(true); // Method SetSlideNumberAndChildSlideNumbersVisibility is used for making a master slide and all child page number placeholders visible.
  headerFooterManager.SetDateTimeAndChildDateTimesVisibility(true); // Method SetDateTimeAndChildDateTimesVisibility is used for making a master slide and all child date-time placeholders visible.
  headerFooterManager.SetFooterAndChildFootersText("Footer text"); // Method SetFooterAndChildFootersText is used for setting text to master slide and all child footer placeholders.
  headerFooterManager.SetDateTimeAndChildDateTimesText("Date and time text"); // Method SetDateTimeAndChildDateTimesText is used for setting text to master slide and all child date-time placeholders.
}

Id property has been added to ISvgShape

Id property has been added to ISvgShape to support custom IDs of shapes in generated SVG. Below is the example of custom SVG Shape formatting controller to set custom shape IDs:

class CustomSvgShapeFormattingController : ISvgShapeFormattingController
{
  private int m_shapeIndex;
  
  public CustomSvgShapeFormattingController(int shapeStartIndex = 0)
  {
    m_shapeIndex = shapeStartIndex;
  }

  public void FormatShape(ISvgShape svgShape, IShape shape)
  {
    svgShape.Id = string.Format("shape-{0}", m_shapeIndex++);
  }
}

New EmbedAllFontsHtmlController has been added

A new HTML Controller has been added: EmbedAllFontsHtmlController. It is used to embed all presentation fonts in HTML document. Here’s an example of using this new controller:

using (Presentation pres = new Presentation("pres.pptx"))
{
  // exclude default presentation fonts
  string[] fontNameExcludeList = { "Calibri", "Arial" };

  EmbedAllFontsHtmlController embedFontsController = new EmbedAllFontsHtmlController(fontNameExcludeList);

  HtmlOptions htmlOptionsEmbed = new HtmlOptions
  {
    HtmlFormatter = HtmlFormatter.CreateCustomFormatter(embedFontsController)
  };
  pres.Save("pres.html", SaveFormat.Html, htmlOptionsEmbed);
}

Please note that EmbedAllFontsHtmlController has parameterized constructor where an array of font names can be passed to prevent them from embedding. Some fonts, like Calibri or Arial, used in presentation are not needed to be embedded (which leads the resulting HTML document become larger) because almost every system already has them installed.

Another major feature of EmbedAllFontsHtmlController is that it supports inheritance and WriteFont method is intended to be overridden:

public virtual void WriteFont(
    IHtmlGenerator generator,
    IFontData originalFont,
    IFontData substitutedFont,
    string fontStyle,
    string fontWeight,
    byte[] fontData)
  {
    // todo: serialize font as you need
  }

By default, font embedded or serialized in HTML document as bas64 string. But for example, you may create your own controller to dump files somewhere in your own file structure. Below is a sample implementation of LinkAllFontsHtmlController controller intended to write font files on disk and just add link for it in @font-face:

class LinkAllFontsHtmlController : EmbedAllFontsHtmlController
{
  private readonly string m_basePath;

  public LinkAllFontsHtmlController(string[] fontNameExcludeList, string basePath)
      : base(fontNameExcludeList)

  {
    m_basePath = basePath;
  }

  public override void WriteFont(
      IHtmlGenerator generator,
      IFontData originalFont,
      IFontData substitutedFont,
	  string fontStyle,
	  string fontWeight,
	  byte[] fontData)
  {
    string fontName = substitutedFont == null ? originalFont.FontName : substitutedFont.FontName;
    string path = string.Format("{0}.woff", fontName); // some path sanitaze may be needed
    File.WriteAllBytes(Path.Combine(m_basePath, path), fontData);

    generator.AddHtml("<style>");
    generator.AddHtml("@font-face { ");
    generator.AddHtml(string.Format("font-family: '{0}'; ", fontName));
    generator.AddHtml(string.Format("src: url('{0}')", path));
    generator.AddHtml(" }");
    generator.AddHtml("</style>");
  }
}