Free Support Forum - aspose.com

Create HTML slides

I am trying to create html slides, and it works ok. However, when I have a html text that looks like this:


This is header 1

This is header 2


I see no difference between h1 and h2. Are header tags not supported?

Also, there is an “empty line” at the beginning.

The text.

h1

h2

h3

h4

h5
h6

translates into what you see in the image. It looks like the line-height gets bigger the “smaller” the heading gets … what’s wrong here?

Hi Dominik,


I have observed your comments. I like to share that Aspose.Slides only provide support html text to import in text frame other then that is not possible in Aspose.Slides.

Best Regards,

I don’t think you understood what I wrote. Of course I am using a text frame, otherwise, it wouldn’t work at all. I was following this example:

http://www.aspose.com/docs/display/slidesjava/5.3.5.10+Importing+and+Exporting+HTML+Text+in+PPTX

I am creating a textFrame and then call addFromHtml:
shape.getTextFrame().getParagraphs().addFromHtml(content)

And it works (mostly), except for headings, as the picture clearly shows. Can you tell me why?

Hi Dominik,

I have observed your comments and request you to please share the working sample code along with source presentation, source html, generated presentation and desired output presentation. I will investigate the issue further on my end based on shared information to help you out.

Many Thanks,

.) There is no source presentation

.) There is no source html
.) I was using the code from the example link I showed above. I made the background red (because white-on-white is not very readable) and instead of reading the html from a file, I hardcoded it.
.) I attached the result pptx

//Create Empty presentation instance//Create Empty presentation instance
Presentation pres = new Presentation();

//Acesss the default first slide of presentation
ISlide slide = pres.getSlides().get_Item(0);

//Adding the AutoShape to accomodate the HTML content
IAutoShape ashape = slide.getShapes().addAutoShape(ShapeType.Rectangle, 0, 0, (float) pres.getSlideSize().getSize().getWidth(), (float) pres.getSlideSize().getSize().getHeight());

ashape.getFillFormat().setFillType(FillType.Solid);
ashape.getFillFormat().getSolidFillColor().setColor(Color.RED)

//Adding text frame to the shape
ashape.addTextFrame(" ");

//Clearing all paragraphs in added text frame
ashape.getTextFrame().getParagraphs().clear();

String content= “

h1


h2


h3


h4


h5

h6

//Adding text from HTML stream reader in text frame
ashape.getTextFrame().getParagraphs().addFromHtml(content);

pres.save(filename, SaveFormat.Pptx)


Hi Dominik,


I have used the sample code shared by you and you are right that heading tags are skipped when importing HTML text inside presentation. A ticket with ID SLIDESJAVA-35715 has been added in our issue tracking system to investigate and resolve the issue. This thread has been associated with the ticket so that we may share the notification with you once issue will be fixed.

We are sorry for your inconvenience,