I'll apologize in advance for the length of this post, but it's mostly just a sample program, so I hope that's allright.
I need to produce tables with a very specific set of attributes to keep
the brand people happy. The specs I'm having trouble with concern
thickness of borders, and are as follows:
1) thick (3px) vertical borders between the columns and on the right of the
2) thick horizontal borders between column header and rest of table and on
the bottom of the table
3) thin (1px) horizontal borders between the rows
4) no border at all on top of the table (horizontally), and and on the
left of the table (vertically).
I've made a style sheet with proc template that works fine for the HTML
destination (in IE8 and Firefox 3.5), but does not work for the PDF or RTF
destinations. Specifically, for RTF, all the rules are the same width
(looks to be 1px). For PDF, all rules are thick except the bottom
horizontal rule, which is thin, plus I've got a thick rule on the top and
the left which shouldn't be there at all.
Are there any style gurus who might point me in the right direction to
produce a table that meets the specs in all 3 destination? I have included
a sample program which should run as is, in Sas Win (XP) 9.2 (TS2M0).
Thanks in advance.
* * * * Sample program starts here * * * *;
define style Styles.KKtest;
parent = styles.printer;
Here's the thing....HTML=browser; RTF=word processor; PDF=portable document file (sort of printer-image)...all different in concept. And sadly, the borderwidths are internally generated differently for each of them.
For ODS HTML, your style template is converted to CSS style properties and the CSS is embedded in the HTML file as an in-line style section. This is an inherently different method of drawing borders than what is used by ODS RTF and ODS PDF. If you think of a word processor, the border lines are controlled by word processor methods and you might not be able, in RTF control strings to generate the full range of border types/lines/thicknesses as you can in HTML. For another thing, the HTML measurements are generally in pixels, while for RTF, all the measurements are internally converted to TWIPS (twentieths of a printer's point) -- so 1 px in HTML might not translate to -exactly- the same thing in TWIPS when the word processor gets done rendering the RTF; and the PDF file is meant to be an image of what would get sent to a printer -- only in a file format. Printers don't measure in pixels, they generally measure in PT (points).
So right away, you're going to have issues coming up with 1 template to rule them all. I think your best bet is to work with Tech Support because you'll need to come up with 3 separate style templates, one for each destination. Impacting how you write your style templates will be whether you are using SAS 9.1.3 or SAS 9.2, as the syntax will be different for these 2 versions of SAS. Also impacting your template will be whether you can use the bordertopxxx/borderbottomxxx/borderrightxxx type attributes for all your destinations.
I generally find that only the simplest of templates will work in all 3 destinations and by simple I mean that I'm changing the header colors or something. Generally, I find it better to draft a template specific to a destination because of the differences mentioned above.
Tech Support will be your best resource for this question, in my opinion.
Cynthia, a concise and erudite reply, from someone whose writings have consistently increased my knowledge of ODS. I am most grateful. You clearly recognized that I am most comfortable in the XHTML/CSS world, where my template works fine. May I ask one follow-up?
I'm using 9.2, and my reading of the ODS manual has convinced me that the borderXXXwidth attribute (where XXX=top, bottom, right, left) should work in HTML, RTF and PDF. Given that my template works just fine in HTML (and, I would add, when I send my HTML doc through adobe acrobat to convert to PDF, it also looks fine), I might just need to play around with the units of measurement (pixels, points, ems or whatever) and the thicknesses of the lines. Does that seem reasonable, or do you think my logic needs to be fundamentally adjusted, depending on output destination?
I will take you advice and work with Tech Support. Some of us guys just have a hard time asking for directions :-)
Now the time has come, (the walrus said) to speak of many things, of sailing ships and sealing wax and cabbages and kings...( sorry, I couldn't resist. I'm a big fan of Alice in Wonderland and Lewis Carroll).
So, your time has come to bond with that documentation information. So the answer to your question is yes...and no. You can probably come up with separate RTF and HTML and PDF templates and fiddle with borderxxxwidth to get what you want in those destinations -- as far as borderxxxWIDTH is concerned.
If you look up your attributes of interest, as for example, BorderBottomWidth, you will find this in the doc:
specifies the width of the bottom border of the table.
Restriction: The BORDERBOTTOMWIDTH= attribute is valid only in markup family destinations, RTF destination, printer family destinations, and the Measured RTF destination.
whereas, for a different attribute, it says:
specifies the line style of the bottom border of the specified cell.
.... more documentation ....
Restriction: The BORDERBOTTOMSTYLE= attribute is valid only in markup family destinations, RTF destination, and the Measured RTF destination.
Note, that BorderBottomWidth is supported in HTML, RTF and PDF, but that BorderBottomStyle is only supported in HTML (markup family) and RTF.
The YES is that you can probably come close to what you want in the 3 separate destinations by fiddling with width dimensions for those destinations where your attribute of choice is supported. The NO is that an attribute like BorderBottomStyle won't work for Printer Family destinations and so you may end up with a slightly different template for PDF than for RTF and/or HTML -- if you were going to attempt to use any of the attributes that are RTF or Markup Family only.
Even when I use the CSSSTYLE= option to specify a CSS sheet for RTF and PDF (this is a new feature in 9.2), the place where I notice the most difference between standard HTML/CSS and RTF and PDF used with CSS is in the cellpadding and border lines. This is what caused me to suggest that you work with Tech Support -- because there may end up being some inherent differences that you will just have to live with.
And rather than get frustrated or get lost by not asking for directions, Tech Support folks can get you started in the right direction to achieve the best look in all 3 destinations.
...yes, what can I say... I was a Lit major before my career as a SAS programmer/teacher so I never miss an opportunity to work a lit reference into the conversation. One of my favorite word frequency example programs is the one I used to parse the first chapter of Melville's "Moby Dick" (after I got the first chapter into a SAS dataset): http://support.sas.com/forums/thread.jspa?messageID=13656㕘