I am trying to put a page count in Excell 2000 I have put it in on a by field with a page break but when you print the document it just counts each grouping it doesn't actually count each page.This message has been edited. Last edited by: Kerry,
WebFOCUS 7.6.10 Windows XP all output (Excel, HTML, PDF)
December 15, 2011, 05:16 PM
Waz
Here is a way to add page numbers, and where to set the page breaks in the excel report.
This could be done with a template, but this is self contained.
The first part is to add the page numbers, this is done by adding the field Page_Number to the page somewhere. The second part is to define where the page breaks will happen. This is calculated, and added after the report, but on the same tab as the report. This example is set to a three line heading and looks for a break on CONTINENT, REGION and COUNTRY, as well as if the number of lines goes over 60.
FILEDEF XL_PAGE_NUM DISK c:\temp\xl_page_num.xls
FILEDEF PGE_BRK DISK pge_brk.ftm
-* Write out a master to read the BSB_ACC list
EX -LINES 4 EDAPUT MASTER,PGE_BRK,CV,FILE
FILENAME=PGE_BRK, SUFFIX=FIX,$
SEGNAME=PGE_BRK, $
FIELD=XL_Row ,ALIAS= ,A9,A9,$
-RUN
DEFINE FILE TRADES
-* This adds the page number to the Excel output, check with print preview.
Page_Number/A67 = '<style><!--@page {mso-footer-data:"&|CPage &|P of &|N";}--></style>';
END
SET COMPOUND = OPEN NOBREAK
TABLE FILE TRADES
HEADING
"<Page_Number>Excel Report"
" "
PRINT TRADER_ID
DATE_OF_TRADE
HOLDER
TYPE
BUY_SELL
AMOUNT
COMPUTE Cntr/I9 = IF CONTINENT NE LAST CONTINENT
OR REGION NE LAST REGION
OR COUNTRY NE LAST COUNTRY
THEN 1 ELSE LAST Cntr + 1 ; NOPRINT
COMPUTE Break/I9 = IF IMOD(Cntr-1, 60,'I9') EQ 0 THEN LAST Break + 1 ELSE LAST Break ; NOPRINT
COMPUTE TmpRow/I9 = IF Break NE LAST Break THEN LAST TmpRow + 4 ELSE LAST TmpRow + 1 ;
COMPUTE XL_Row/I9 = IF TmpRow - LAST TmpRow EQ 4 THEN TmpRow - 4 ELSE 0 ;
COMPUTE WrtRow/I9 = IF XL_Row NE 0 THEN PUTDDREC('PGE_BRK',7,LJUST(9,FTOA(XL_Row, '(F9)','A9'),'A9'),9,WrtRow) ELSE 0 ;
BY CONTINENT
BY REGION
BY COUNTRY
BY TOTAL Break PAGE-BREAK
ON TABLE HOLD AS XL_PAGE_NUM FORMAT EXL2K
END
-RUN
SET COMPOUND = CLOSE
-SET &No_Cols = 9 ;
-*This defines the pages in Excel
DEFINE FILE PGE_BRK
Brk_String/A8000V = LAST Brk_String || '<x:RowBreak><x:Row>' || XL_Row || '</x:Row><x:ColEnd>&No_Cols</x:ColEnd></x:RowBreak>' ;
END
TABLE FILE PGE_BRK
SUM
COMPUTE PgrBreaks/A8200 = '<head><!--[if gte mso 9]><xml> <x:WorksheetOptions><x:Print><x:ValidPrinterInfo/>'
|| '<x:Scale>63</x:Scale></x:Print></x:WorksheetOptions>'
|| '<x:PageBreaks>'
|| '<x:RowBreaks>'
|| LST.Brk_String
|| '</x:RowBreaks></x:PageBreaks></xml><![endif]--></head>' ; AS ''
ON TABLE HOLD AS XL_PAGE_NUM FORMAT EXL2K
END
-RUN
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
December 16, 2011, 10:47 AM
RSquared
Please post your code and a picture of what you want the print to look like. I have some code that I used to create a page break and page numbers in Excel2K that I can post if it meets your needs.
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
December 21, 2011, 05:39 PM
Cylon
RSquared,
I havn't had a chance to get to this yet but I would love to see your example. I just want the page numbers at the bottom of the page when the report is printed out on paper. When I tried to do this the page break just ended up at the end of each grouping.
WebFOCUS 7.6.10 Windows XP all output (Excel, HTML, PDF)
December 22, 2011, 09:13 AM
jgelona
Waz, as you suggest, I ususally do stuff like this with a template.
I do have a question about your code. On the FILEDEF of XL_PAGE_NUM, shouldn't there be an APPEND somewhere? Otherwise, won't the second TABLE just overwrite the output from the first TABLE?
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.