Free Support Forum - aspose.com

How do you create picture bullets need Java example

I've found the following code for Picture Bullets but need the Java version can someone post it please.

void PictureBullet()

{

Presentation srcPres = new Presentation();

Slide sld = srcPres.GetSlideByPosition(1);

PictureBullet picBullet=new PictureBullet(srcPres, @"c:\bullet.jpg");

int picBulletId = srcPres.PictureBullets.Add(picBullet);

Shape shp = sld.Shapes.AddRectangle(500, 500, 3000, 1);

shp.AddTextFrame("");

shp.LineFormat.ShowLines=false;

TextFrame tf = shp.TextFrame;

tf.WrapText = true;

tf.FitShapeToText = true;

Paragraph para = new Paragraph();

para.Text = "Some text";

para.HasBullet = 1;

para.BulletType = BulletType.Picture;

para.PictureBulletId = (short)picBulletId;

tf.Paragraphs.Clear();

tf.Paragraphs.Add(new Paragraph(para));

tf.Paragraphs.Add(new Paragraph(para));

tf.Paragraphs.Add(new Paragraph(para));

srcPres.Write(@"c:\out.ppt");

}

cheers

harry

Here is the same code in

JAVA

--------------------------------------------------------------------

public static void PictureBullet() throws Exception

{

Presentation srcPres=new Presentation();

Slide sld=srcPres.getSlideByPosition(1);

PictureBullet picBullet=new PictureBullet(srcPres, new FileInputStream("c:\\bullet.jpg"));

int picBulletId = srcPres.getPictureBullets().add(picBullet);

com.aspose.slides.Shape shp = sld.getShapes().addRectangle(500, 500, 3000, 1);

shp.addTextFrame("");

shp.getLineFormat().setShowLines(false);

TextFrame tf = shp.getTextFrame();

tf.setWrapText (true);

tf.setFitShapeToText(true);

Paragraph para = new Paragraph();

para.setText("Some text");

para.setHasBullet((short)1);

para.setBulletType(BulletType.PICTURE);

para.setPictureBulletId((short)picBulletId);

tf.getParagraphs().clear();

tf.getParagraphs().add(new Paragraph(para));

tf.getParagraphs().add(new Paragraph(para));

tf.getParagraphs().add(new Paragraph(para));

srcPres.write(new FileOutputStream("c:/out.ppt"));

}