Dear team ,
What is the difference between getRawSpaceWithin and the getSpaceWithin api methods in the paragraph class. Please educate.
Regards
J.Karthik
Dear team,
The link was useful .
One more question , Is there any method to obtain the line spacing in points (even if it has been set by the user in lines) . If not , is it possible to convert the line spacing value in lines to points.
If there is no such method , can you provide insights on how it can be done .
Regards
J.Karthik
Dear team,
Am stuck at a point , unable to convert the linespacing value in lines to points , can some one please help me in the process as i have requested in my previous post.
Thanks for all your help.
Regards
J.Karthik
Dear J.Karthik,
For line-spacing use the Paragraph.get/setSpaceWithin property.
See the demo code below which reads the source presentation and set the linespacing and write the output presentation.
Source and output presentations are also attached.
CODE:
// Source presentation
Presentation srcPres = new Presentation(new FileInputStream(
"C:\\source\\source.ppt"));
// Source slide
Slide srcSld = srcPres.getSlideByPosition(1);
//Access first textframe
Shape shp = srcSld.getShapes().get(0);
//Set linespacing
TextFrame tf = shp.getTextFrame();
tf.getParagraphs().get(0).setSpaceWithin( (short)200);
tf.getParagraphs().get(1).setSpaceWithin( (short)200);
tf.getParagraphs().get(2).setSpaceWithin( (short)200);
//Write the presentation on disk
srcPres.write(new FileOutputStream("c:\\output.ppt"));
Sorry, I did not answer your question correctly.
1 line=100 points
So, if you want to set 1.76 for line spacing, you will use 176