Hi Andrey, I am locking the watermark shape after changing paraph and it is not applying line space.Could you please check the below code and help me on this.
Presentation pres = new Presentation("C:\\Users\\ssanex\\Downloads\\EclipseWorkSpace\\EclipseWorkSpace\\ORIGINAL-test.pptx");
try {
/*
* com.aspose.slides.License license = new com.aspose.slides.License();
*
* license.setLicense(new java.io.FileInputStream("Aspose.Slides.Java.lic"));
*/
License license1 = new License();
license1.setLicense(new java.io.FileInputStream("C:\\Users\\ssanex\\Downloads\\aspose-slides-22.7-java\\lib\\Aspose.Slides.Java.lic"));
if (license1.isLicensed())
{
System.out.println("License is Set!");
}
// Access master
IMasterSlide master = pres.getMasters().get_Item(0);
Point2D.Float center = new Point2D.Float((float) pres.getSlideSize().getSize().getWidth() / 2,
(float) pres.getSlideSize().getSize().getHeight() / 2);
float width = 300;
float height = 150;
float x = (float) center.getX() - width / 2;
float y = (float) center.getY() - height / 2;
// Add shape
IAutoShape watermarkShape = master.getShapes().addAutoShape(ShapeType.Rectangle, x, y, width, height);
// Set fill type
watermarkShape.getFillFormat().setFillType(FillType.NoFill);
watermarkShape.getLineFormat().getFillFormat().setFillType(FillType.NoFill);
// Set rotation angle
watermarkShape.setRotation(-45);
// Set text
//ITextFrame watermarkTextFrame = watermarkShape.addTextFrame("watermark3");
//ITextFrame watermarkTextFrame = watermarkShape.addTextFrame("Text line 1\nText line 2\nCourtesy of Sravanreddy");
//watermarkShape.addTextFrame("watermark2");
ITextFrame watermarkTextFrame = watermarkShape.addTextFrame("");
Paragraph textLine1 = new Paragraph();
textLine1.setText("watermark Text line 1");
textLine1.getParagraphFormat().setDepth((short)2);
textLine1.getParagraphFormat().setSpaceWithin(5);
textLine1.getParagraphFormat().setIndent(2);
Paragraph textLine2 = new Paragraph();
textLine2.setText("watermark Text line 2");
textLine2.getParagraphFormat().setDepth((short)2);
textLine1.getParagraphFormat().setSpaceWithin(5);
textLine2.getParagraphFormat().setIndent(2);
Paragraph textLine3 = new Paragraph();
textLine3.setText("Courtesy of Sravanreddy");
IParagraph paragraph = watermarkTextFrame.getParagraphs().get_Item(0);
watermarkTextFrame.getParagraphs().add(textLine1);
textLine1.getParagraphFormat().setSpaceWithin(10);
watermarkTextFrame.getParagraphs().add(new Paragraph());
watermarkTextFrame.getParagraphs().add(textLine2);
textLine2.getParagraphFormat().setSpaceWithin(10);
watermarkTextFrame.getParagraphs().add(new Paragraph());
watermarkTextFrame.getParagraphs().add(textLine3);
textLine3.getParagraphFormat().setSpaceWithin(10);
// Set font and color
IPortion watermarkPortion = watermarkTextFrame.getParagraphs().get_Item(0).getPortions().get_Item(0);
watermarkPortion.getPortionFormat().setFontHeight(52);
int alpha = 150, red = 200, green = 200, blue = 200;
watermarkPortion.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
watermarkPortion.getPortionFormat().getFillFormat().getSolidFillColor()
.setColor(new Color(red, green, blue, alpha));
// Lock Shapes from modifying
watermarkShape.getAutoShapeLock().setSelectLocked(true);
watermarkShape.getAutoShapeLock().setSizeLocked(true);
watermarkShape.getAutoShapeLock().setTextLocked(true);
watermarkShape.getAutoShapeLock().setPositionLocked(true);
watermarkShape.getAutoShapeLock().setGroupingLocked(true);
// Save the presentation
pres.save("C:\\Users\\ssanex\\Downloads\\EclipseWorkSpace\\EclipseWorkSpace\\watermarked-presentation_latest123.pptx", SaveFormat.Pptx);
Date end = new Date();
System.out.println("end "+sdf.format(end));
} finally {
if (pres != null)
pres.dispose();
}