Automatic slide increment

Hi,

We are evaluating the Aspose.Slides for .Net product to use in one of our application and running into some issues. If you can throw some light on these items that would be great.

The objective is to export report(s) with gridview, images etc in to a PPTX presentation. Right now, we are looping through the gridview and writing row by row in a TableEx object and saving the presentation. The problems we are running in to are
  1. The generated table is very wide so that it crosses the white background of the slide and falls outside the visible area which is hidden when playing as slideshow. Is there a way to auto size the content to fit in to the slide’s default width?
  2. If there are several rows in the table, they do not span over to the next slide. Instead they are written on a single slide falling out of the white background. Is there a way to automatically add a new slide when the number of rows crosses the maximum limit? And also we would like to add the table header automatically on to the new slide.
  3. I came to know from one of the forum topic that headers/footers are not supported in MS PPT 2007. Can you point me to the sample code that helps add header/footer as rectangles and make it automatically appear on any new slides added in the presentation?
  4. Is there a way to feed the tool with the html stream of the webpage that needs to be converted and generate a PPTX presentation instead of adding slide by slide?
  5. Do you sell any product that converts the given PDF in to a PPTX presentation in a web application?
Attached is generated pptx file and below is the code we used

'Instantiate PresentationEx class that represents PPTX file
Dim pres As New PresentationEx()

'Access first slide
Dim sld As SlideEx = pres.Slides(0)

'Define columns with widths and rows with heights
Dim dblCols() As Double = {100, 500, 100, 250}
Dim dblRows() As Double = {50}

'Add table shape to slide
Dim idx As Integer = sld.Shapes.AddTable(10, 10, dblCols, dblRows)

Dim tbl As TableEx = CType(sld.Shapes(idx), TableEx)

'Create Header
For j As Integer = 0 To Grid.Columns.Count - 1
tbl.Rows(0).Item(j).TextFrame.Text = Grid.HeaderRow.Cells(j).Text.Replace(" “, “”)
tbl(j, 0).TextAnchorType = TextAnchorTypeEx.Center
Next j

'Add content rows
For k As Integer = 1 To Grid.Rows.Count
'Add new row to the table for every item in gridview
tbl.Rows.AddClone(tbl.Rows(0), True)
For l As Integer = 0 To Grid.Columns.Count - 1

Dim intCount As Integer = 0
If Integer.TryParse(Grid.Rows(k - 1).Cells(l).Text.Replace(” “, “”), intCount) Then
tbl.Rows(k).Item(l).AnchorCenter = True
End If
tbl(l, k).TextFrame.Text = Grid.Rows(k - 1).Cells(l).Text.Replace(” ", “”)
Next l
Next


Thanks

Hi Dear,

Thanks for your interest in Aspose.Slides.
I will share the response to your questions independently so that every question is properly answered.

indrajith:

Hi,

We are evaluating the Aspose.Slides for .Net product to use in one of our application and running into some issues. If you can throw some light on these items that would be great.

The objective is to export report(s) with gridview, images etc in to a PPTX presentation. Right now, we are looping through the gridview and writing row by row in a TableEx object and saving the presentation. The problems we are running in to are

  1. The generated table is very wide so that it crosses the white background of the slide and falls outside the visible area which is hidden when playing as slideshow. Is there a way to auto size the content to fit in to the slide’s default width?
  2. If there are several rows in the table, they do not span over to the next slide. Instead they are written on a single slide falling out of the white background. Is there a way to automatically add a new slide when the number of rows crosses the maximum limit? And also we would like to add the table header automatically on to the new slide.

I like to share that there is no automated way available to see if the height or width of the table has exceeded the slides height and width and therefore move extend the table to next slide.

However, the TableEx.Height and TableEx.Width properties hold the size of dynamic height and width of the table as it is content driven. You may also set the minimum height and width of the table by setting the minimum width and height of every single row. Hence, setting the minimum height and width for table indirectly. Please observe the code snippet shared here to see how to set the minimum height and width for row. But the point to note here is that the size of table is content driven. If the text exceeds the minimum row height or width then height and width of table will also get increased.

In the above scenario, I may suggest you a solution.

  1. You create a template presentation with a table and a text frame that will serve the purpose of footer. If you don’t want to use the template presentation then you create an empty slide and add a table in it with desired number of columns. Also create an autoshape rectangle at bottom of slide that will serve as footer.
  2. Now, you need develop your logic in such a way that you will populate the table rows and verify the height and width of the table on every instance.
  3. The moment, it exceeds the slide you clone (copy) the existing slide. The clone will reduce your efforts for recreating a new slide and a new table in it.
  4. You will then start populating the rows in new slide and perform step 3 & 4 again until your data is finished.

For reference please visit the following documentation links.

  • Setting row minimum height/width, please visit here.
  • Cloning within the same PPTX Presentation from one position to the end, please visit this link.
  • Accessing the existing table, please visit this link.

indrajith:

And also we would like to add the table header automatically on to the new slide.

  • I came to know from one of the forum topic that headers/footers are not supported in MS PPT 2007. Can you point me to the sample code that helps add header/footer as rectangles and make it automatically appear on any new slides added in the presentation?

As share earlier, you need to add an rectangle autoshape on bottom of slide where ever you like. There a property ShapeEx.AlternativeText that can hold the user defined shape name. When you will be creating your template slide as mentioned in above section, you will also create a rectangle autoshape. You will set your user defined name to Footer shape using AlternativeText property. It will allow you to identify your shape from all other shapes. You can even set the name of your table as well using AlternativeText property. If you are interested in showing the slide number in footer text then you can use the index (of slide in PresentationEx.Slides collection) + 1 as the position of slide.

For reference, please visit following links.

  • For creating a footer text box on slide, please visit this link.
  • For reference to footer shapes please visit this thread.
  • For information about AlternativeText property, please visit this link.

indrajith:

  • Is there a way to feed the tool with the html stream of the webpage that needs to be converted and generate a PPTX presentation instead of adding slide by slide?

Unfortunately, there is no way or automated tool available that can extract text from html and add it in PPTX text frames. One needs to write its own parsing routine to implement this. The reason being Aspose.Slides has its own properties for setting text to bold or to italicize it. It cannot understand the HTML tags. However, one can implement his own parsing routine to extract the data with proper formatting from html and add that to PPTX text frames and also setting the desired properties. Hope it answers the question.

indrajith:

  • Do you sell any product that converts the given PDF in to a PPTX presentation in a web application?

Aspose.Slides for .NET allows you to convert a given presentation to PDF but the reverse is not possible. However, we have another product Aspose.PDF that allows you to read the PDF files. Since, base line architecture of all Aspose products is similar so you may use this thing to read a PDF and generate your own PPTX based on that. I know this is one herculean task but one can do this if he desires. You may also use other third party components to convert given PDF to PPTX as well.

Please share with us, if I may be of any further help to you.

Thanks and Regards,