BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
Does HTML reports recognise page breaks, if yes then how to specify them.
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
Page breaks are not part of the standard HTML specification by the W3C.ORG group. However, there is some support for page-breaks when printing in the CSS 2 specification, as described here:
http://www.w3.org/TR/CSS21/page.html#allowed-page-breaks ,
http://www.w3.org/TR/CSS21/media.html ,
and, simpler, here:
http://www.chami.com/Tips/internet/052898I.html

Remember, however, that not all browsers support the CSS 2 specification. So, even if you use the technique shown on the above web page, it is only a SUGGESTION for the browser -- the browser may ignore the SUGGESTION if it is not fully CSS 2 compliant.

In fact ODS supports this method. In the standard style template (styles.default) that is used with ODS HTML, SAS puts a CSS instruction for the places where it would normally insert a "page break" (which is visible as a horizontal rule):
[pre]
'PageBreakLine' =
"<p style=""page-break-after: always;""><br></p><hr size=""3"">"
[/pre]

Generally this horizontal rule appears between each procedure in your output or between BY groups. However, if you have a BY group of 200 obs, there would be no "internal" horizontal rule or page-break CSS instruction placement. That's because HTML was supposed to be leading us all to the paperless office and there are no page breaks in the paperless office. So you probably do NOT want to mess with the
page-break-after: always CSS instruction.

There is another HTML method (instead of trying to put page breaks into HTML) and that is specifying an alternate file to print. This method requires IE 4 or higher, but in this method, you can have a LINK tag like this:
[pre]
<link rel=alternate media=print href="printversion.pdf">
<link rel=alternate media=print href="printversion.rtf">
[/pre]
There is an ODS example here:
http://support.sas.com/kb/23/469.html

However, when I try to use the LINK tag method, as described above, I only get a single blank page that prints and it has the name of the alternate file at the bottom of the page. So clearly, my browser (IE6) doesn't like either the LINK tag or the relative reference that I used. I'm not sure which.

Another thing to consider would be to explicitly put a LINK on the page (either using ODS HTML TEXT= or using a TITLE statement with a hyperlink) and the link would explicitly load a "printer-friendly" copy of the report. This is illustrated at the bottom of the posting.

cynthia

So the general scenario would be:
[pre]
** Make a print version (PDF or RTF) of the file using ODS;
ods pdf file='c:\temp\printversion.pdf';
...report code with page numbers and possible PDF options...
ods pdf close;

** Option 1 -- explicitly code an ANCHOR tag using ODS HTML TEXT= ;

ods html path='c:\temp' (url=none)
file='htmlversion1.html' style=sasweb;

ods html text='<div><a href="printversion.pdf">Printer Friendly Copy (from TEXT=)</a></div>';

... report code ...

ods html close;

** Option 2: Use LINK= in the TITLE statement;

ods html path='c:\temp' (url=none)
file='htmlversion2.html' style=sasweb;

title j=l h=12pt link='printversion.pdf' "Printer Friendly Version of Report";

... report code ...

ods html close;

[/pre]

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2465 views
  • 0 likes
  • 2 in conversation