Hi:
Some comments. I don't know why RTF and HTML are different. I suspect it has something to do with Microsoft's interpretation and rendering of the various border style attributes. With Microsoft Word, Microsoft can render as they want. With Internet Explorer, Microsoft must still stick with the W3C specs for rendering tables in a browser. If you want to know the WHY, you'll have to work with Tech Support. HTML and RTF are just different destinations and inherently contain some differences -- some more immediate and obvious (HTML output can be as wide as it needs to be; while RTF is controlled by the physical margin size and orientation) and some more subtle and not obvious until you try the same thing in both destinations (as my bordercolor program illustrated).
If you run the program I posted with the colorful borders, you will see a difference in the way that RTF and HTML both rendered the colors on each "side" of the NAME cell. If you take that experiment a step further and get rid of borderwidth on NAME, but change the border style, again, you will see different results:
[pre]
ods html file='border.html' style=sasweb;
ods pdf file='border.pdf';
ods rtf file='border.rtf';
proc report data=sashelp.class(obs=2) nowd
style(report)={borderbottomcolor=cyan borderbottomwidth=5
bordertopcolor=yellow bordertopwidth=5
borderleftcolor=magenta borderleftwidth=5
borderrightcolor=black borderrightwidth=5};
title "1) REPORT: borderbottomcolor= and borderbottomstyle";
column name age height;
define name / style(column)={borderbottomcolor=black borderbottomstyle=double
bordertopcolor=green bordertopwidth=5
borderleftcolor=blue borderleftwidth=5
borderrightcolor=pink borderrightwidth=5};
run;
ods _all_ close;
[/pre]
I am only pointing out that the rendering is DIFFERENT between HTML and RTF. I do not believe it is possible to make a single TABLE template or a single STYLE template with style attribute changes that will render the same in both destinations. In fact, I don't know whether it is even possible for HTML to render the same way as the RTF file. Again, that is a question for Tech Support.
Another comment. You said that: I cannot use proc report because i don't know exactly what the columns are and their number.
Your table template does not use GENERIC -- so right now, your TABLE template can ONLY process the variables listed, var_c and var_n, flag and bigflag. Without GENERIC you do not have a "reusable" column. And, if you do use GENERIC, then you will need a DATA step program in order to send your columns to the TABLE template. And, if you ARE using a DATA step program in order to set the values for FLAG and BIGFLAG, then you do have an opportunity to know EXACTLY how many columns you have, what the columns are.
With PROC REPORT, the new SPANROWS option would make the cell for Charlemagne span the 2 rows for var_n -- without an interior divider line. Then the style attribute vjust=m would center the name on the line as shown in the example below:
[pre]
ods listing close;
ods html file="C:\temp\html_output_j.html" style=journal;
ods rtf file="C:\temp\rtf_output_j.rtf" style=journal;
proc report data=test1 spanrows nowd;
title 'Show SPANROWS with JOURNAL style';
column var_c var_n ;
define var_c / order style(column)={vjust=m};
define var_n / sum;
run;
ods _all_ close;
[/pre]
cynthia