What is the "correct" way to split table cells and what is SplitByColSpan vs SplitByWidth?

I am struggling to understand how to split cells and the correct way to do that in aspose.slides. I am using the latest .net versions.


Lets assume I have a table with 2 columns and 2 rows and I want to change the second row to have 6 columns

When should i use SplitByColSpan vs SplitByWidth?

Also, I am trying to use SplitByWidth. what does the parameter represent (I assume the width of the first column after the split).

Also, I am doing a split and then trying to refer to a cell in the table using

table[col, row] syntax and it seems to be pointing to the wrong cell after the split

In general, I can’t find any documentation around this being used in any example on the aspose.slides forums or documentation. Can you please provide an example and best practices when using these to show the correct functionality and approach and how to go about this.

Hi Adam,


I have observe your comments. I have shared a piece of code in a text file with you. This will help you to achieve your requirements. I like to inform that that SplitByWidth changes number of columns and SplitByColSpan use only to early merged cells. Please share feedback with us if there is still an issue.

Best Regards,
  1. What do you mean by “SplitByColSpan” use only to early merge cells? I don’t understand that statement. Can you provide an example when you would use this?


    2. For SplitByWidth. Can you clarify what the parameter means? In your example below, you start off with 2 columns that are 300 width. After calling tbl1[1, 1].SplitByWidth(50); you have 3 columns but i am trying to understand what the 50 represents. Would the 3 column widths respectively at that point be: 1. 300, 2. 50, 3. 250? After this line tbl1[2, 1].SplitByWidth(50); would the col widths be 1. 300, 2. 50, 3. 50, 4. 200?
                    Presentation pres1 = new Presentation();
    
             ISlide sld1 = pres1.Slides[0];
             double[] dblCols2 = { 300, 300 };
             double[] dblRows2 = { 50, 50 };
             ITable tbl1 = sld1.Shapes.AddTable(50, 50, dblCols2, dblRows2);
             //tbl1.StylePreset = TableStylePreset.NoStyleNoGrid;
    
             tbl1[1, 1].SplitByWidth(50); //change number columns!!!
             tbl1[2, 1].SplitByWidth(50);
             tbl1[3, 1].SplitByWidth(50);
             tbl1[4, 1].SplitByWidth(50);
             tbl1[5, 1].SplitByWidth(50);</b></pre><pre style="word-wrap: break-word; white-space: pre-wrap;">The reason i am asking is that the above is what i would expect but I am not experiencing that so I am trying to see if my understanding and expectation is just not correct or if i am doing something wrong.</pre></div>

Hi Adam,


I have observed your comments. I like to inform that parameter in SplitByWidth means width of new column. But the method has restriction: if source cell height is less than pointed in SplitByWidth you’ll get the exception. For SplitByColSpan, I have shared piece of code in a text file with you. Please share feedback with us if there is still an issue.

Best Regards,

what do you mean by “and indirect merge all cells in all rows”? I still don’t understand from your example when to use SplitByColSpan and what it does.


Can you please clarify?

Hi Adam,


We are looking into this and will get back to you with feedback soon.

Best Regards,

Hi Adam,


I have observed your comments. I like to inform that when you split a cell Slides creates new column. All tables has now one column more in all rows but this new column is merged in all rows but one where we split cell. Let’s suppose we have two rows in table and every row have two cells. When we split second cell in second row we have three cell in second row. But it is equals that we have three columns in table and first row contains second cell merged two columns. Please share feedback with us if there is still an issue.

Best Regards,