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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 19, 2011, 1:39 AM EDT
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
Ali Alfaraj62 reputationPosted Sep 19, 2011, 2:40 AM EDT
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
Ali Alfaraj62 reputationPosted Sep 19, 2011, 10:27 PM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 19, 2011, 10:31 PM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 19, 2011, 10:35 PM EDT
http://stackoverflow.com/questions/6310258/pasting-from-excel-into-a-word-document
Ali Alfaraj62 reputationPosted Sep 19, 2011, 11:15 PM EDT
Rich Guernsey2 reputationPosted Dec 5, 2014, 11:29 AM EST