Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Merged cells
In both cases you need to maintain an internal model of the 'theoretical'
model of the table, and populate it by examining the cells of the table individually. This is actually really hard to do: the Word programmers have never really conquered the problem. The example you give is not too hard, but consider: take a table with five columns and four rows. Now merge cells 1,1 and 1,2; 2,2 and 2,3; 3,3 and 3,4; 4,4 and 4,5. Now re-align the column boundaries: do you end up with 4 x 4 table, or a 4 x 5 table with a merged cell in each row? This is without even starting on the further complications of split and deleted cells. However, for your immediate purposes: you can do the first table by looking at each cell's .ColumnIndex and .RowIndex properties. You'll see that row 2 has cells in columns 1 and 2 only; therefore its third column must be merged with the row above. This requires the assumption that the table has not had cells deleted. (Consider a 3 x 3 table with cell 2,3 deleted from it -- if that's all that's happened you could tell the difference because .Uniform would still be true in the latter case.) "Jorge" wrote in message ... First of all, thanks for your patience. I must be explaining myself very badly. The output I want to get for a 3x3 table in which Cell(1,3) and Cell(2,3) are merged is the following: table border="1" tr tdCell 1,1/td tdCell 1,2/td td rowspan="2"Cell 1,3/td /tr tr tdCell 2,1/td tdCell 2,2/td /tr tr tdCell 3,1/td tdCell 3,2/td tdCell 3,3/td /tr /table The output I want to get for a 3x3 table in which Cell(2,2) and Cell(2,3) are merged is the following: table border="1" tr tdCell 1,1/td tdCell 1,2/td tdCell 1,3/td /tr tr tdCell 2,1/td td colspan="2"Cell 2,2/td /tr tr tdCell 3,1/td tdCell 3,2/td tdCell 3,3/td /tr /table I'm sorry to insist, these tables have exactly the same number of cells, rows and columns, but they are not the same because in the first case, Cell(1,3) occupies two rows and in the second case Cell(2,2) occupies two columns. "Jezebel" wrote: That's exactly the point: you end up with the same table either way. And in HTML, it *IS* the same table either way. What are you actually trying to do? "Jorge" wrote in message ... I'll give you a practical example to clarify my question a bit mo I get the same properties for a 3x3 table in which Cell(1,3) and Cell(2,3) are merged and a 3x3 table in which Cell(2,2) and Cell(2,3) are merged. Certainly, these tables are not the same, so I cannot simply count the number of rows and columns because I'd end up with the same table in both cases. "Jezebel" wrote: Depends what 'identify them' means for you. You can get some information by comparing the .Row, .RowIndex, .Column and .ColumnIndex properties. But the problem is ultimately indeterminate, because there's no underlying 'correct' table from which the merging causing deviations. The table model is really a somewhat fuzzy beast. You can create an HTML table from a Word table without reference to cell merging: just count the number of cells in each row and column, and go from there. "Jorge" wrote in message ... Hi everybody, I'm developing my own macro to convert a Microsoft Word document in an HTML document. Tables with merged cells are a major problem, since I can detect the existence of merged cells but I cannot identify them. Anyone can give me a tip? Thanks Jorge |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro to detect merged table cells? | Tables | |||
Cell border confusion after cells are merged | Tables | |||
Insert Column when merged cells exist | Tables | |||
Sum Above table with merged cells in Word 2003 | Microsoft Word Help | |||
Adding columns in table with merged cells | Tables |