We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Retrieving Paragraph’s Rect Value Throws KeyNotFoundException

Please browse the files in the compressed package.
MatheEuation.pptx.zip (31.4 KB)
First: When I want to get the first paragraph’s rect value, it throw KeyNotFoundException As shown in the figure below.
TextRect.jpg (231.6 KB)
Second: When I want to get MathPortion value, it throw ArgumentException As shown in the figure below.
MatheEuation.png (122.7 KB)
Could you please tell me to solve it?

os version: macOS 13.0.1
sdk: slides-java 22.11
jdk: openjdk 17.0.1

@oscarstar,
Thank you for contacting support.

I’ve added a ticket with ID SLIDESJAVA-38989 to our issue-tracking system. Our development team will investigate the case. We will inform you of ny progress.

@oscarstar,
Our developers were unable to reproduce the errors you encountered. Could you please share examples of compilable text code and full stack trace for these exceptions?

I think you can use any pptx file and any TextFrame to test the following code:

Presentation presentation = new Presentation(filePath);
((AutoShape)presentation.getSlides().get_Item(0).getShapes().get_Item(0)).getTextFrame().getParagraphs().get_Item(0).getRect();
class com.aspose.slides.exceptions.KeyNotFoundException: The given key was not present in the dictionary.
com.aspose.slides.Collections.Generic.SortedList$ThrowHelper.throwKeyNotFoundException(Unknown Source)
com.aspose.slides.Collections.Generic.SortedList.get_Item(Unknown Source)
com.aspose.slides.internal.o0.break.<init>(Unknown Source)
com.aspose.slides.internal.o0.long.goto(Unknown Source)
com.aspose.slides.internal.o0.long.case(Unknown Source)
com.aspose.slides.internal.o0.extends.do(Unknown Source)
com.aspose.slides.sd.do(Unknown Source)
com.aspose.slides.sd.do(Unknown Source)
com.aspose.slides.sd.do(Unknown Source)
com.aspose.slides.sd.do(Unknown Source)
com.aspose.slides.rr.do(Unknown Source)
com.aspose.slides.av2.do(Unknown Source)
com.aspose.slides.rr.do(Unknown Source)
com.aspose.slides.ol.do(Unknown Source)
com.aspose.slides.sj.do(Unknown Source)
com.aspose.slides.ax1.static(Unknown Source)
com.aspose.slides.z2.do(Unknown Source)
com.aspose.slides.axu.do(Unknown Source)
com.aspose.slides.axu.<init>(Unknown Source)
com.aspose.slides.axl.do(Unknown Source)
com.aspose.slides.axm.do(Unknown Source)
com.aspose.slides.axm.do(Unknown Source)
com.aspose.slides.ah5.do(Unknown Source)
com.aspose.slides.Paragraph.if(Unknown Source)
com.aspose.slides.Paragraph.getRect(Unknown Source)
com.nobook.ippt.core.AiPresentationImpl.init(AiPresentationImpl.java:168)
com.nobook.ippt.console.UploadFileProcess.process(UploadFileProcess.java:51)
com.nobook.ippt.console.UploadFileProcess.process(UploadFileProcess.java:18)
com.nobook.ippt.rabbitmq.MQAccessBuilder$2.consume(MQAccessBuilder.java:178)
com.nobook.ippt.rabbitmq.ThreadPoolConsumer.lambda$start$0(ThreadPoolConsumer.java:105)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
java.base/java.lang.Thread.run(Thread.java:833)

This error only appears in the current version(22.11).

If you use the pptx file in a compressed package and run the following code:

Presentation presentation = new Presentation(filePath);
MathPortion mathPortion = (MathPortion)((AutoShape)presentation.getSlides().get_Item(0).getShapes().get_Item(0)).getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0);
try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
    mathPortion.getMathParagraph().writeAsMathMl(stream);
    String formulaText = stream.toString();
} catch (Exception exception) {
    System.out.println(exception.getMessage());
}
class com.aspose.slides.exceptions.ArgumentException: '.', hexadecimal value 0x00, is an invalid character.
com.aspose.slides.ms.System.Xml.at.do(Unknown Source)
com.aspose.slides.ms.System.Xml.at.do(Unknown Source)
com.aspose.slides.ms.System.Xml.at.if(Unknown Source)
com.aspose.slides.ms.System.Xml.at.if(Unknown Source)
com.aspose.slides.ms.System.Xml.cv.do(Unknown Source)
com.aspose.slides.ms.System.Xml.cv.int(Unknown Source)
com.aspose.slides.ms.System.Xml.cv.if(Unknown Source)
com.aspose.slides.ms.System.Xml.cw.if(Unknown Source)
com.aspose.slides.ms.System.Xml.c5.if(Unknown Source)
com.aspose.slides.ms.System.Xml.da.int(Unknown Source)
com.aspose.slides.ad6.do(Unknown Source)
com.aspose.slides.ad6.do(Unknown Source)
com.aspose.slides.ad6.if(Unknown Source)
com.aspose.slides.ad6.do(Unknown Source)
com.aspose.slides.ad6.do(Unknown Source)
com.aspose.slides.ad5.do(Unknown Source)
com.aspose.slides.MathParagraph.do(Unknown Source)
com.aspose.slides.MathParagraph$1.do(Unknown Source)
com.aspose.slides.internal.oc.do.do(Unknown Source)
com.aspose.slides.internal.oc.if.do(Unknown Source)
com.aspose.slides.MathParagraph.writeAsMathMl(Unknown Source)
com.nobook.ippt.core.AiPortionImpl.<init>(AiPortionImpl.java:35)
com.nobook.ippt.core.AiParagraphImpl.<init>(AiParagraphImpl.java:35)
com.nobook.ippt.core.AiTextFrameImpl.<init>(AiTextFrameImpl.java:31)
com.nobook.ippt.core.AiAutoShapeImpl.<init>(AiAutoShapeImpl.java:133)
com.nobook.ippt.core.AiBaseSlideImpl.build(AiBaseSlideImpl.java:148)
com.nobook.ippt.core.AiBaseSlideImpl.build(AiBaseSlideImpl.java:92)
com.nobook.ippt.core.AiSlideImpl.build(AiSlideImpl.java:335)
com.nobook.ippt.core.AiLayoutSlideImpl.build(AiLayoutSlideImpl.java:60)
com.nobook.ippt.core.AiMasterSlideImpl.build(AiMasterSlideImpl.java:80)
com.nobook.ippt.core.AiPresentationImpl.init(AiPresentationImpl.java:201)
com.nobook.ippt.console.UploadFileProcess.process(UploadFileProcess.java:51)
com.nobook.ippt.console.UploadFileProcess.process(UploadFileProcess.java:18)
com.nobook.ippt.rabbitmq.MQAccessBuilder$2.consume(MQAccessBuilder.java:178)
com.nobook.ippt.rabbitmq.ThreadPoolConsumer.lambda$start$0(ThreadPoolConsumer.java:105)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
java.base/java.lang.Thread.run(Thread.java:833)

This error also occurred in previous versions like 22.10, 22.9.

@oscarstar,
Thank you for the additional information. I’ve forwarded it to our developers.

@oscarstar,
Our developers have investigated the cases.

Our developers have not managed to reproduce this issue, but after analysing the StackTrace they think they have found a possible cause of the issue. They created Aspose.Slides jar with a possible solution for this issue. Could you please check the issue with it?

Please browse the files in the compressed package.
snapshot.zip (3.8 MB)
I used local jar file from the download link. Unfortunately, the exception still occurs.

@oscarstar,
Thank you for the additional information. I’ve forwarded it to our developers.

@oscarstar,
Please try another fix:


Our developers cannot reproduce the issue yet. If the error persists, could you please share fonts (in zip) from the operating system and a sample project to reproduce the issue?

You guys are amazing! The new version works correctly.
Rect.jpg (393.8 KB)
The following items have also been fixed.
Getting the Height of a Table Cell Throws KeyNotFoundException
Table.jpg (330.1 KB)
Thank you very much for your patience and professionalism.

@oscarstar,
Thank you for your feedback! We are glad to know that the hotfix fixes these issues. The fix will be included in Aspose.Slides 22.12.