//------------------- Initialization --------------------
VaR
Wapp, work: variant;
try
wapp: = getactiveoleobject ( ' word. application ' );
0000t
wapp: = createoleobject ( ' word. application ' );
end ;
//---------------Replacement character--------------------
Wapp. selection. Find. Text:='<% A2 %>';
Wapp. selection. Find. Replacement. Text:=Lb;
Wapp.selection.find.exe cute (replace:=Wdreplaceall );
//----------------------Hide the word menu and toolbar----------------------
IfOC. StateIn[Osuiactive]Then
Begin
OC. oleobjectinterface. QueryInterface (ioleinplaceobject, Ioo );
Ioo. uideactivate;
Ioo:=Nil;
End;
//-----------------Export data based on bookmarks------
Wapp. selection. Goto (what:=Wdgotobookmark, Name:='Zczd'+Inttostr (I ));
Wapp. selection. typetext ('■')
//-------------------Generate a header and footer and write data----------
Wapp. selection. Goto (what: = Wdgotopage, which: = Wdgotonext, Name: = ' Flag ' );
If wapp. activewindow. View. splitspecial <> Wdpanenone then
Wapp. activewindow. panes ( 2 ). Close;
If (wapp. activewindow. activepane. View. Type = Wdnormalview) or (wapp. activewindow. activepane. View. Type = Wdoutlineview) then
Wapp. activewindow. activepane. View. Type: = Wdprintview;
Wapp. activewindow. activepane. View. seekview: = Wdseekcurrentpageheader;
Wapp. selection. paragraphformat. Borders. Item (wdborderleft). linestyle: = Wdlinestylenone;
Wapp. selection. paragraphformat. Borders. Item (wdborderright). linestyle: = Wdlinestylenone;
Wapp. selection. paragraphformat. Borders. Item (wdbordertop). linestyle: = Wdlinestylenone;
Wapp. selection. paragraphformat. Borders. Item (wdborderbottom). linestyle: = Wdlinestylenone;
Wapp. activewindow. activepane. View. seekview: = Wdseekcurrentpagefooter;
Wapp. selection. paragraphformat. Alignment: = Wdalignparagraphright;
If (DM. xm_ds.fieldbyname ( ' Tg_flag ' ). Asinteger = 2 ) And (DM. xm_ds.fieldbyname ( ' Tj_flag ' ). Asinteger = 0 ) Then
Wapp. selection. typetext (text: = ' Combine the 'ge' to the 'service 'book ' )
Else
Wapp. selection. typetext (text: = ' Unqualified task book ' );
Wapp. activewindow. activepane. View. seekview: = Wdseekmaindocument;