The Most Requested Features and Techniques for Stylesheets Renee Teatro Information Builders Copyright 2007, Information Builders. Slide 1 The Stylesheet Facility – Features and Techniques LINEBREAK Attribute: TYPE=REPORT,LINEBREAK='type',$ WebFOCUS Release 7.1.3 Respect CARRIAGE RETURNs (CR) and LINE FEEDs (LF) ALPHANUMERIC fields – both An and AnV formats REPORT is the type of report component. TYPE must be REPORT; otherwise an error will result. 'type‘ specifies that line breaks will be inserted in a report based on the following: LF Inserts a line break after each line-feed character found in all An and AnV fields. CR Inserts a line break after each carriage-return character found in all An and AnV fields. LFCR Inserts a line break after each combination of a line-feed character followed by a carriage-return character found in all An and AnV fields. CRLF Inserts a line break after each combination of a carriage-return character followed by a line-feed character found in all An and AnV fields. If An/AnV fields are included in HEADINGs (SUBHEADs, SUBFOOTs), WRAP=n attribute must be included in the Stylesheet syntax for these fields to make the LINEBREAK attribute effective. Copyright 2007, Information Builders. Slide 2 The Stylesheet Facility – Features and Techniques LINEBREAK Attribute: TYPE=REPORT,LINEBREAK='type',$ DEFINE FILE CAR CR/A1 = HEXBYT(13, 'A1'); LF/A1 = HEXBYT(10, 'A1'); CRLF/A2 = CR || LF; ABC1/A5 = EDIT (COUNTRY, '99999'); ABC2/A10 = EDIT (COUNTRY, '$$$$$9999999999'); ABC3/A30 = ABC1 || CRLF || ABC2; ABC4/A30V = ABC1 || CRLF || ABC2; END TABLE FILE CAR PRINT ABC3 ABC4 ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * TYPE=REPORT,LINEBREAK='CRLF',$ ENDSTYLE END Works for PDF and EXL2K What about HTML? Copyright 2007, Information Builders. Slide 3 The Stylesheet Facility – Features and Techniques LINEBREAK Attribute: TYPE=REPORT,LINEBREAK='type',$ … <TABLE BORDER CELLPADDING=1> <TR> <TD COLSPAN=2> <TABLE CELLPADDING=0 WIDTH="100%"><TR> <TD> PAGE 1</TD></TR></TABLE></TD> </TR> <TR> <TD VALIGN=BOTTOM> ABC3</TD> <TD VALIGN=BOTTOM> ABC4</TD> </TR> <TR> <TD> ENGLA ND</TD> <TD> ENGLA ND</TD> </TR> <TR> <TD> JAPAN </TD> <TD> JAPAN </TD> </TR> <TR> <TD> ITALY </TD> <TD> ITALY </TD> </TR> <TR> <TD> W GER MANY</TD> … Copyright 2007, Information Builders. Slide 4 The Stylesheet Facility – Features and Techniques LINEBREAK Attribute: TYPE=REPORT,LINEBREAK='type',$ DEFINE FILE CAR CR/A1 = HEXBYT(13, 'A1'); LF/A1 = HEXBYT(10, 'A1'); CRLF/A2 = CR || LF; ABC1/A5 = EDIT (COUNTRY, '99999'); ABC2/A10 = EDIT (COUNTRY, '$$$$$9999999999'); ABC3/A30 = ABC1 || CRLF || ABC2; ABC3A/A32=STRREP(32,ABC3,2,CRLF,4,'<BR>',32,'A32'); ABC4/A30V = ABC1 || CRLF || ABC2; ABC4A/A32V=STRREP(32,ABC4,2,CRLF,4,'<BR>',32,'A32V'); END TABLE FILE CAR PRINT ABC3A ABC4A ON TABLE PCHOLD FORMAT HTML END Use Global Replacement of CRLF with <BR> or Use <PRE> tag at beginning and </PRE> at end of field Copyright 2007, Information Builders. Slide 5 The Stylesheet Facility – Features and Techniques Conditional Styling – WHEN Attribute TABLE FILE CAR PRINT COUNTRY CAR SEATS ON TABLE SET STYLE * DEFMACRO=COND1,STYLE=BOLD,COLOR=BLUE, WHEN=SEATS LT 4,$ DEFMACRO=COND2,COLOR=RED,WHEN=SEATS EQ 5,$ TYPE=DATA,MACRO=COND1,COLUMN=SEATS,$ TYPE=DATA,MACRO=COND2,COLUMN=SEATS,STYLE=ITALIC,$ ENDSTYLE END Copyright 2007, Information Builders. Slide 6 The Stylesheet Facility – Features and Techniques Sequential Conditional Styling – WHEN Attribute TABLE FILE CAR " SALES REVENUE " SUM COUNTRY CAR BY HIGHEST SALES ON TABLE SET STYLE * TYPE=DATA,BACKCOLOR=AQUA,STYLE=BOLD, WHEN=SALES GT 25000,$ TYPE=DATA,BACKCOLOR=GREEN,STYLE=BOLD, WHEN=SALES GT 10000,$ TYPE=DATA,BACKCOLOR=PINK,STYLE=BOLD, WHEN=SALES GT 1,$ TYPE=DATA,BACKCOLOR=RED,STYLE=BOLD,$ END Copyright 2007, Information Builders. Slide 7 The Stylesheet Facility – Features and Techniques Alternate Row Colors – BACKCOLOR Attribute TABLE FILE CAR PRINT CAR MODEL SEATS BY COUNTRY WHERE COUNTRY EQ 'ENGLAND' OR 'ITALY' ON TABLE SET STYLE * TYPE=DATA, BACKCOLOR=('AQUA' 'WHITE'),$ ENDSTYLE END Copyright 2007, Information Builders. Slide 8 The Stylesheet Facility – Features and Techniques Alternate Row Colors – BACKCOLOR Attribute TABLE FILE CAR PRINT RCOST DCOST SEATS BY COUNTRY BY CAR BY MODEL ON TABLE SET STYLE * TYPE=DATA, BACKCOLOR=(BY=COUNTRY 'AQUA' 'WHITE' 'RED'),$ ENDSTYLE END Copyright 2007, Information Builders. Slide 9 The Stylesheet Facility – Features and Techniques SKIPLINE Attribute – PDF Format TABLE FILE CAR PRINT DEALER_COST RETAIL_COST BY COUNTRY SKIP-LINE BY CAR BY MODEL ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * TYPE=SKIPLINE,BACKCOLOR=RED,$ ENDSTYLE END Designed for styling only – Not to generate line Works for PDF What about EXL2K and HTML? Copyright 2007, Information Builders. Slide 10 The Stylesheet Facility – Features and Techniques SKIPLINE Attribute – Generate effect for EXL2K / HTML TABLE FILE CAR PRINT DEALER_COST RETAIL_COST BY COUNTRY SUBFOOT " " BY CAR BY MODEL ON TABLE PCHOLD FORMAT EXL2K ON TABLE SET STYLE * TYPE=SUBFOOT,BACKCOLOR=RED,$ ENDSTYLE END Use ON sortfield SUBFOOT syntax to generate line Use TYPE=SUBFOOT for styling Works for both EXL2K and HTML Copyright 2007, Information Builders. Slide 11 The Stylesheet Facility – Features and Techniques TITLETEXT Attribute: TYPE=REPORT,TITLETEXT=txt,$ TABLE FILE CAR SUM RCOST DCOST BY COUNTRY BY CAR BY MODEL ON TABLE PCHOLD FORMAT EXL2K ON TABLE SET STYLE * TYPE=REPORT,FONT=COURIER NEW, TITLETEXT='Car Sales Report',$ ENDSTYLE END Excel limits the length of worksheet titles to 31 characters. The following special characters cannot be used: ':', '?', '*', and '/'. What happens with HTML? Copyright 2007, Information Builders. Slide 12 The Stylesheet Facility – Features and Techniques TITLETEXT Attribute: TYPE=REPORT,TITLETEXT=txt,$ TABLE FILE CAR SUM RCOST DCOST BY COUNTRY BY CAR BY MODEL ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * TYPE=REPORT,FONT=COURIER NEW, TITLETEXT='Car Sales Report',$ ENDSTYLE END Using HTML allows the Browser Title to be customized Feature not applicable to PDF Copyright 2007, Information Builders. Slide 13 The Stylesheet Facility – Features and Techniques - (Dash) Option – Remove one attribute while retaining another TABLE FILE CAR PRINT 'CAR.ORIGIN.COUNTRY' 'CAR.COMP.CAR' 'CAR.CARREC.MODEL' ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ TYPE=TITLE, STYLE=BOLD, $ TYPE=TITLE, STYLE=-UNDERLINE, WHEN=1 EQ 1, $ ENDSTYLE END Copyright 2007, Information Builders. Slide 14 The Stylesheet Facility – Features and Techniques Conditional Display of SUBHEADs and SUBFOOTs TABLE FILE CAR SUM SALES BY COUNTRY ON COUNTRY SUBHEAD "This is my Subhead Text" WHEN SALES GT 30000 ON COUNTRY PAGE-BREAK ON TABLE SET STYLE * TYPE=SUBHEAD,BACKCOLOR=YELLOW,STYLE=BOLD,$ ENDSTYLE END Copyright 2007, Information Builders. Slide 15 The Stylesheet Facility – Features and Techniques Conditional Display of HEADINGs and FOOTINGs TABLE FILE CAR SUM SALES BY COUNTRY ON COUNTRY PAGE-BREAK FOOTING " Here is my Page Footing text -> Need More Sales" ON TABLE SET STYLE * TYPE=FOOTING,COLOR=WHITE, WHEN=SALES GT 30000,$ ENDSTYLE END Copyright 2007, Information Builders. Slide 16 The Stylesheet Facility – Features and Techniques Conditional Style of COLUMN-TOTAL value TABLE FILE CAR SUM RCOST DCOST BY COUNTRY BY CAR ON TABLE COLUMN-TOTAL ON TABLE ROW-TOTAL ON TABLE SET ONLINE-FMT HTML ON TABLE SET STYLE * TYPE=TITLE,COLUMN=ROWTOTAL,BACKCOLOR=YELLOW,$ TYPE=DATA,COLUMN=ROWTOTAL,BACKCOLOR=WHITE,COLOR=BLUE,$ TYPE=GRANDTOTAL,COLOR=GREEN,STYLE=ITALIC,$ TYPE=GRANDTOTAL,COLUMN=DCOST,COLOR=PINK,STYLE=-ITALIC,FONT=COURIER,$ TYPE=GRANDTOTAL,COLUMN=RCOST,COLOR=RED,STYLE=BOLD, WHEN=RCOST GT 150000,$ ENDSTYLE END Copyright 2007, Information Builders. Slide 17 The Stylesheet Facility – Features and Techniques Styling ROW-TOTAL TITLE when using ACROSS TABLE FILE CAR SUM DEALER_COST AS 'DC‘ RETAIL_COST AS 'RC' BY CAR ACROSS SEATS ON TABLE SET PAGE-NUM OFF ON TABLE ROW-TOTAL AS 'RTOTAL' ON TABLE COLUMN-TOTAL AS 'CTOTAL' ON TABLE SET ONLINE-FMT HTML ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, FONT='ARIAL', SIZE=9, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, RIGHTGAP=0.125000, TOPGAP=0.013889, BOTTOMGAP=0.027778, $ TYPE=TABHEADING, SIZE=12, STYLE=BOLD, $ TYPE=HEADING, SIZE=12, STYLE=BOLD, $ TYPE=SUBHEAD, SIZE=10, STYLE=BOLD, $ TYPE=SUBTOTAL, BACKCOLOR=RGB(210 210 210), $ TYPE=ACROSSVALUE, COLUMN=ROWTOTAL, COLOR='RED', BACKCOLOR=RGB(210 210 210), TOPGAP=0.013889, BOTTOMGAP=0.027778, $ TYPE=GRANDTOTAL, BACKCOLOR=RGB(210 210 210), STYLE=BOLD, $ ENDSTYLE END Copyright 2007, Information Builders. Slide 18 The Stylesheet Facility – Features and Techniques Vertical Line Between Columns TABLE FILE CAR PRINT COUNTRY CAR MODEL WHERE COUNTRY EQ 'JAPAN' OR 'FRANCE' ON TABLE SET STYLE * TYPE=DATA, COLUMN=N1, BORDER-LEFT=OFF,$ TYPE=DATA, COLUMN=N2, BORDER-LEFT=ON,$ TYPE=DATA, COLUMN=N3, BORDER-LEFT=ON,$ ENDSTYLE ON TABLE PCHOLD FORMAT PDF END Copyright 2007, Information Builders. Slide 19 The Stylesheet Facility – Features and Techniques IMAGE and TEXT on Same Line in HEADING for PDF TABLE FILE CAR HEADING "<+0> <+20> Car Report </2" SUM RCOST DCOST BY COUNTRY ON TABLE SET ONLINE-FMT PDF ON TABLE SET STYLE * TYPE=HEADING, IMAGE=C:\ibi\WebFOCUS71\ibi_html\ib_logo.gif, SIZE=(.8 .3),$ TYPE=HEADING,LINE=1,ITEM=2,OBJECT=TEXT, JUSTIFY=RIGHT,$ ENDSTYLE END Copyright 2007, Information Builders. Slide 20 The Stylesheet Facility – Features and Techniques Vertical Text Technique – Using PDF DEFINE FILE CAR HCNTR/I2 WITH CAR=IF HCNTR LT 5 THEN HCNTR + 1 ELSE 1; VCNTR/I2 WITH CAR=IF HCNTR EQ 1 THEN VCNTR + 1 ELSE VCNTR; BLANK/A1 WITH CAR=' '; END TABLE FILE CAR SUM BLANK AS '' COUNTRY AS '' MODEL AS '' CAR AS '' BY VCNTR NOPRINT ACROSS HCNTR NOPRINT ON TABLE NOTOTAL ON TABLE SET PAGE-NUM OFF ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * UNITS=IN,PAGESIZE='LETTER', LEFTMARGIN=0.250000,RIGHTMARGIN=0.250000, TOPMARGIN=0.250000,BOTTOMMARGIN=0.250000,SQUEEZE=ON, ORIENTATION=PORTRAIT,$ TYPE=REPORT,FONT='TIMES NEW ROMAN',SIZE=10,COLOR='BLACK', BACKCOLOR=NONE, STYLE=NORMAL,$ TYPE=DATA,ACROSSCOLUMN=N2, SIZE=9,$ TYPE=TITLE,ACROSSCOLUMN=N2,SIZE=9,$ TYPE=REPORT,ACROSSCOLUMN=N2, WRAP=0.015000,$ TYPE=DATA,ACROSSCOLUMN=N3, SIZE=9,$ TYPE=TITLE,ACROSSCOLUMN=N3,SIZE=9,$ TYPE=REPORT,ACROSSCOLUMN=N3, WRAP=0.015000,$ TYPE=DATA,ACROSSCOLUMN=N4, SIZE=9,$ TYPE=TITLE,ACROSSCOLUMN=N4,SIZE=9,$ TYPE=REPORT,ACROSSCOLUMN=N4, WRAP=0.015000,$ TYPE=ACROSSVALUE,JUSTIFY=RIGHT,$ ENDSTYLE END Copyright 2007, Information Builders. Slide 21 The Stylesheet Facility – Features and Techniques Vertical Text Technique – Using PDF – Simplified Example TABLE FILE CAR SUM RCOST AS '' DCOST AS '' BY COUNTRY AS '' ON TABLE NOTOTAL ON TABLE SET PAGE-NUM OFF ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * UNITS=IN,PAGESIZE='LETTER', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT,$ TYPE=REPORT,FONT='TIMES NEW ROMAN', SIZE=10,COLOR='BLACK', BACKCOLOR=NONE,STYLE=NORMAL,$ TYPE=REPORT,COLUMN=COUNTRY,WRAP=0.015000, STYLE=BOLD,$ ENDSTYLE What about HTML and EXL2K? END Copyright 2007, Information Builders. Slide 22 The Stylesheet Facility – Features and Techniques Vertical Text Technique – Using HTML TABLE FILE CAR PRINT CAR BY COUNTRY BY MODEL ON TABLE SET STYLE * TYPE=REPORT,CSSURL=vtext.css,$ TYPE=TITLE,CLASS=VTEXT,$ TYPE=DATA,CLASS=DCOLOR,$ ENDSTYLE END vtext.css: .DCOLOR {color:red; border:none} .VTEXT{ writing-mode: tb-rl; filter: flipV flipH; font: bold 13px Arial; } For EXL2K – Use EXCEL Template Feature Orientation option in EXCEL Copyright 2007, Information Builders. Slide 23 The Stylesheet Facility – Features and Techniques Cascading Stylesheets A simple language to add styling to HTML documents A W3C standard (World Wide Web consortium) Separates Structural content of a document (HTML) from styling instruction (CSS) CSS consists of one or more rules – Statements Statement Selector – tells the browser which elements to style Declaration – tells the browser how to apply them Copyright 2007, Information Builders. Slide 24 The Stylesheet Facility – Features and Techniques Cascading Stylesheets Benefits Increased formatting options Styling elements outside the scope of the WebFOCUS Stylesheet facility Reduced transmission bandwidth Create concise HTML output, reducing overhead to the browser Reduced Coding Ease of maintenance using a centralized CSS library Adherence to standards Same look and feel for all Web documents Copyright 2007, Information Builders. Slide 25 The Stylesheet Facility – Features and Techniques Cascading Stylesheets Types of Cascading Style Sheets Internal Styling instructions are stored internally in the <head.> of the HTML document Browser interprets these instructions External Separate files accessible to the browser Inline Stored within the tag of an HTML element, or within the <head> of the document Combine both content and style Not recommended – but supported Used when certain elements should not be overridden Copyright 2007, Information Builders. Slide 26 The Stylesheet Facility – Features and Techniques Cascading Stylesheets Using CSS Internal SET HTMLCSS = ON/OFF ON TABLE SET HTMLCSS = ON/OFF External CSSURL=location/address TYPE=REPORT,CSSURL=vtext.css,$ $ Located in MRE Other Files TYPE=REPORT, CSSURL=\\ssg\ServerPaths\apps\Renee\vtext.css,$ $ Located in Application Directory for Adhoc reporting Copyright 2007, Information Builders. Slide 27 The Stylesheet Facility – Features and Techniques Labels Technique PAGEMATRIX=(c r) Sets the number of columns and rows of labels on a page. ELEMENT=(w h) Sets the width and height of each label, expressed in the unit of measurement on the UNITS attribute. GUTTER=(h v) Sets the horizontal and vertical distance between each label, expressed in the unit of measurement on the UNITS attribute. MATRIXORDER={VERTICAL | HORIZONTAL} Sets the order in which the labels are printed. LABELPROMPT={OFF | ON } Sets the position of the first label on the mailing label sheet. Copyright 2007, Information Builders. Slide 28 The Stylesheet Facility – Features and Techniques Labels Technique TABLE FILE CAR PRINT CAR AS '' BY CAR NOPRINT ON TABLE SET PAGE-NUM NOPAGE ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * UNITS=IN, PAGESIZE=LETTER, LEFTMARGIN=0.25, TOPMARGIN=0.5, PAGEMATRIX=(2 5), ELEMENT=(1.50 .50) GUTTER=(0.188 9), $ ENDSTYLE END Copyright 2007, Information Builders. Slide 29 The Stylesheet Facility – Features and Techniques Labels Technique TABLE FILE CAR PRINT CAR AS '' BY CAR NOPRINT ON TABLE SET PAGE-NUM NOPAGE ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * UNITS=IN, PAGESIZE=LETTER, LEFTMARGIN=0.25, TOPMARGIN=0.5, PAGEMATRIX=(3 4), ELEMENT=(1.50 .50) GUTTER=(0.188 9), $ ENDSTYLE END Copyright 2007, Information Builders. Slide 30 The Stylesheet Facility – Features and Techniques Labels Technique SET ONLINE-FMT = PDF TABLE FILE EMPLOYEE BY LAST_NAME NOPRINT BY FIRST_NAME NOPRINT ON FIRST_NAME PAGE-BREAK HEADING "<FIRST_NAME <LAST_NAME" "<ADDRESS_LN1" "<ADDRESS_LN2" "<ADDRESS_LN3" ON TABLE SET PAGE-NUM NOPAGE ON TABLE SET STYLE * UNITS=IN, PAGESIZE=LETTER, LEFTMARGIN=0.256, TOPMARGIN=0.5, PAGEMATRIX=(2 5), ELEMENT=(4 1), GUTTER=(0.188 0), $ ENDSTYLE END Copyright 2007, Information Builders. Slide 31 32 Copyright 2007, Information Builders. Slide 32 Copyright © 2004 Information Builders, Inc.