procedure TForm1.Button1Click(Sender: TObject);
var
Template, NewTemplate,DocType,Docvisible : OleVariant;
DocUnit, DocCount, DocExtend : OleVariant;
DefaultListBehavior : OleVariant;
begin
WordApp.Connect;
WordApp.Visible := True;
Template := EmptyParam;
NewTemplate := EmptyParam;
DocType := EmptyParam;
DocVisible := EmptyParam;
DocUnit := EmptyParam;
DocCount := EmptyParam;
DocExtend := EmptyParam;
WordDoc.ConnectTo(WordApp.Documents.Add(Template,NewTemplate,DocType,DocVisible));
WordApp.Selection.Text := '第一层';
WordApp.Selection.Range.ListFormat.ApplyNumberDefaultOld; // 应用自动编号
WordApp.Selection.Paragraphs.OutlineLevel := wdOutlineLevel1;
WordApp.Selection.MoveRight(DocUnit, DocCount, DocExtend);
WordApp.Selection.TypeParagraph;
WordApp.Selection.Text := '第二层';
WordApp.Selection.Paragraphs.OutlineLevel := wdOutlineLevel2;
WordApp.Selection.MoveRight(DocUnit, DocCount, DocExtend);
WordApp.Selection.TypeParagraph;
WordApp.Selection.Text := '第三层';
WordApp.Selection.Range.ListFormat.ApplyNumberDefaultOld; // 去掉自动编号
WordApp.Selection.Paragraphs.OutlineLevel := wdOutlineLevel3;
end;