Greeting dear members,
I would like to copy data from Excel to Word using visual c#.
How can I do that?
Regards,
Ali
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rich GuernseyPosted Dec 5, 2014, 4:29 PM
Ali AlfarajPosted Sep 20, 2011, 3:15 AM
Dorababu MekaPosted Sep 20, 2011, 2:35 AM
http://stackoverflow.com/questions/6310258/pasting-from-excel-into-a-word-document
Dorababu MekaPosted Sep 20, 2011, 2:31 AM
Ali AlfarajPosted Sep 20, 2011, 2:27 AM
Ali AlfarajPosted Sep 19, 2011, 6:40 AM
I managed to copy a number of cells from excel to word using the following c# code:
xlWorkSheet.get_Range("C5", "F9").Copy(Missing.Value); // xlWorkSheet is the XL sheet
oWord.Selection.Paste(); // oWord is the word sheet
However, by default, the copied cells will be pasted on the top of the word document, meaning that any original data before the past command will be shifted down the page.
How can I prevent that? I want to decide where to paste the cells within the word document rather than being done by default.
Thanks in advance,
Ali
Dorababu MekaPosted Sep 19, 2011, 5:39 AM
http://www.meadinkent.co.uk/excel-to-word.htm
http://stackoverflow.com/questions/2672032/how-to-copy-a-formatted-cell-in-excel-to-a-table-cell-in-word-using-net