Aspose.Slides for Java feature/help request

Dear nuller,

For null question, try this code

Shape shp=mainmaster.getShapes().get(index);

if(shp.isTextHolder()==true)

{

TextFrame tf=shp.getTextFrame();

}

To set footer text, use this code

TextFrame tf=mainmaster.getShapes().get(3).getTextFrame();

Portion port=tf.getParagraphs().get(0).getPortions().get(0);

Portion newPort=new Portion(port);

tf.getParagraphs().get(0).getPortions().add(newPort);

newPort.setText("footer text");

For animations, please see these animation features are available in MS-PowerPoint 2000 animations.

thanks faiz

msfaiz:




TextFrame tf=mainmaster.getShapes().get(3).getTextFrame();



the code line uses “3” in "mainmaster.getShapes().get(3).getTextFrame()"

is there any way to find a placeholder using PlaceHolderType like MASTER_BODY
and get its textframe

msfaiz:


For animations, please see these animation features are available in MS-PowerPoint 2000 animations.



I dont have Office 2000 but i do have Office XP so i dont know Office 2000 has “Start” option for shape animation or not



For normal slides, you can get it via Placeholder.getPlaceholderType()

However, for master slides, you will have to get them via textframe and check what the text contains e.g

"Click to edit Master title style" means title placeholder

"Click to edit Master text styles\rSecond level\rThird level\rFourth level\rFifth level" means subtitle placeholder

You can also set the alternative text of these placeholders on master slides manually and then access them in your code using

Slide.findShape() or MainMaster.findShape() method.

Can you please attach some ppt with all these animation features, so I could check them on MS-PowerPoint 2000?

thanks faiz,

I have used findShapes() and it works.
For animation, I hope aspose will add more animation features from new Office Version like XP.

I have cloned a title slide from aother presentation
that cloned title master and slide master as well.

If getMasterId() of the new cloned slide returns Slide Master id
How do I get Id of the Title Master or vice versa?

The following checks whether master of the slide is Slide Master or Title Master.

Slide Master is always the instance of MainMaster class.

While, Title Master is just an instance of Slide class.

MainMaster slideMaster=null;

Slide titleMaster=pres.getSlideById(sld.getMasterId());

if(titleMaster instanceof MainMaster)

{

slideMaster=(MainMaster)titleMaster;

}

thanks faiz

Shape s = cloned_slide_master.findShape("BulletBody");

TextFrame t = s.getTextframe();

t.setText("Sample Text");

After writing this sample text the ppt cant be open
powerpoint shows a error message as some part of the file is missing

Hi,

I have cloned a title slide from another presentation
the master of the slide is also cloned

It has a placeholder with alternatetext "Slide Title"
I can able to findShape() it but if i get it’s textframe
and write some text to it the text wont come in
when i open the slide in powerpoint

if i add the title slide using addTitleSlide() of Presentation
then i can able to get the “Slide Title” placeholder
and the text written to it using Textframe comes in powerpoint

i need to add my own title slide from my own template
and also have the text that i written to the placeholders
us well

how do i go about that ?

thanks in advance

I have used Powerpoint XP to create that template ppt, is that a problem ?

I think in a summary if i cloned a slide OR master
the textbox(s) on that slide/master makes problem
if we write text to it …

I hope this post may help you…


Dear nuller,

Cloning any slide which follows TITLE MASTER will also copy the SLIDE MASTER besides TITLE MASTER.

Since your text is present on TITLE MASTER, so it will appear only for those slides which follow TITLE MASTER in other words for title slides. For example, the one you added with Presentation.addTitleSlide.

So, it is a correct behavior.

Editing slides in PP 2007 converts the textholders (a kind of placeholder which contains text) into textframes.

https://forum.aspose.com/t/103860

msfaiz:


Cloning any slide which follows TITLE MASTER will also copy the SLIDE MASTER besides TITLE MASTER.

Since your text is present on TITLE MASTER, so it will appear only for those slides which follow TITLE MASTER in other words for title slides. For example, the one you added with Presentation.addTitleSlide.

So, it is a correct behavior.



thanks faiz, if i clone the "title slide" (slide not master) from my own template
both masters(slide and title) are also cloned automatically
the title slide that i cloned has a placeholder (it has two for title and subtitle)
if i add any text to the any of the placeholder using textframe
and save the ppt
powerpoint doesnt show the text which i written to it
it shows text like "click here to add title"

i have attached the templatefile that used to clone from.

msfaiz:

Editing slides in PP 2007 converts the textholders (a kind of placeholder which contains text) into textframes.

https://forum.aspose.com/t/103860



thanks for the information but is this associated with my problem ?


Placeholders on master slides just tell the formatting and style of text, they are not meant to show text on the normal slides that follow them. If you want some text on the master slide, to appear on normal slide, just add a text frame, like I have added in the attached ppt.

faiz, i am not trying to add text to master
i am adding text to title slide (slide not master)
(checkout my previous post)

PS:
(if my posts are not clear please let me know
i will try to make it more clear as possible
- English is not my first language)


Sorry for the confusion, I finally got your problem. The problem is because Slide Title placeholder is empty with no character/text. But if you add a single character inside it and then clone and try to set its text, no exception will occur.

To illustrate my point, I have attached the code, template presentation and the target presentation generated by the following code.

String strFile="c:\\master_template2.ppt";

Presentation templatePres=new Presentation(new FileInputStream(new File(strFile)));

Presentation targetPres=new Presentation();

Slide sld=templatePres.cloneSlide(templatePres.getSlideByPosition(1), 1, targetPres, new TreeMap());

Shape shp=sld.findShape("Slide Title");

TextHolder thld=(TextHolder)shp.getPlaceholder();

thld.getParagraphs().get(0).getPortions().get(0).setText("Some text set by me.");

targetPres.write(new FileOutputStream(new File("c:\\targetPres.ppt")));

thanks faiz,

I want to set Red as Text color to master title placeholder.
so all the title slides that based on that title master will
have the title text color us Red

If i do that by adding new Red text Portions to title master placeholder
The title slides that based on that Master lost its text.


Dear nuller,

The formatting of the text is saved in the Portion object, if you will set the text in these ways, it will be destroyed.

tf.setText

tf.getParagraphs().get(0).setText

So, to keep them safe, you should set the text in this way

tf.getParagraphs().get(0).getPortions().get(0).setText

The code I gave you earlier, works fine and does not loose the master color settings, please see the attached presentations.

thanks faiz, i will try this …

Hi Faiz,


When I try to set the text in a master slide, then the created ppt becomes corrupted. When we try to open the ppt in PowerPoint, it is throwing the error “A part of file is missing”.

If I try to set the portion props in the master slide, the ppt can be opened, but the portion properties are not taking effect in the title, subtitle, textbody placeholders.

The above works normally in a normal slide but not in a slidemaster or a title master. Please provide me a solution for setting the text, portion properties in a master slide.

Thanks,
Mani.


Dear Mani,

I have tried to understand the issue shared by you. But in order to reproduce the issue on my end I request you to please share the template presentation for reference. Please also share, which portion properties that you are trying to set and are not working. Please also share that which version of Aspose.Slides for Java you are using for your application.

Thanks and Regards,