Adding numbered bulleted paragraphs

Below is the code in JAVA that illustrates, how to add numbered bulleted paragraphs inside a textframe. The output presentation of this code is also attached with this post.

JAVA CODE

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

Presentation pres=new Presentation();

Slide sld=pres.getSlideByPosition(1);

//Add a textframe

com.aspose.slides.Rectangle rect = sld.getShapes().addRectangle(300, 300, 3000, 1);

rect.getLineFormat().setShowLines(false);

//Add a text frame

TextFrame tf = rect.addTextFrame("");

//Make it expand shape if needed

tf.setFitShapeToText(true);

//Make it wrap text if it exceeds width

tf.setWrapText (true);

//Access first paragraph which is added by default

Paragraph para = tf.getParagraphs().get(0);

para.setText("This is first paragraph.");

//Make it numbered bullet

para.setHasBullet((short)1); //make it boolean

para.setBulletType(BulletType.NUMBERED);

para.setNumberedBulletStartWith((short)1);

//Add second paragraph, make it the copy of first

Paragraph newPara = new Paragraph(para);

newPara.setText( "This is second paragraph.");

//Add it in paragraphs

tf.getParagraphs().add(newPara);

//Add third one in a same way

newPara = new Paragraph(para);

newPara.setText("This is third paragraph.");

tf.getParagraphs().add(newPara);

//write presentation on disk.

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

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

And here is equivalent C# code.

C# CODE

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

//Add a textframe

Aspose.Slides.Rectangle rect = sld.Shapes.AddRectangle(300, 300, 3000, 1);

rect.LineFormat.ShowLines = false;

//Add a text frame

TextFrame tf = rect.AddTextFrame("");

//Make it expand shape if needed

tf.FitShapeToText = true;

//Make it wrap text if it exceeds width

tf.WrapText = true;

//Access first paragraph which is added by default

Paragraph para = tf.Paragraphs[0];

para.Text = "This is first paragraph.";

//Make it numbered bullet

para.HasBullet = 1; //make it boolean

para.BulletType = BulletType.Numbered;

para.NumberedBulletStartWith = 1;

//Add second paragraph, make it the copy of first

Paragraph newPara = new Paragraph(para);

newPara.Text = "This is second paragraph.";

//Add it in paragraphs

tf.Paragraphs.Add(newPara);

//Add third one in a same way

newPara = new Paragraph(para);

newPara.Text = "This is third paragraph.";

tf.Paragraphs.Add(newPara);

//write presentation on disk.

pres.Write("c:\\outNumberedBullets.ppt");

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

I am attempting to add formatted notes to slide but so far nothing has worked. Following code does not generate bulleted list for notes or for slide. What am i missing?

Presentation p = new Presentation();
s = p.AddEmptySlide();
n = s.AddNotes();

para = new Paragraph();
para.HasBullet = 0;
para.BulletType = BulletType.Numbered;
para.NumberedBulletStartWith =1;
para.BulletCharacter = ‘v’;

Portion bold = new Portion(“one”);
bold.FontBold = true;

Paragraph para1 = new Paragraph(para);

Portion italics = new Portion(“one”);
italics.FontBold = true;



italics.FontItalic = true;
para.Portions.Add(bold);
para1.Portions.Add(italics);

Rectangle r = s.Shapes.AddRectangle(300,300,3000,1);

TextFrame tf = r.AddTextFrame("");
tf.Paragraphs.Add(para);
tf.Paragraphs.Add(para1);

You should modify your code like this

para = new Paragraph();

para.HasBullet = true;

para.BulletType = BulletType.Numbered;

para.NumberedBulletStartWith = 1;

//para.BulletCharacter = 'v';