Dear setuaagrawal,
For your ease of understanding, I have written a JAVA code, which adds a logo and textframe with bullets.
It is easy to understand, as I have commented everyline and you should not have difficulty understanding it.
I have also attached the code and the presentation generated by this code namely outAddingLogoAndBulletedText.ppt so that you can view it.
Hopefully, it will be helpful for you.
JAVA CODE:
-----------------------------------------------------------------------------------------------------------------------------------
static void AddingLogoAndBulletedText() throws Exception
{
//Create a presentation from scratch
Presentation pres =
new Presentation();
//Get the empty slide added by default
Slide sld = pres.getSlideByPosition(1);
//Add a company logo
//First add a logo picture inside presentation
FileInputStream logoStream=
new FileInputStream("c:/logo.bmp");
com.aspose.slides.Picture pic =
new com.aspose.slides.Picture(pres, logoStream);
int logoPicId = pres.getPictures().add(pic);
//Now add a picture to top left corner
//You need to pass it proper X, Y, Width and Height
int logoX = 100;
int logoY = 100;
int logoWidth = 2000;
int logoHeight = 500;
//To add picture, you need to add PictureFrame
//Pass it picture id, x, y, width and height
PictureFrame pf = sld.getShapes().addPictureFrame(logoPicId, logoX, logoY, logoWidth, logoHeight);
//We have finished adding picture, now add a TextFrame, with bullet paragraphs.
com.aspose.slides.Rectangle rect = sld.getShapes().addRectangle(200, 1200, 3000, 1);
//hide rectangle's lines
rect.getLineFormat().setShowLines(
false);
//Add TextFrame inside
TextFrame tf = rect.addTextFrame(
"");
//Make the TextFrame wrap text if it exceeds its width
tf.setWrapText(
true);
//Make the TextFrame expand rectangle shape, if text exceeds width
tf.setFitShapeToText(
true);
//Add text inside TextFrame.
//Note, first paragraph and its portion is added by default
Paragraph para = tf.getParagraphs().get(0);
//Set first paragraph text
para.getPortions().get(0).setText(
"This is the first portion of the first bulleted paragraph.");
//Make the paragraph bulleted
para.setHasBullet((
short)1);
para.setBulletType(BulletType.
SYMBOL);
para.setBulletCharacter((
char)8226);
//Make some space
para.setBulletOffset((
short)0);
para.setTextOffset((
short)150);
//To add more paragraphs, make copy of the above paragraph and then add
Paragraph newPara =
new Paragraph(para);
newPara.getPortions().get(0).setText(
"This is the first portion of the second bulleted paragraph");
tf.getParagraphs().add(newPara);
//Write presentation on disk
FileOutputStream fout=
new FileOutputStream("c:/outAddingLogoAndBulletedText.ppt");
pres.write(fout);
}
Many Thanks and Kind Regards,
Shakeel Faiz
Support Engineer
Aspose Tyumen Team