Table MergeRows

Dec 21, 2009 at 4:38 PM

Fantastic tool! I'd love to really understand how Microsoft's ML works fully in Microsoft Word 2007, but managers are pushing for me to get results out to them.

This tool of yours helps quite a bit! I was able to do the same thing in just a few lines that took a page or two before.

If you, or anyone else, has the time, is there an option that I have overlooked that would allow me to Merge rows?

Coordinator
Dec 21, 2009 at 7:32 PM
Hi jp2code,

this functionality has not yet been added. If you take a look at the source code for merge cells you should be able to figure out how to implement merge rows.

I would do it myself but I am really busy with Christmas exams at the moment. Please take a look at http://www.cathalscorner.blogspot.com/

kind regards and happy coding,
Cathal
Dec 21, 2009 at 8:16 PM

Hi Cathal,

I understand your situation 100%. Actually, I was hoping someone else would chime in so that you would not be bothered with this right now.

I had a plan of attack, but it just failed:

  • I created a DocX document, inserted a 10x6 table, and saved it.
  • I opened the file using in MS Word 2007, merged 3 cells, saved it, and closed it.
  • I opened the document in Visual Studio using DocX, but it reported having 0 tables.

{sigh}. Oh well.

I'll look into merging cells (I didn't see info on this in the Help) in the code. If I discover anything, I'll post a solution that you can implement or ignore.

If I get something worked out, which method would you prefer?

  1. table.MergeCells(Cell startingCell, Cell endingCell) or
  2. table.Rows[i].MergeCells(int startingIndex, int endingIndex)?

Regards,
~Joe 

Dec 21, 2009 at 8:23 PM
Edited Dec 21, 2009 at 8:38 PM

Hey! It is in the code already!

It just isn't documented in the Help.

Cool. OK, I'm going to work with that to see what it gets me.

I'll be in touch.
~Joe 

 

[EDIT]
Oh, I see. It doesn't appear to work right just yet.

You keep on your studies, though. 

May 25, 2012 at 8:38 AM

Anything new about merging rows?

I have a table with 5 rows and 3 columns and I would like to merge all 5 cells in first column... is it possible yet?

Developer
May 25, 2012 at 8:44 AM
_simon_ wrote:

Anything new about merging rows?

I have a table with 5 rows and 3 columns and I would like to merge all 5 cells in first column... is it possible yet?

Try Table.MergeCellsInColumn (int columnIndex, int startRow, int endRow)

May 25, 2012 at 10:56 AM

Works great, thanks!