I used Aspose.Slides.NET version 23.1.0 to convert a PPTX file to PPT. However, the visual appearance of the output file changed, with a noticeable increase in font size.
Input/Output file:
input_output_files.zip (1.1 MB)
Code:
LoadOptions loadOptions = new LoadOptions
{
ResourceLoadingCallback = new ExternalResourceLoadingHandler()
};
using(var presentation = new Presentation(inFile, loadOptions))
{
presentation.Save(outFile, SaveFormat.Ppt);
}
Different visual:
{90D9FC33-62D0-4F6B-BF16-D6447928B690}.jpg (200.4 KB)
Please help me investigate it. Thank you.
@dunghnguyen
Cause
The issue you’re experiencing with the font size changing during the conversion from PPTX to PPT is likely due to differences in how fonts are handled between the two formats. PPTX files often support more advanced font features and styles that may not translate directly into the older PPT format.
Solution
To address this, you can try the following steps:
-
Check Font Availability: Ensure that the fonts used in the PPTX file are available on the system where the conversion is taking place. If the font is not available, Aspose.Slides may substitute it with a different font, leading to size discrepancies.
-
Use Font Management: Utilize the IFontsManager
interface to manage font substitutions and ensure that the correct fonts are being used during the conversion. This can help maintain the intended appearance of the text.
-
Adjust Font Size Manually: After loading the presentation, you can iterate through the text frames and adjust the font sizes programmatically to match your expectations.
Code
Here’s a code snippet that demonstrates how to adjust font sizes after loading the presentation:
using Aspose.Slides;
using Aspose.Slides.Export;
LoadOptions loadOptions = new LoadOptions
{
ResourceLoadingCallback = new ExternalResourceLoadingHandler()
};
using (var presentation = new Presentation(inFile, loadOptions))
{
// Iterate through slides
foreach (ISlide slide in presentation.Slides)
{
// Iterate through shapes
foreach (IShape shape in slide.Shapes)
{
if (shape is IAutoShape autoShape && autoShape.TextFrame != null)
{
foreach (IParagraph paragraph in autoShape.TextFrame.Paragraphs)
{
foreach (IPortion portion in paragraph.Portions)
{
// Adjust font size as needed
portion.FontHeight = 20; // Set to your desired size
}
}
}
}
}
presentation.Save(outFile, SaveFormat.Ppt);
}
Next Steps
- Test the above code to see if it resolves the font size issue.
- If the problem persists, check for any specific font settings in the original PPTX file that may not be supported in PPT.
- If you continue to experience issues, reach out to Aspose support with the specific PPTX file for further assistance.
Please let me know if you need any further help!
@dunghnguyen,
Thanks for the sample files and screenshot.
I tested your scenario using the sample code along with your template PowerPoint presentation PPTX file, utilizing the latest version of Aspose.Slides for .NET 25.7 (Releases | NuGet). The process worked seamlessly, and the output PPT file was successfully fine-tuned.
Presentation document = new Aspose.Slides.Presentation("e:\\test2\\input.pptx");
document.Save("e:\\test2\\output1.ppt", Aspose.Slides.Export.SaveFormat.Ppt);
Please find attached the output PPT file for your reference.
output1.zip (523.7 KB)
Kindly try using Aspose.Slides for .NET 25.7. If the issue persists, please share your sample runnable code that reproduces the output PPT with increased font size. We will review it soon.
1 Like