In some presentations that contain a large number of custom styles, the formatting breaks when converting the file to HTML or PNG.
I assume this issue is related to the new style handling features introduced in PowerPoint 2024, as these presentations also show similar rendering problems when opened in older PowerPoint versions (e.g., 2021).
Please find a ZIP archive with the .pptx
, .html
, and .png
files demonstrating this issue here:
https://drive.google.com/file/d/11NrWcF2oWHOdsVi-pWX-4LvcTbcjtS2d/view?usp=sharing
@sportworks.io
It seems you’re experiencing issues with custom styles breaking during the conversion of PowerPoint presentations to HTML or PNG formats, particularly with the new features introduced in PowerPoint 2024. This can occur when certain styles are not fully supported in the conversion process.
To address this, consider the following steps:
-
Update Aspose.Slides: Ensure you are using the latest version of Aspose.Slides, as updates often include fixes for rendering issues.
-
Check Style Compatibility: Review the custom styles used in your presentation. Some styles may not be compatible with the HTML or PNG formats. Simplifying or standardizing styles can help improve compatibility.
-
Use Alternative Formats: If the issue persists, consider converting the presentation to a different format first (like PDF) and then to HTML or PNG. This approach can sometimes preserve formatting better.
-
Code Example: Here’s a simple code snippet to convert a PowerPoint file to HTML using Aspose.Slides:
using Aspose.Slides;
using Aspose.Slides.Export;
// Load the presentation
using (Presentation presentation = new Presentation("input.pptx"))
{
// Save as HTML
presentation.Save("output.html", SaveFormat.Html);
}
-
Contact Support: If the problem continues, consider reaching out to Aspose support with your specific files for more tailored assistance.
For more information on supported formats and conversion options, please refer to the official Aspose documentation.
@sportworks.io,
Thank you for contacting free support. The point is that the font changes when converting the presentation file “Sample_broken_style.pptx” to PNG or HTML. You should install the Bebas Neue font used in the presentation on the operating system where the conversion is performed, or load the font at runtime with FontsLoader before the conversion, as shown below.
FontsLoader.loadExternalFonts(new String[]{"path_to_folder_with_the_font"});
More examples:
Custom PowerPoint Font in Java|Aspose.Slides Documentation
Please also note that you can check font substitutions as follows:
Presentation presentation = new Presentation("Sample_broken_style.pptx");
var fontSubstitutions = presentation.getFontsManager().getSubstitutions();
for (var fontSubstitution : fontSubstitutions) {
System.out.println("Warning: font substitution: " +
fontSubstitution.getOriginalFontName() + " -> " +
fontSubstitution.getSubstitutedFontName());
}
presentation.dispose();
Output:
Warning: font substitution: Bebas Neue -> Calibri