If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to determine the merged columns and rows in a table
I am trying to convert the word table to xml format, for which i am not able
to determine the merged cells to replace with "colspan" and "rowspan" attributes. I tried with WdInformation.wdEndOfRangeColumnNumber and WdInformation.wdStartOfRangeColumnNumber, but for all cells the value is the current column number. |
#2
|
|||
|
|||
How to determine the merged columns and rows in a table
Hi =?Utf-8?B?QW51cA==?=,
I am trying to convert the word table to xml format, for which i am not able to determine the merged cells to replace with "colspan" and "rowspan" attributes. I tried with WdInformation.wdEndOfRangeColumnNumber and WdInformation.wdStartOfRangeColumnNumber, but for all cells the value is the current column number. The best way for you to do this would be to save the file to HTML format (as a webpage) then parse that XML (Word's round-trip HTML). That does contain colspan and rowspan information. Also, this would probably be a lot faster than trying to convert a Word document through automation. In principle, you probably should be able to create a transform to do the job. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
#3
|
|||
|
|||
How to determine the merged columns and rows in a table
Thanks for your kind information.
Do we have any other method to find? instead of saving it as HTML and then processing. Anup "Cindy M -WordMVP-" wrote: Hi =?Utf-8?B?QW51cA==?=, I am trying to convert the word table to xml format, for which i am not able to determine the merged cells to replace with "colspan" and "rowspan" attributes. I tried with WdInformation.wdEndOfRangeColumnNumber and WdInformation.wdStartOfRangeColumnNumber, but for all cells the value is the current column number. The best way for you to do this would be to save the file to HTML format (as a webpage) then parse that XML (Word's round-trip HTML). That does contain colspan and rowspan information. Also, this would probably be a lot faster than trying to convert a Word document through automation. In principle, you probably should be able to create a transform to do the job. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
#4
|
|||
|
|||
How to determine the merged columns and rows in a table
Hi =?Utf-8?B?QW51cA==?=,
Do we have any other method to find? instead of saving it as HTML and then processing. I'm assuming this isn't Word 2003, otherwise you wouldn't have to do a conversion, you could just pick up the XML direclty... No, there's not really any RELIABLE way to pick up which cells are merged. The approach you mention in your first post is the only way. You have to figure out how many columns/rows the table SHOULD have, then "walk" all the cells. If a column or row number repeats, then a cell is merged. But things can get tricky when you try to "walk" the cells, as you can end up repeatedly in the same cell (endless loop). And the whole thing can only work if you know which column and which row will NEVER have merged cells so that you can determine what the total rows and columns for the table should be. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
#5
|
|||
|
|||
How to determine the merged columns and rows in a table
Thanks a lot.
"Cindy M -WordMVP-" wrote: Hi =?Utf-8?B?QW51cA==?=, Do we have any other method to find? instead of saving it as HTML and then processing. I'm assuming this isn't Word 2003, otherwise you wouldn't have to do a conversion, you could just pick up the XML direclty... No, there's not really any RELIABLE way to pick up which cells are merged. The approach you mention in your first post is the only way. You have to figure out how many columns/rows the table SHOULD have, then "walk" all the cells. If a column or row number repeats, then a cell is merged. But things can get tricky when you try to "walk" the cells, as you can end up repeatedly in the same cell (endless loop). And the whole thing can only work if you know which column and which row will NEVER have merged cells so that you can determine what the total rows and columns for the table should be. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
insert columns after a merged cell in a table | Liz | General Discussion | 1 | November 10th, 2005 04:57 PM |
Pasting text in table results in merged columns... | David | Tables | 0 | September 1st, 2005 11:12 PM |
Table Design | A. Williams | Database Design | 3 | April 29th, 2005 07:02 PM |
change a table to 3 columns only (Rows instead of Table) | Mo | Worksheet Functions | 1 | August 7th, 2004 09:23 PM |
Converting a table with rows of info into a table with columns | Ernie | Database Design | 8 | June 15th, 2004 01:59 AM |