我想修改Word文档中的文本样式。 我尝试使用以下语法...也许你有一个想法 在我的代码中需要改变什么...
感谢您的建议
#include <Word.au3>
Func Main()
$utilisateur = @username & @LF
$ordinateur = @ComputerName & @LF
$servicepack = @OSServicePack & @LF
$cpu = @CPUArch & @LF
$ip = @IPAddress1 & @LF
$domaine = @LogonDomain & @LF
$chemin = @HomePath & @LF
Local $word = ObjCreate("Word.Application")
$word.Documents.add
$word.Visible = 1
$word.Selection.TypeText ($utilisateur & $ordinateur & $servicepack & $cpu & $ip & $domaine & $chemin & $word.Selection.wdPropertyAuthor & $word.wdPropertyAppName)
$word.Selection.WholeStory
$word.Selection.style("Titre 1",$word.ActiveDocument.Styles)
With $word.Selection.Font
.Name = "Arial"
.Size = 20
.bold = True
.italic = true
.Alignment = "wdAlignParagraphLeft"
.ColorIndex = 2
EndWith
with $word.Selection.Style
.Styles("Titre 1")
EndWith
;~ FOR IN ( pour manipuler des collections et des tableaux)
sleep(5000)
$word.ActiveDocument.saveas("d:\informations_utilisateur.doc")
$word.Quit(0)
EndFunc
Main()
答案 0 :(得分:0)
最后我找到了解决方案
$word = ObjCreate("Word.Application")
$word.visible=True
$word.Selection.WholeStory
$word.Documents.Add
$word.Selection.TypeText( "november 26 " )
$word.Selection.WholeStory
$word.Selection.Style= "Titre"