sp; if FontUnderline then FWord.Selection.Font.Underline := wdUnderlineSingle; except SetFont(FontName, FontSize, FontBold, FontUnderline); end; end; //插入表格 function TMyWord.AddTable(Col, Row: Integer): Table; var DefaultTable: olevariant; begin try //connectword(); DefaultTable := 1; Result := FDoc.Tables.Add(FWord.Selection.Range, Row, Col, DefaultTable, EmptyParam); except ShowMessage(Format(''列%d,行%d'', [Col, Row])); AddTable(Col, Row); end; end; //设置背景色 procedure TMyWord.SetTableBack(BackColor: ToleEnum); begin try //connectword(); FWord.Selection.Cells.Shading.BackgroundPatternColor := BackColor; except SetTableBack(BackColor); end; end; //选择下移 procedure TMyWord.SelectDown(num: Integer = 1); var Unit_: olevariant; Count: olevariant; Extend: olevariant; begin try //connectword(); Count := num; Unit_ := wdLine; Extend := wdExtend; FWord.Selection.MoveDown(Unit_, Count, Extend); except MoveDown(); end; end; //鼠标下移 procedure TMyWord.MoveDown(num: Integer = 1); var Unit_: olevariant; Count: olevariant; Extend: olevariant; begin try //connectword(); Count := num; Unit_ := wdLine; FWord.Selection.MoveDown(Unit_, Count, Extend); except MoveDown(); end; end; //鼠标上移 procedure TMyWord.Moveup(); var Unit_: olevariant; Count: olevariant; Extend: olevariant; begin Unit_ := wdLine; Count := 1; FWord.Selection.Moveup(Unit_, Count, Extend); end; //选择右移 procedure TMyWord.SelectRight(num: Integer = 1); var Unit_: olevariant; Count: olevariant; Extend: olevariant; begin try //connectword(); Unit_ := wdCharacter; &nbs