www.webdeveloper.com
Results 1 to 2 of 2

Thread: Ho can I merge columns in the table in word.application using JavaScript?

Hybrid View

  1. #1
    Join Date
    Nov 2013
    Posts
    7

    Ho can I merge columns in the table in word.application using JavaScript?

    Hi,
    I have problem with merging columns in the word.application after table create.
    I would like to see my table like this:

    | cell1 | cell2 | cell3 |
    | c e l l 4 |

    My code looks like this:

    var MyWordApplication = new ActiveXObject("Word.Application");
    var offerdoc = MyWordApplication.Documents.Add();

    var tbl = offerdoc.Tables.Add(MyWordApplication.Selection.Range,2,3);

    var cCell1 = tbl.Cell(1,1).range;
    var cCell2 = tbl.Cell(1,2).range;
    var cCell2 = tbl.Cell(1,3).range;

    var cRow2 = tbl.rows(2).range;


    I've tried a lot of combination, but still no effect.
    My real target is write text after the table, but create secon row, and merge all 3 cells is also good for me.

    Could somebody help me with this topic?

  2. #2
    Join Date
    Nov 2013
    Posts
    7
    Hi,
    I found solution of this problem, and it works fine now.


    var cCell31 = tbl.Cell(3,1).Merge(tbl.Cell(3,3));
    var cCell31a = tbl.Cell(3,1).range;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles