Home > Back-end >  Delphi export WORD, how to display 'X pages in the footer first page Y"
Delphi export WORD, how to display 'X pages in the footer first page Y"

Time:09-27

Delphi export WORD, how to display "X pages in the footer first page Y", I record macro, but cannot run code in Delphi,
Kindly understand the help, thanks.

CodePudding user response:

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- to generate the header, footer and write data -- -- -- -- -- -- -- -- -- -- 

WApp. Selection. GoTo (credit:=wdGoToPage, Which:=wdGoToNext, Name:='FLAG');
If wApp. ActiveWindow. The SplitSpecial & lt;> WdPaneNone Then
WApp. ActiveWindow. Panes (2). The Close;
If (wApp. ActiveWindow. ActivePane. View. Type=wdNormalView) Or (wApp. ActiveWindow. ActivePane. The Type=wdOutlineView) Then
WApp. ActiveWindow. ActivePane. View. Type:=wdPrintView;
WApp. ActiveWindow. ActivePane. View. SeekView:=wdSeekCurrentPageHeader;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderLeft). Graphics.linestyle:=wdLineStyleNone;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderRight). Graphics.linestyle:=wdLineStyleNone;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderTop). Graphics.linestyle:=wdLineStyleNone;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderBottom). Graphics.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:='us ` ren ` ` grid services ` books')
The else
WApp. Selection. TypeText (Text:='unqualified specification');
WApp. ActiveWindow. ActivePane. View. SeekView:=wdSeekMainDocument;

CodePudding user response:

reference 1st floor lyhoo163 response:
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- header, footer and write data -- -- -- -- -- -- -- -- -- -- 

WApp. Selection. GoTo (credit:=wdGoToPage, Which:=wdGoToNext, Name:='FLAG');
If wApp. ActiveWindow. The SplitSpecial & lt;> WdPaneNone Then
WApp. ActiveWindow. Panes (2). The Close;
If (wApp. ActiveWindow. ActivePane. View. Type=wdNormalView) Or (wApp. ActiveWindow. ActivePane. The Type=wdOutlineView) Then
WApp. ActiveWindow. ActivePane. View. Type:=wdPrintView;
WApp. ActiveWindow. ActivePane. View. SeekView:=wdSeekCurrentPageHeader;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderLeft). Graphics.linestyle:=wdLineStyleNone;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderRight). Graphics.linestyle:=wdLineStyleNone;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderTop). Graphics.linestyle:=wdLineStyleNone;
WApp. Selection. ParagraphFormat. Borders. Item (wdBorderBottom). Graphics.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:='us ` ren ` ` grid services ` books')
The else
WApp. Selection. TypeText (Text:='unqualified specification');
WApp. ActiveWindow. ActivePane. View. SeekView:=wdSeekMainDocument;


Header, footer, this good, I recorded macro is
Oword. NormalTemplate. AutoTextEntries (" the first X, Y pages "). The Insert (Where:=oword. Selection. Range, RichText:=True)
The bureau of Delphi again how to write,
  • Related