Free Support Forum - aspose.com

Need a Simple "How to"

Beginner question here. Looking at the demos I’ve figured out how to add slides to the presentation. I’m having problems populating the text in the slides.

Say I have 3 slides {A, B, and C} ; Say each slide has 3 bullets {A1, A2, A3}

How do I set the slide text to be:
Slide Title: A

  • Bullet A1
  • Bullet A2
  • Bullet A3
Slide Title: B … and so forth.

I’m getting confused by the Placeholders and Textholders objects. Anyone have a cookbook answer?

Looking for a cook book recepie to

1. New slide

2. Add bullet

3. Add bullet

4. Add bullet

I would like to programatically do this as naturally as powerpoint.

This is exactly my question. Can someone give an example how to create a slide with a heading and a few bullet points (like this below)?

HEADING

  • item 1
  • item 2
  • item 3

Dear lajolla,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please see the attached output presentation which is generated by the following code.

This is the .NET code that creates a slide with a heading and a few bullet points.

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

Presentation pres = new Presentation();

Slide bodySlide = pres.AddBodySlide();

Paragraph para = ((TextHolder)bodySlide.Placeholders[0]).Paragraphs[0];

para.Alignment = TextAlignment.Left;

para.Text = "Heading";

TextHolder th = (TextHolder)bodySlide.Placeholders[1];

para = th.Paragraphs[0];

para.Alignment = TextAlignment.Left;

para.HasBullet = 1;

para.BulletColor = Color.Blue;

para.BulletHeight = 125; // bullet height

//para.Portions[0].FontUnderline = true;

para.Portions[0].Text = "Item 1";

//Add second item

Paragraph newPara = new Paragraph(para);

newPara.Portions[0].Text = "Item 2";

th.Paragraphs.Add(newPara);

//Add third item

newPara = new Paragraph(para);

newPara.Portions[0].Text = "Item 3";

th.Paragraphs.Add(newPara);

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

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

This is the .JAVA code that creates a slide with a heading and a few bullet points.

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

Presentation pres=new Presentation();

Slide bodySlide=pres.addBodySlide();

Paragraph para=((TextHolder)bodySlide.getPlaceholders().get(0)).getParagraphs().get(0);

para.setAlignment(TextAlignment.LEFT);

para.setText("Heading");

TextHolder th=(TextHolder)bodySlide.getPlaceholders().get(1);

para=th.getParagraphs().get(0);

para.setAlignment(TextAlignment.LEFT);

para.setHasBullet((short)1);

para.setBulletColor(Color.BLUE);

//para.getPortions().get(0).setFontUnderline(true);

para.getPortions().get(0).setText("Item 1");

//Add second item

Paragraph newPara=new Paragraph(para);

newPara.getPortions().get(0).setText("Item 2");

th.getParagraphs().add(newPara);

//Add third item

newPara=new Paragraph(para);

newPara.getPortions().get(0).setText("Item 3");

th.getParagraphs().add(newPara);

//Write Presentaiton

pres.write(new FileOutputStream("c:\\out.ppt"));