Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

determine a merged cell span column value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alfonso gonzales - 13 Feb 2005 19:59 GMT
Hello Everybody

I have set out to create a simple macro that converts Word tables to HTML
format.

I was albe to do it for tables with regular column and row numbers, but I
have come upon a stumbling block when trying to tacke merged cells ...
these are really a drag!

Looking for a hint on how determine how many columns (or rows) a merged cell
spans.

When saving  a word doc as HTML tables are saved correctly, so I guess there
must be a way.

Is there anyone who has undertaken this arduous task and has come
victorious.

alfonso gonzales
Jezebel - 13 Feb 2005 20:36 GMT
The RowIndex and ColumnIndex properties provide the information you need,
although as you observe, it can get *very* complex, particularly if there
are cells merged vertically as well as horizontally, and if there are split
cells as well.

As a general approach --

1. Iterate the table to find the cell with the highest ColumnIndex value --  
this determines the number of columns needed for the HTML table. (It might
be higher than the number of columns Word thinks is in the table, if there
are split cells.)

2. To check for horizontal merging, compare cell with cell.next -- if the
same rowindex then the number of horizontal cells merged into the first is
Cell2.ColumnIndex - Cell1.ColumnIndex; if not in the same row, then merge =
Column Count - ColumnIndex + 1

3. To Check for vertical merging, find the next cell with the same
ColumnIndex value, then compare the rowindex values.

> Hello Everybody
>
[quoted text clipped - 15 lines]
>
> alfonso gonzales
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.