S
scottfly
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFormOff.BtnWordClick(Sender: TObject);
var
Bookmark: TBookmark;
RangeW: Word97.Range;
v1: Variant;
ov1: OleVariant;
Row1: Word97.Row;
begin
WordDocument1.Activate;
// insert title
WordDocument1.Range.Text := 'American Capitals from ' + Table1.TableName;
WordDocument1.Range.Font.Size := 14;
// disable the UI
Table1.DisableControls;
try
// store the current position
Bookmark := Table1.GetBookmark;
try
// scan the database table
Table1.First;
while not Table1.EOF do
begin
// send the two fields
WordDocument1.Range.InsertParagraphAfter;
WordDocument1.Paragraphs.Last.Range.Text :=
Table1.FieldByName ('Name').AsString + #9 +
Table1.FieldByName ('Capital').AsString;
Table1.Next;
end;
finally
// go back to the bookmark and destroy it
Table1.GotoBookmark (Bookmark);
Table1.FreeBookmark (Bookmark);
end;
finally
// re-enable the controls
Table1.EnableControls;
end;
RangeW := WordDocument1.Content;
v1 := RangeW;
v1.ConvertToTable (#9, 19, 2);
/////请问ConverttoTable后面3个参数的意思
Row1 := WordDocument1.Tables.Item(1).Rows.Get_First;
Row1.Range.Bold := 1;
Row1.Range.Font.Size := 30;
Row1.Range.InsertParagraphAfter;
ov1 := ' ';
Row1.ConvertToText (ov1);
end;
希望能有高手给说一下后面这个生成表格的过程!
多谢了
var
Bookmark: TBookmark;
RangeW: Word97.Range;
v1: Variant;
ov1: OleVariant;
Row1: Word97.Row;
begin
WordDocument1.Activate;
// insert title
WordDocument1.Range.Text := 'American Capitals from ' + Table1.TableName;
WordDocument1.Range.Font.Size := 14;
// disable the UI
Table1.DisableControls;
try
// store the current position
Bookmark := Table1.GetBookmark;
try
// scan the database table
Table1.First;
while not Table1.EOF do
begin
// send the two fields
WordDocument1.Range.InsertParagraphAfter;
WordDocument1.Paragraphs.Last.Range.Text :=
Table1.FieldByName ('Name').AsString + #9 +
Table1.FieldByName ('Capital').AsString;
Table1.Next;
end;
finally
// go back to the bookmark and destroy it
Table1.GotoBookmark (Bookmark);
Table1.FreeBookmark (Bookmark);
end;
finally
// re-enable the controls
Table1.EnableControls;
end;
RangeW := WordDocument1.Content;
v1 := RangeW;
v1.ConvertToTable (#9, 19, 2);
/////请问ConverttoTable后面3个参数的意思
Row1 := WordDocument1.Tables.Item(1).Rows.Get_First;
Row1.Range.Bold := 1;
Row1.Range.Font.Size := 30;
Row1.Range.InsertParagraphAfter;
ov1 := ' ';
Row1.ConvertToText (ov1);
end;
希望能有高手给说一下后面这个生成表格的过程!
多谢了