如何利用C#实现word段落首行缩进1.5厘米

您能再说的详细点吗?
2024-12-16 03:06:59
推荐回答(3个)
回答1:

1,连接word就不说了
2,dim wAd As Microsoft.Office.Interop.Word.Document
With wAd.Styles(jieName).ParagraphFormat
.LeftIndent = wAd.Application.CentimetersToPoints(0)'整行缩进0个字符
.FirstLineIndent = wAd.Application.CentimetersToPoints(0.35)'首行缩进0.35个字符
.OutlineLevel = Microsoft.Office.Interop.Word.WdOutlineLevel.wdOutlineLevel1
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 2‘带编号,首行缩进2个字符
.LineUnitBefore = 0
.LineUnitAfter = 0
.MirrorIndents = False
.TextboxTightWrap = Microsoft.Office.Interop.Word.WdTextboxTightWrap.wdTightNone
.AutoAdjustRightIndent = True
.DisableLineHeightGrid = False
.FarEastLineBreakControl = True
.WordWrap = True
.HangingPunctuation = True
.HalfWidthPunctuationOnTopOfLine = False
.AddSpaceBetweenFarEastAndAlpha = True
.AddSpaceBetweenFarEastAndDigit = True
.BaseLineAlignment =Microsoft.Office.Interop.Word.WdBaselineAlignment.wdBaselineAlignAuto
End With

3,剩下自己摸索吧,呵呵。

回答2:

段落前你可以加4个英文空格
或者你可以你在WORD里的操作顺序,根据开头缩写字母在程序里找代码,你试试这样你以后可以解决很多问题

回答3:

引用Spire.Doc.dll来实现就可以,参考教程:C# 设置Word文档段落缩进