title: Copy Excel range with merged cells to Word table - is this a bug and how to resolve?
body: <p>In my Word add-in (VSTO, vb.net) I built a import from/export to Excel and merged cells is giving me grief. My current environment is Win11/64 bit Office365. I've not yet been able to test on any other environment.</p>
  <p>The importer function basically does copy in Excel and PasteExcelTable in Word like so:</p>
  <pre><code>excelRange.Copy
  wordRange.PasteExcelTable (false, false, false)
  </code></pre>
  <p>The problem: When the Excel range has vertically merged cells then Word after paste has included rogue cells to the right of the table as you can see in the middle column of the picture below (1st column is the source tables from Excel, middle column the results in Word.).</p>
  <p>I've built a little table parser routine to tell me the row/column index and width of each cell and the results are weird. See the 3rd column in the picture below. I've tested with 5 different table layouts. This behaviour also happens when I manually copy/paste.</p>
  <p>The rogue cells show to the right of the vertically merged cells. In the 1st example, rows 3 and 4. There are also some rogue cells on rows 5 and 6. Basically these rogue cells are added from the vertically merged rows until the end of the table.</p>
  <p>I can build a routine to correct the pasted table in Word but I am trying to understand what is happening so I can factor that into my correction routine.</p>
  <p>Can you give me any ideas or pointers? Thanks!
  <a href="https://i.stack.imgur.com/AJJlI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AJJlI.png" alt="Comparing Excel source and Word result" /></a></p>