Request for function: GetColumnCountByRow(int Row)


#1

Is it possible for you to easily implement such a function that gets the number of columns for a given row post-merge? The problem is Table.ColumnsNumber gives the number of total columns table-wide - but if a given row's columns have been merged - and you try to write something that loops over Table.ColumnNumber then you can get into trouble accesing a cell that no loner exists.

I understand if this doesnt seem like a useful function or if there are technical difficultes involved. But I could really use a function like this as soon as can be arranged.

So please consider adding this function.


#2

Bumping for response.


#3

I can add such function in the next versions but I think it’s useless
because if you merge cells in one row of table numeration of cells
will be the same as before.

For example you have 4 cells in a row and merge cells 2 and 3.
After merging 4th column will be 4th as before and 2nd and 3d
cells will refer to the same merged cell.


#4

I see.. I appreciate the response.

Maybe there's something else that can be done. I'll try to explain my problem as best I can (it's complicated.)

The basic deal is I have a Aspose.Slides project that generates a powerpoint presentation - almost all of the objects on the slides are tables - and due to the dynamic nature of the data in those tables the size of the table will often overlap the slide that it's on.. So after each row is written I measure the hieght of the table and if I am overlapping a designated margin - I add a new slide and repeat the process.

Some of the tables have a dynamic number of columns - and within a table a given row can have less columns than the row above it. So I have to store off any rows I need to merge and call a UserDefined Merge routine on the array of merge rows any time a new table is added.

The problem is - the height of the table is determined before the merge and hence is technically invalid (but fot the most part I can live with it.) Ideally I'd like to call merge's when they are needed - but in the past given the way the AddRow works (where it essentially clones the row above) this results in invalid row references (to be honest merging rows can lead the developer into all kinds of headaches..)

I realize this is rambling and probably making no sense. I will try to see if I cant find some other solution to the problem. Thanks for your help though. It isnt necessary to add the function - especially if it offers no value.

I am always impressed by your responsiveness to user requests - you guys are some of the best component support I've seen. I really do appreciate it.


#5

Well, number of columns is not changed when you merge cells.
I’d offer another thing. We can add function to calculate number of cells (not columns) in a row.
Probably that is what you are looking for.


#6

That would do nicely yes. Thanks./