用户登录
用户注册

分享至

vbword首行缩进

  • 作者: 我陪你相濡以沫怎样
  • 来源: 51数据库
  • 2020-04-21

1.VB首行缩进代码

Private Sub Form_Load()

RichTextBox1.Text = "All text is indented 20 pixels from the left edge of the RichTextBox." & vbCrLf & "You can use this property to provide proper indentation such as when writing a letter." & vbCrLf & "After this paragraph the indent is returned to normal spacing."

'全选文字

RichTextBox1.SelStart = 0

RichTextBox1.SelLength = Len(RichTextBox1.Text)

RichTextBox1.SelIndent = 600 '缩进量

RichTextBox1.SelStart = Len(RichTextBox1.Text) '光标定位到文章最后

End Sub

2.word2007,为什么用VBA设置取消首行缩进,但实际运行后没有效果

测试,首行缩进2个字符,代码为:

Sub 宏2()

'

' 宏2 宏

'

'

With Selection.ParagraphFormat

.LeftIndent = CentimetersToPoints(0)

.RightIndent = CentimetersToPoints(0)

.SpaceBefore = 0

.SpaceBeforeAuto = False

.SpaceAfter = 0

.SpaceAfterAuto = False

.LineSpacingRule = wdLineSpaceSingle

.Alignment = wdAlignParagraphJustify

.WidowControl = False

.KeepWithNext = False

.KeepTogether = False

.PageBreakBefore = False

.NoLineNumber = False

.Hyphenation = True

.FirstLineIndent = CentimetersToPoints(0.35)

.OutlineLevel = wdOutlineLevelBodyText

.CharacterUnitLeftIndent = 0

.CharacterUnitRightIndent = 0

.CharacterUnitFirstLineIndent = 2

.LineUnitBefore = 0

.LineUnitAfter = 0

.MirrorIndents = False

.TextboxTightWrap = wdTightNone

.AutoAdjustRightIndent = True

.DisableLineHeightGrid = False

.FarEastLineBreakControl = True

.WordWrap = True

.HangingPunctuation = True

.HalfWidthPunctuationOnTopOfLine = False

.AddSpaceBetweenFarEastAndAlpha = True

.AddSpaceBetweenFarEastAndDigit = True

.BaseLineAlignment = wdBaselineAlignAuto

End With

End Sub

主要代码貌似是.FirstLineIndent = CentimetersToPoints(0.35),由厘米转为磅,网上介绍和字符的字号有关,但更改字号大小后,录制的缩进2个字符仍然是 以上代码。运行后没有问题。

测试将代码如果只保留.FirstLineIndent = CentimetersToPoints(0.35),删掉其他语句,实际效果就不是想要的结果(字号大时,缩进没有达到2个字符)。

检查发现,以上代码可以简化为:——测试正常

Sub 宏3()

'

' 宏3 宏

'

'

With Selection.ParagraphFormat

.CharacterUnitFirstLineIndent = 2

End With

End Sub

3.Word怎么设置首行缩进2字符

word 2003

1

选择“格式”里的“段落”,如果已经有段落了,可以选中你要首行缩进的段落:

2

再看特殊格式,选择“首行缩进”:

3

再把“度量值”增加到2字符,点击确定:

END

word 2007

在开始栏,选择段落边上的那个小按钮:

同样在特殊格式里选择“首行缩进”:

然后磅值默认是2字符,不用调,点击确定即可:

4

其他版本的也就是找到段落来设置就好了,大同小异。

4.word文档的首行缩进怎么设置

1、本次演示操作的Office办公软件为Word 2013版本。

2、新建Word文档,在文档内输入演示数据,数据用于演示如何在Word文档中设置首行缩进的操作。

3、首先我们选中需要设置首行缩进的数据,点击菜单栏中开始工具,在开始工具栏下找到段落设置,单击打开设置。

4、在段落设置框中,找到缩进特殊格式设置,在特殊格式下选择首行缩进选项。

5、选择首行缩进格式之后,在后面的缩进量设置缩进值,根据需求设置数据,单击确认完成。

6、此时选中的段落就已经设置成了首行缩进的格式了。

5.Word如何设置首行缩进2字符

①首先,选择要缩进的段落,或者直接选中全文;

②选择菜单栏的“格式”中的“段落”,在弹出的段落窗口的“缩进和间距”下面的“特殊格式”中选择“首行缩进”,然后在“度量值”里设置成“2字符”确定即可。

Word2007中首行缩进2字符方法:

①选中全文,然后进入“开始”选项卡,然后点击“段落”选项卡中的小按钮,如下图红色圈;

②然后在“段落”窗口中“特殊格式”中选择“首行缩进”,磅值设为“2字符”即可。

转载请注明出处51数据库 » vbword首行缩进

软件
前端设计
程序设计
Java相关