Word Vba修改页边距.纸张纵向.装定线等的代码
下面的WAPP是事先定义的word文档工程变量。
以下代码为通过VBA代码来页面的页边距、纸张纵向、装定线、页眉页静等。
WApp.ActiveDocument.PageSetup.LineNumbering.Active =0;//行编号
WApp.ActiveDocument.PageSetup.Orientation =Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait;//页面方向
WApp.ActiveDocument.PageSetup.TopMargin =WApp.CentimetersToPoints(float.Parse("2.54"));//上页边距
WApp.ActiveDocument.PageSetup.BottomMargin = WApp.CentimetersToPoints(float.Parse("2.54"));//下页边距
WApp.ActiveDocument.PageSetup.LeftMargin = WApp.CentimetersToPoints(float.Parse("3.17"));//左页边距
WApp.ActiveDocument.PageSetup.RightMargin = WApp.CentimetersToPoints(float.Parse("3.17"));//右页边距
WApp.ActiveDocument.PageSetup.Gutter = WApp.CentimetersToPoints(float.Parse("0"));//装订线位置
WApp.ActiveDocument.PageSetup.HeaderDistance = WApp.CentimetersToPoints(float.Parse("1.5"));//页眉
WApp.ActiveDocument.PageSetup.FooterDistance = WApp.CentimetersToPoints(float.Parse("1.75"));//页脚
WApp.ActiveDocument.PageSetup.PageWidth = WApp.CentimetersToPoints(float.Parse("21"));//纸张宽度
WApp.ActiveDocument.PageSetup.PageHeight = WApp.CentimetersToPoints(float.Parse("29.7"));//纸张高度
WApp.ActiveDocument.PageSetup.FirstPageTray = Microsoft.Office.Interop.Word.WdPaperTray.wdPrinterDefaultBin;//纸张来源
WApp.ActiveDocument.PageSetup.OtherPagesTray = Microsoft.Office.Interop.Word.WdPaperTray.wdPrinterDefaultBin;//纸张来源
WApp.ActiveDocument.PageSetup.SectionStart = Microsoft.Office.Interop.Word.WdSectionStart.wdSectionNewPage;//节的起始位置:新建页
WApp.ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter = 0;//页眉页脚-奇偶页不同
WApp.ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = 0;//页眉页脚-首页不同
WApp.ActiveDocument.PageSetup.VerticalAlignment = Microsoft.Office.Interop.Word.WdVerticalAlignment.wdAlignVerticalTop;//页面垂直对齐方式
WApp.ActiveDocument.PageSetup.SuppressEndnotes =0;//不隐藏尾注
WApp.ActiveDocument.PageSetup.MirrorMargins = 0;//不设置首页的内外边距
WApp.ActiveDocument.PageSetup.TwoPagesOnOne = false;//不双面打印
WApp.ActiveDocument.PageSetup.BookFoldPrinting =false;//不设置手动双面正面打印
WApp.ActiveDocument.PageSetup.BookFoldRevPrinting =false;//不设置手动双面背面打印
WApp.ActiveDocument.PageSetup.BookFoldPrintingSheets = 1;//打印默认份数
WApp.ActiveDocument.PageSetup.GutterPos = Microsoft.Office.Interop.Word.WdGutterStyle.wdGutterPosLeft;//装订线位于左侧
WApp.ActiveDocument.PageSetup.LinesPage = 40;//默认页行数量
WApp.ActiveDocument.PageSetup.LayoutMode = Microsoft.Office.Interop.Word.WdLayoutMode.wdLayoutModeLineGrid;//版式模式为“只指定行网格”
您可能感兴趣的文章
- 05-12怎么激活office016,office2016激活密钥
- 05-12怎么查询office激活时间,office激活时间怎么查
- 05-12怎么激活电脑自带office,电脑自带office如何激活
- 05-12office许可掉了怎么激活,office密钥激活失败怎么办
- 05-12正版office怎么算激活,office正版激活方法
- 05-12平板office怎么免费激活,office免费激活方法
- 05-12怎么去重新激活office,office激活失败怎么办
- 05-12kms怎么取消激活office,office激活失败怎么办
- 05-12新电脑怎么office激活?office激活失败怎么办
- 05-12office2020怎么激活?office2020激活失败怎么办
阅读排行
- 1怎么激活office016,office2016激活密钥
- 2怎么查询office激活时间,office激活时间怎么查
- 3怎么激活电脑自带office,电脑自带office如何激活
- 4office许可掉了怎么激活,office密钥激活失败怎么办
- 5正版office怎么算激活,office正版激活方法
- 6平板office怎么免费激活,office免费激活方法
- 7怎么去重新激活office,office激活失败怎么办
- 8kms怎么取消激活office,office激活失败怎么办
- 9新电脑怎么office激活?office激活失败怎么办
- 10office2020怎么激活?office2020激活失败怎么办
推荐教程
- 07-012025最新office2010永久激活码免费分享,附office 2010激活工具
- 07-092025年最新office365激活码 office365永久激活密钥key分享
- 07-01怎么免费获取2025最新office2016专业增强版永久激活密钥/序列号
- 11-30正版office2021永久激活密钥
- 07-30Office2019 产品激活密钥(100%永久激活)
- 11-25怎么激活office2019最新版?office 2019激活秘钥+激活工具推荐
- 07-052025最新Office2019激活密钥,Office2019产品密钥分享
- 11-22office怎么免费永久激活 office产品密钥永久激活码
- 06-25office2021年最新永久有效正版激活密钥免费分享
- 11-25office2010 产品密钥 永久密钥最新分享
