Free Support Forum - aspose.com

Is it possible to get letter spacing and line spacing from aspose

Hi,

Is it possible from aspose slide java to get two things from a presentation slide’s text placeholder :

  1. Letter spacing (character spacing)
  2. Line spacing (line height)

Thanks.

@saquibs

public static void TestTextProps()
 {
     Presentation pres = new Presentation("pres.pptx");
     
     int emuPerPoint = 12700;

     AutoShape shape = (AutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0);
     IParagraph para = shape.getTextFrame().getParagraphs().get_Item(0);
     float beforeText = para.getParagraphFormat().getMarginLeft();
     float beforeTextCm = beforeText * emuPerPoint / 360000; // cm

     IParagraph para2 = shape.getTextFrame().getParagraphs().get_Item(1);

     IPortion portion = para2.getPortions().get_Item(0);

     // "Paragraph Bullet Depth" spacing
     float spacing = portion.getPortionFormat().getSpacing(); 

     IParagraph para3 = shape.getTextFrame().getParagraphs().get_Item(2);
     IParagraph para4 = shape.getTextFrame().getParagraphs().get_Item(3);

     short noDepth = para.getParagraphFormat().getDepth(); // 0 [no depth]
     short noDepthAndBullet = para2.getParagraphFormat().getDepth();  // 0 [no depth and bullet]
     short depth1 = para3.getParagraphFormat().getDepth(); // 1 depth and bullet
     short depth2 = para4.getParagraphFormat().getDepth(); // 2 depth and bullet

     float spacingBefore = para4.getParagraphFormat().getSpaceBefore(); // spacing before
     float spacingAfter = para4.getParagraphFormat().getSpaceAfter(); // spacing after
 }

Please also check the attached image for your convenience and more clarity as well.

image001.png (12.2 KB)
image002.png (23.7 KB)
image003.png (15.5 KB)
image004.png (21.5 KB)
image005.png (32.9 KB)

pres.zip (21.7 KB)