复制Word文档的内容并粘贴到另一个 [英] Copying contents of Word doc and paste into another

查看:1924
本文介绍了复制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();

这篇关于复制Word文档的内容并粘贴到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆