Hi,
I'm trying to write a macro to convert Word tables to a Wiki syntax in
plain text, by adding delimiting tags to the cells.
See http://twiki.org/cgi-bin/view/Plugins/MsWordToTWikiMLAddOn
This is what such a wiki table might look like:
| *L* | *C* | *R* |
| A2 | 2 | 2 |
| A3 | 3 | 3 |
| multi span ||| <-------- notice a row merge by empty ||
| A4-6 | four | four |
|^| five | five |
|^| six | six |
3 row column merge indicated by ^
The following code works OK with 'normal' tables, but fails on tables
where cells are merged.
Somehow I need to:
- find out which cells are merged
- add the right number of additional tags to row merges
- insert carets (^) to all but the first of a column merge
If anybody could share some ideas that would be greatly appreciated!
Cheers,
Jos
------ CURRENT CODE
Private Sub ConvertTables()
Dim thisTable As Table
Dim thisRow As Row
Dim thisCell As Cell
For Each thisTable In ActiveDocument.Tables
For Each thisRow In thisTable.Rows
For Each thisCell In thisRow.Cells
thisCell.Range.InsertBefore "|"
thisCell.Range.Find.Execute FindText:="^p",
ReplaceWith:=" ", Format:=True, Replace:=wdReplaceAll,
MatchControl:=True
Next thisCell
thisRow.Range.InsertAfter "|"
Next thisRow
thisTable.ConvertToText Separator:=" "
Next thisTable
End Sub
Dig-IT - 10 Aug 2005 14:38 GMT
Just some pointers on how to detect cell merges in tables would already
be very welcome!
Thanks in advance,
Jos
> Hi,
> I'm trying to write a macro to convert Word tables to a Wiki syntax in
[quoted text clipped - 42 lines]
> Next thisTable
> End Sub
Doug Robbins - 10 Aug 2005 19:33 GMT
See
http://groups-beta.google.com/group/microsoft.public.word.tables/browse_thread/t
hread/998117da74e26cde/75a809237f5055d0?q=merged+cells&rnum=4#75a809237f5055d0

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Just some pointers on how to detect cell merges in tables would already be
> very welcome!
[quoted text clipped - 47 lines]
>> Next thisTable
>> End Sub
Dig-IT - 11 Aug 2005 11:59 GMT
> See
>
> http://groups-beta.google.com/group/microsoft.public.word.tables/browse_thread/t
hread/998117da74e26cde/75a809237f5055d0?q=merged+cells&rnum=4#75a809237f5055d0
Much appreciated, it didn't occur to me to search for COLSPAN or ROWSPAN...
Thanks Doug, I'll investigate,
Jos