Portion.setFontHeight() Is Very Inconsistent and Erratically Changes the Font Size

Hello, I am using Aspose Slides in Java. I’ve written the below function to convert all non-table elements of the input pptx file to a given font size. However, when I view the output file, the font size has been changed but it’s often erratic. If I set FONT_SIZE to 10, some of the text is size 9.7, some is 11, some is 8, etc. To be clear, it HAS been changed, but not to the target font height. How can I resolve this and make the font height consistent? Thank you. Code:

public ISlide[] changeFontSize(ISlide[] slides) {
        for(ISlide slide: slides) {
            IShapeCollection slideContents = slide.getShapes();
            for(int i = 0; i < slideContents.size(); i++) {
                int port = 0;
                while(!((Object)slide.getShapes().get_Item(port).getClass().getSimpleName()).toString().equals("AutoShape")) {
                    port++;
                }
                if(((Object)slideContents.get_Item(port).getClass().getSimpleName()).toString().equals("AutoShape")) {
                    ITextFrame tf = ((IAutoShape) slideContents.get_Item(port)).getTextFrame();
                    IParagraphCollection textFrameContents = tf.getParagraphs();
                    for (int j = 0; j < textFrameContents.getCount(); j++) {
                        IParagraph pg = textFrameContents.get_Item(j);
                        IPortionCollection paragraphContents = pg.getPortions();
                        for (int k = 0; k < paragraphContents.getCount(); k++) {
                            IPortion portion = paragraphContents.get_Item(k);
                            portion.getPortionFormat().setFontHeight(FONT_SIZE);
                        }
                    }
                }

            }
        }
        return slides;
    }

@neelkri,
Thank you for contacting support.

We need more details to investigate the case and help you. Please share the following files and information:

  • original presentation file
  • output presentation file
  • screenshots of the problem
  • Aspose.Slides version you used

You can zip the files and upload an archive here.