Word中PageSetup不能复制吗

6lilu9 6lilu9 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
如题:想将Fsinfos[0].FullName 这个文件中的页面设置 赋值给 当前文档第二节,但

一、试了试下面代码,一点效果没有

Word.Document oDocument_Other = App.Documents.Open(Fsinfos[0].FullName);
Word.PageSetup ResultPageSetup = oDocument_Other.PageSetup;
oDocument.Sections[2].PageSetup = ResultPageSetup;


二、试了试下面代码,直接报错

oDocument.Sections[2].PageSetup =oDocument_Other.PageSetup.Clone()


三、下面代码可行,但太费劲了(因为属性实在太多),不知可有好办法?

oDocument.Sections[2].PageSetup.TopMargin =28.3f;
oDocument.Sections[2].PageSetup.BottomMargin =14.15f;
oDocument.Sections[2].PageSetup.RightMargin = oDocument_Other.PageSetup.RightMargin;
oDocument.Sections[2].PageSetup.LeftMargin = oDocument_Other.PageSetup.LeftMargin;

...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
6lilu9
C# 111,129 成员 642,538 内容