添加word文档并保持格式 [英] Add word document and keep formatting

查看:496
本文介绍了添加word文档并保持格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的简历添加到文档的末尾。下面的代码就是这样做的,但是一旦插入到新文档中,CV的格式就会混乱。我可以插入文件,并保持简历的原始格式(我不想从打开的文档复制和粘贴):

pre $ objword1.Selection.InsertFile文件名:= cv1Address,_
ConfirmConversions:= False,Link:= False,附件:= False


解决方案

恐怕你不能使用InsertFile方法,但必须打开文件并复制并粘贴 wdFormatOriginalFormatting



我发现这个:

 <$ c $ (设置rtffile = wdApp.Documents.Open(Filename:=C:\temp\rtf_stapler_problem\concat\cars2.rtf,ConfirmConversions:= False,ReadOnly:= True)
wdApp.Selection .WholeStory
wdApp.Selection.Copy
wdApp.ActiveWindow.Close savechanges:= wdDoNotSaveChanges
destdoc.Activate
wdApp.Selection.PasteAndFormat(wdFormatOriginalFormatting)
wdApp.Selection .InsertBreak类型:= wdSectionBreakNextPage

here


I am attempting to add my CV to the end of a document. The following code does just that but the formatting of the CV is messed up once it is inserted into the new document. Can I insert the file and keep the original formatting of the CV (I dont want to copy and paste from an open document):

objword1.Selection.InsertFile Filename:=cv1Address, _
    ConfirmConversions:=False, Link:=False, Attachment:=False

解决方案

I'm afraid that you can't use the InsertFile-method but have to open the file and copy&paste with wdFormatOriginalFormatting

I have found this:

Set rtffile = wdApp.Documents.Open(Filename:="C:\temp\rtf_stapler_problem\concat\cars2.rtf", ConfirmConversions:=False, ReadOnly:=True)
wdApp.Selection.WholeStory
wdApp.Selection.Copy
wdApp.ActiveWindow.Close savechanges:=wdDoNotSaveChanges
destdoc.Activate
wdApp.Selection.PasteAndFormat (wdFormatOriginalFormatting)
wdApp.Selection.InsertBreak Type:=wdSectionBreakNextPage

here

这篇关于添加word文档并保持格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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