Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have created a table below using R with HTML code attached at the end of the question.

enter image description here

The default output from R fits perfectly my need, but I need table to be shown and editable in MS Word. I tried: i) copy-and-paste the table from firefox to MS Word; and ii) open the html file using MS Word. Both give me table with distorted style.

Is there anyway to copy the table as it is seen below from HTML to word?

<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
 <style>table { border-collapse:collapse; border:none; }
th { border-bottom: 1px solid; }
table td { padding:0.2cm; }
.summary td { padding-top:0.1cm; padding-bottom:0.1cm }
.colnames td { font-style:italic }
.firstsumrow { border-top:1px solid }
.lasttablerow { border-bottom: double; }
.topborder { border-top:2px solid }
.depvarhead { text-align:center; border-bottom:1px solid; border-top:1px solid }
.topcontentborder { border-top:double }
.annorow { border-top:2px solid }
.annostyle { text-align:right }
</style> 
</head>
<body> 
 <table>
   <tr class="topborder">
    <td rowspan="2"><em>Predictors</em></td> 
     <td colspan="3" class="depvarhead"><em>Dependent Variables</em></td> 
   </tr>
  <tr> 
     <td colspan="3">Barthel-Index</td> 
   </tr> 
   <tr class="colnames">
    <td>&nbsp;</td>
     <td>B (CI)</td><td>std. Beta</td><td>p</td>
   </tr>
   <tr class="topcontentborder"> 
     <td>(Intercept)</td> 
     <td>93.76 (85.95-101.57)</td> <td></td><td><b>0.000</b></td> 
   </tr> 
   <tr>
     <td>Carer's Age</td> 
     <td>-0.55 (-0.69--0.41)</td> <td>-0.25</td><td><b>0.000</b></td> 
   </tr> 
   <tr class="summary firstsumrow">
    <td>Observations</td>
     <td colspan="3">880</td>
   </tr>
   <tr class="summary">
     <td>R<sup>2</sup> / adj. R<sup>2</sup></td>
     <td colspan="3">0.061 / 0.060</td>
   </tr>
   <tr class="summary">
     <td>AIC</td>
     <td colspan="3">8424.34</td>
   </tr>
   <tr class="annorow">
    <td>Notes</td><td class="annostyle" colspan="3"><em>* p&lt;0.005&nbsp;&nbsp;&nbsp;** p&lt;0.01&nbsp;&nbsp;&nbsp;*** p&lt;0.001</em></td>
  </tr>
</table> 
 </body></html> 
share|improve this question

3 Answers 3

You can do this with insert object. In the Insert ribbon, under the Text tab, go to Object - Text from file.

You may have to alter it afterwards, such as formatting etc as there some subtle differences but it isn't bad!

enter image description here

share|improve this answer
1  
sorry for being picky, but I need to repeat the formatting work for several dozens of tables, it would be good if formatting can also be inherited to MS Word. –  lokheart Feb 26 '14 at 15:41
    
I can't see where your state that in your original question. –  Dave Feb 26 '14 at 17:07

I believe you can open HTML files as HTML files in word. So save the file to a location and then open it with word.

share|improve this answer
    
nope, i tried but the format still gets distorted, actually i tried that before the question is asked –  lokheart Feb 26 '14 at 15:25

Import to libreoffice, save as .doc and open in Word. Libreoffice does a better job of importing html tables.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.