Cell width change?


how do you change an individual cell's width? looks like table allows you to change the entire column size but i don't see one for just the cell.

i have merged cells in my table and not sure how the table.setColumnWidth would apply...




It’s not possible to change width of one cell. You can’t do it also in MS PowerPoint.
PowerPoint emulates it by splitting cell after that changing width of whole column.
The same thing possible with Aspose.Slides.



thank you for your reply.

let me clarify the cell width thing. it appears for tables with *merged* cells, MS ppt does allow you to change the cell width. your statment is true if its the *out of the box* table. but once you start merging cells and the columns sizes are not consistent at every row. the cell width can be modified.

i have a unique requirement that calls for dynamically changing a cell width for a specific row. here is how i have my table set up:

created a 3x3 table.

row0: two col (this was created by merging col 0 + col 1)

row1:3 col

row 2: 2 col

in row2, MS ppt allows me to adjust row1's individual cell. so this is not supported by Aspose?

lastly, i noticed that your table.getCell() is getCell(col,row)... instead of getCell(row,col). i was expecting the latter :-)




Such things are supported but it’s not trivial work. I’ve wrote short description in the wiki how cells numeration work. Hope it will help you to understand the main idea. Please check this page:
Each additional vertical border in a table is just additional column so you need just find correct one and change its width.

I think getCell(col, row) sequence is a standard like point’s (x, y) coordinates.



thank you for your answer. i will definately play with it.

i have an another related question.

can you merge more than one sequencial cells? for example: if i want to merge cells (0,0) to (3,0); does aspose api support this? or do i have to do it for each pair. i have tried to do it *brute force* (each pair) but running into *Cell can't be merged" exceptions.




Sure, you can merge many cells. This should work:

table.MergeCells(table.GetCell(2, 0), table.GetCell(3, 0));
table.MergeCells(table.GetCell(1, 0), table.GetCell(2, 0));

table.MergeCells(table.GetCell(0, 0), table.GetCell(1, 0));