Vba全面修改Word段落属性有效代码

时间:2023-12-13 22:20:09 

下面的WAPP是事先定义的word文档工程变量。

以下代码为通过VBA代码修改Word段落的缩进、段落间距、行距、分页等。

//段落格式设定

WApp.Selection.ParagraphFormat.LeftIndent = WApp.CentimetersToPoints(float.Parse("0"));//左缩进

WApp.Selection.ParagraphFormat.RightIndent = WApp.CentimetersToPoints(float.Parse("0"));//右缩进

WApp.Selection.ParagraphFormat.SpaceBefore =float.Parse("0");//段前间距

WApp.Selection.ParagraphFormat.SpaceBeforeAuto =0;//

WApp.Selection.ParagraphFormat.SpaceAfter = float.Parse("0");//段后间距

WApp.Selection.ParagraphFormat.SpaceAfterAuto = 0;//

WApp.Selection.ParagraphFormat.LineSpacingRule = Microsoft.Office.Interop.Word.WdLineSpacing.wdLineSpaceSingle;//单倍行距

WApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphJustify;//段落2端对齐

WApp.Selection.ParagraphFormat.WidowControl = 0;//孤行控制

WApp.Selection.ParagraphFormat.KeepWithNext = 0;//与下段同页

WApp.Selection.ParagraphFormat.KeepTogether = 0;//段中不分页

WApp.Selection.ParagraphFormat.PageBreakBefore = 0;//段前分页

WApp.Selection.ParagraphFormat.NoLineNumber = 0;//取消行号

WApp.Selection.ParagraphFormat.Hyphenation = 1;//取消段字

WApp.Selection.ParagraphFormat.FirstLineIndent = WApp.CentimetersToPoints(float.Parse("0"));//首行缩进

WApp.Selection.ParagraphFormat.OutlineLevel = Microsoft.Office.Interop.Word.WdOutlineLevel.wdOutlineLevelBodyText;

WApp.Selection.ParagraphFormat.CharacterUnitLeftIndent = float.Parse("0");

WApp.Selection.ParagraphFormat.CharacterUnitRightIndent = float.Parse("0");

WApp.Selection.ParagraphFormat.CharacterUnitFirstLineIndent = float.Parse("0");

WApp.Selection.ParagraphFormat.LineUnitBefore = float.Parse("0");

WApp.Selection.ParagraphFormat.LineUnitAfter = float.Parse("0");

WApp.Selection.ParagraphFormat.AutoAdjustRightIndent = 1;

WApp.Selection.ParagraphFormat.DisableLineHeightGrid =0;

WApp.Selection.ParagraphFormat.FarEastLineBreakControl =1;

WApp.Selection.ParagraphFormat.WordWrap = 1;

WApp.Selection.ParagraphFormat.HangingPunctuation = 1;

WApp.Selection.ParagraphFormat.HalfWidthPunctuationOnTopOfLine = 0;

WApp.Selection.ParagraphFormat.AddSpaceBetweenFarEastAndAlpha = 1;

WApp.Selection.ParagraphFormat.AddSpaceBetweenFarEastAndDigit = 1;

WApp.Selection.ParagraphFormat.BaseLineAlignment = Microsoft.Office.Interop.Word.WdBaselineAlignment.wdBaselineAlignAuto;

标签:Vba全面修改Word段落属性有效代码
0
投稿

猜你喜欢

  • Excel PV 函数 使用教程

    2022-02-09 12:26:03
  • windows7扩展屏幕怎么设置?windows7扩展屏幕使用技巧

    2022-03-11 18:04:07
  • Win7系统微软雅黑怎么安装?Win7系统微软雅黑字体的安装方法

    2022-12-22 06:18:56
  • 苹果Mac最好用的FTP客户端:Transmit

    2022-11-23 23:13:50
  • 手机版 WPS 怎么连接打印机

    2023-11-17 05:18:38
  • Win10错误报告怎么关闭?Win10错误报告禁用操作方法

    2023-10-15 02:12:04
  • Win10怎么忘记无线网络密码?Win10忘记无线网络密码的方法

    2023-01-23 07:41:16
  • Win10开启ACDsee蓝屏提示错误代码KERNEL_SECURITY_CHECK_FAILURE的解决方法

    2023-09-25 11:19:09
  • 息屏AOD显示是什么意思?iOS 16有息屏AOD功能吗?

    2023-08-02 04:03:30
  • 会声会影怎么安装、卸载?

    2022-04-12 05:49:00
  • 详解XP至Windows7的升级步骤

    2022-11-23 22:08:48
  • win10声音小怎么办_win10声音小解决方法

    2023-12-21 01:06:50
  • Excel如何将两类数据绘制在同一张图上

    2022-07-11 21:51:25
  • Word如何只打印部分文字?Word只打印部分文字方法

    2023-10-27 18:51:36
  • 生僻字打不出来怎么办?教你一招轻松应对!

    2022-11-04 08:57:44
  • word2007版盖有电子公章的文件编辑吗?怎么编辑?

    2023-09-18 09:21:32
  • excel2007冻结窗格是灰色的.不能用怎么办?

    2023-02-28 16:28:43
  • Win10系统qmdownload文件夹可以删除吗?

    2022-12-31 19:38:05
  • word2013设置拼写检查和语法的方式

    2023-05-10 19:42:06
  • ppt2010幻灯片图片怎么添加艺术效果?

    2022-01-29 09:40:39
  • asp之家 电脑教程 m.aspxhome.com