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

查看:32
本文介绍了复制 Word 文档的内容并粘贴到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 C# 以编程方式复制一个 Word 文档的内容并将其粘贴到另一个 Word 文档中?

How do i programatically copy the contents of one word document and paste it to another word document using C#?

我基本上是想复制一份个人资料(也就是一个word doc的内容),然后插入到报告中.

I basically want to copy a personal profile (which is the contents of one word doc) and then insert it into a report.

任何帮助将不胜感激

谢谢

推荐答案

您可以这样做:

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天全站免登陆