Free Support Forum - aspose.com

How in the world can this be done?

The issue:
I have a dynamically built PPTX using Slides.net 18.3.
There’s only 1 Slide, which has an ITable, also built dynamically.
After being built, the ITable is too wide for the slide, so here’s what I do to “fix” the situation:

  1. I Clone a copy of the Original Slide (now there is the “Original” and a Clone). Both have ITables which are too wide.
  2. For the Original Slide - All of the ITable.Columns that are outside of the slide boundaries, I remove from the ITable starting from the far right, like this:

while (_table.width > slideWidth)
{
var index = _table.Columns.Count - 1;
addIndexToList(index);
_table.Columns.Remove(index, true);
}

  1. For each column which is removed, I save it’s respective Index to a List, as shown above.
  2. On the Cloned slide, I remove all of Columns EXCEPT those with the indexes from above.

The problems:

  • The Indexes are NOT a true index due to merged cells. It isn’t reliable. If I happen to remove a Column which has merged cells somewhere within its respective Rows, the Column count could decrease by something other than 1.

  • There’s no way to ensure the correct Columns are removed from the Cloned ITable without peeking at the Column data, which is a poor way to work (the Column text, for example, could be the same for several Columns).

  • There is no such thing as a ColumnID (as there is for a SlideID). If there was, all of the above would be simple.

  • You cannot “Clone” Columns from one ITable to another (which is why I have to remove Columns from the Cloned ITable and not just add the Original Columns to the Clone).

Suggestions mighty appreciated. Hope this made sense.

@Dork.Scott,

I have observed and understood the requirements shared by you. Actually, when you clone a slide with table, you have a completely new table and when you remove initial columns from cloned slide the column indices shall change. I agree with your following point as well.

At present there is no support for setting any Column ID or Column Name property that you may refer to avoid the incurring issue. An issue with ID SLIDESNET-40026 has been added as new feature request in our issue tracking system to investigate the implementation of setting Row, Column IDs or provision to set name for row and column inside table. This thread has been linked with the issue so that you may be automatically notified once the support will be available.