Free Support Forum - aspose.com

Does Aspose.Slides Implement Functionalities Such as Insert Row/Column or Get Row/Column for PPT Format?

Hi,

I'd like to use Aspose.Slides to manipulate tables, but I found that for PPT(97-2003) format, Aspose didn't provide a lot of APIs for using. For example, I want to insert row/column in an existing table, or get some specific rows/columns in a table, but I only found Table.AddRow(), Table.AddColumn() and Table.GetCell(). For PPTX(2007 and above), Aspose really provides much richer functionalities. Because currently I have no idea that whether my client is willing to change their template from PPT to PPTX, with Aspose.Slides, could somebody tell me if Aspose could implement functionalities of inserting row/column, getting row/column with PPT format now?

Thanks.

Hi Sheng,


Thanks for inquiring Aspose.Slides.

I have tried to observe the requirements shared by you. I like to share the Aspose.Slides (for PPT) and Aspose.Slides.Pptx (for PPTX) are two separate namespaces dealing with two different formats of presentations. What I have observe from your requirement is that your need to add or access particular row or columns inside PPT table.

Actually, the eventual purpose of working with table is to access some particular cell inside table and play with its values. In case of PPTX table, we have collection of rows or columns associated with table and you can access the cells either by traversing through columns or rows. So, its a two step approach for accessing the cells in case of PPTX. Similarly, you can add or delete the rows or columns inside existing tables as well.

Now, in case of PPT table there is no collection of rows or columns exposed for access. But a direct method to get the particular cell by providing its row and column index is available. PPT tables allows you to add new rows or columns as well. In short, it has all the capability of PPTX tables but has missing collection of rows or columns as in case of PPTX. But it does give access to particular cell by providing row and column index. I don’t feel its an issue. Can you please share the requirements that you are trying and not getting them done through PPT tables.

Secondly, we are also working over the unification of Aspose.Slides API for both PPT and PPTX. The new API is expected to be released during Q2 of 2013. Once the new API will be released there will be same access methods for dealing with PPT and PPTX presentations.

Please share, if I may help you further in this regard.

Many Thanks,

Hi Mudassir,

thank you for your reply. I've attached a sample ppt here. The table is extracted from our template. Our target is to generate table dynamically on the base of table template. In the sample table, there are 3 rows. The first is header, the second is body, and the last is footer. Each one has their specific format. Obviously, the body rows will be populated when we give a specific data source, for example, a data table. I think the purpose of using a table template is to take advantage of the format of every row/cell, otherwise we need to store the format in other place, which will be more complex. But as you see, for PPT format, Aspose provides Table.AddRow() only, which will clone the last row of the table. In my sample, the last one is footer, not body. If I use AddRow, I can only clone a row from footer, while I want to clone the body row. So if a method like InsertRow is provided, I think we could achive goal. If you could provide some other approaches, it will be highly appreicated.

thanks !!!

Hi Sheng,


I have observed the requirements shared by you and regret to share that that feature for inserting row or column at particular index of table is unavailable in case of PPT. I have created an issue with ID SLIDESNET-34099 to further investigate and resolve the issue. As I shared with you earlier that we are currently working over the unification of Aspose.Slides Api for PPT and PPTX. The said issue will be automatically addressed when the unified API will be released.

In the meanwhile, I have a solution for your problem that you may please use PresentationEx class to access the PPT and treat that as PPTX table. The following sample code will serve the purpose for you. Please share if I may help you further in this regard.

public static void TestTable()
{
PresentationEx pres = new PresentationEx(“D:/Aspose Data/Sample_Table.ppt”);
SlideEx slide = pres.Slides[0];

foreach (ShapeEx shape in slide.Shapes)
{

if (shape is TableEx)
{
TableEx table = (TableEx)shape;
table.Rows.InsertClone(2, table.Rows[1], false);

}
}

pres.Write(“D:/Aspose Data/Sample_Table2.pptx”);
}

Many Thanks,