ParagraphFormat.setMarginRight can not work on PPT

The slides 16.1.0 used, I want to set the setMarginRight of a paragraph, below code only can work on PPTX, but no effect on PPT.

Paragraph paraBack1 = new Paragraph();
paraBack1.setText("Backwards Indent");
paraBack1.getParagraphFormat().setAlignment(TextAlignment.Right);
paraBack1.getParagraphFormat().setMarginRight(80);
paraBack1.getParagraphFormat().setDepth((short) 1);
txtFrm.getParagraphs().add(paraBack1);
Paragraph paraBack2 = new Paragraph();
paraBack2.setText("Backwards Indent2");
paraBack2.getParagraphFormat().setAlignment(TextAlignment.Right);
paraBack2.getParagraphFormat().setMarginRight(160);
paraBack2.getParagraphFormat().setDepth((short) 2);
txtFrm.getParagraphs().add(paraBack2);

ParagraphFormat.setMarginLeft for Left alignment can work well both for PPTX and PPT.

Hi Rui,


I have observed your requirements and request you to please try using Aspose.Slides for Java 16.4.0 on your end. If the issue still persist then please provide working sample code along with source and generated presentation decks for comparison. I will add issue in our issue tracking system to get the issue resolved.

Best Regards,

Thanks for your response. I only have the license up to 16.1.0. So I use the 16.4.0 just for evaluation. Unfortunately, the 16.4.0 PPT format still cannot work for ParagraphFormat.setMarginRight.

Below is code I used and attached the presentation for your reference


//Create an instance of Presentation class
Presentation pres = new Presentation();

//Access the first slide
ISlide slide = pres.getSlides().get_Item(0);


AsposeSlideUtil.setMargin(slide);
//Save Presentation, ppt can not work
// pres.save(dataPath + “formatText.ppt”, SaveFormat.Ppt);
pres.save(dataPath + “formatText.pptx”, SaveFormat.Pptx);


AsposeSlideUtil.java
public static void setMargin(ISlide slide) {
// Adding and accessing Autoshape
IAutoShape aShp = slide.getShapes().addAutoShape(ShapeType.Rectangle, 200, 200, 400, 200);

// Accessing the text frame of created autoshape
ITextFrame txtFrm = aShp.getTextFrame();
txtFrm.getTextFrameFormat().setAutofitType(TextAutofitType.Shape);

// Removing the default exisiting paragraph
txtFrm.getParagraphs().clear();

Paragraph paraLeft1 = new Paragraph();
paraLeft1.setText(“Left Indent 1”);
paraLeft1.getParagraphFormat().setAlignment(TextAlignment.Left);
paraLeft1.getParagraphFormat().setDepth((short) 1);
paraLeft1.getParagraphFormat().setMarginLeft(40);
txtFrm.getParagraphs().add(paraLeft1);

Paragraph paraLeft2 = new Paragraph();
paraLeft2.setText(“Left Indent 2”);
paraLeft2.getParagraphFormat().setAlignment(TextAlignment.Left);
paraLeft2.getParagraphFormat().setDepth((short) 2);
paraLeft2.getParagraphFormat().setMarginRight(80);
txtFrm.getParagraphs().add(paraLeft2);

Paragraph paraRight1 = new Paragraph();
paraRight1.setText(“Right Indent 1”);
paraRight1.getParagraphFormat().setAlignment(TextAlignment.Right);
paraRight1.getParagraphFormat().setDepth((short) 1);
paraRight1.getParagraphFormat().setMarginRight(40);
txtFrm.getParagraphs().add(paraRight1);

Paragraph paraRight2 = new Paragraph();
paraRight2.setText(“Right Indent 2”);
paraRight2.getParagraphFormat().setAlignment(TextAlignment.Right);
paraRight2.getParagraphFormat().setDepth((short) 2);
paraRight2.getParagraphFormat().setMarginRight(80);
txtFrm.getParagraphs().add(paraRight2);
}

Hi Rui,


Thank you for sharing feedback and sample code. I am able to observe the difference in attached presentations and a ticket with ID SLIDESJAVA-35465 has been created in our issue tracking system for resolution. I have associated this thread with issue so that we notify you once the issue will be resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-35465) have been fixed in this update.