delphi 10.2在单词表后添加段落-

时间:2018-06-29 07:58:25

标签: delphi ms-word

1。我正在从delphi Xe 10.2创建word文档。首先,我插入一张桌子。在表格之后,下一段进入第一个表格的单元格内。如何退出表格并在表格下方添加新行

MSWord.Selection.Font.Size := 11;
MSWord.Selection.Font.name :='Bookman Old Style';
Table := MSWord.ActiveDocument.Tables.Add( Range:= MSWord.Selection.Range, 
NumRows:=1, NumColumns:= 3, DefaultTableBehavior:= wdWord9TableBehavior);
Cell := Table.Cell(1, 1);
Range := Cell.Range;
Range.Select;
MSWord.Selection.ParagraphFormat.Alignment :=wdAlignParagraphCenter;
S :='A. No. VIII/48/94/2018- ';
MSWord.Selection.TypeText(Text := S);

Cell := Table.Cell(1, 3);
Range := Cell.Range;
Range.Select;
MSWord.Selection.ParagraphFormat.Alignment :=wdAlignParagraphCenter;
S :='Dated:';
MSWord.Selection.TypeText(Text := S);

MSWord.Selection.TypeText('PART-A OF THE REPORT ');
Range:= MSWord.Selection.Range;
MSWord.Selection.ParagraphFormat.Alignment := wdAlignParagraphCenter;}

1 个答案:

答案 0 :(得分:1)

(我想您之前没有在其他问题上读过我对查询的评论,在那儿我自己解释了如何解决这个问题)

只需在您的代码之后立即添加以下代码:

  MSWord.Selection.EndKey( Unit:=wdStory );
  MSWord.Selection.ParagraphFormat.Alignment := wdAlignParagraphJustify;
  MSWord.Selection.TypeText('After table');

实际上是从表中移出的EndKey