复制Word文档的内容并粘贴到另一个
问题描述:
我如何编程方式复制一个word文档的内容,并使用C#将其粘贴到另一个Word文档?
How do i programatically copy the contents of one word document and paste it to another word document using C#?
我基本上要复制个人档案(这是一个字文档),然后的内容,将其插入一个报告。
I basically want to copy a personal profile (which is the contents of one word doc) and then insert it into a report.
任何帮助,将不胜感激。
Any help would be greatly appreciated
感谢
答
您可以这样做:
object docStart = worddocpromo.Content.End - 1;
object docEnd = worddocpromo.Content.End;
object start = SubDoc.Content.Start;
object end = SubDoc.Content.End;
SubDoc.Range(ref start, ref end).Copy();
Microsoft.Office.Interop.Word.Range rng = worddocpromo.Range(ref docStart, ref docEnd);
rng.Paste();