日期:2014-05-17  浏览次数:20854 次

把word1文档里面文字插入到模板word2里面去?有什么办法
把word1文档里面文字插入到模板word2里面去?有什么办法。、
word1文档里面内容有多种字体。字号不也不相同,怎么把word1的内容完整,格式不变的插入到模板word2去。

------解决方案--------------------
读取 word1内容,再写到WORD2

Word.ApplicationClass wordApp=new ApplicationClass();
object file=path;
object nullobj=System.Reflection.Missing.Value;
Word.Document doc = wordApp.Documents.Open(
ref file, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj);

doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
IDataObject data=Clipboard.GetDataObject();
string str=data.GetData(DataFormats.Text).ToString();
doc.Close();