BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ChrisNZ
Tourmaline | Level 20

Hi,
Running this code

filename EM email 
        to     ="cxxx"
        subject="Space Alert" 
        type   ='text/html';

ods html3 file=EM; 

proc odstext;
  p "Hi all,"    /  style=[fontsize=11pt fontfamily=Calibri];
run;

ods html3 close;

The generated HTML result is 

 

<p align="LEFT"><font face="Calibri" size="3" color="#002288">Hi all,</font></p>

which Outlook displays as 12pt.

 

How can I get the correct size?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
Hi:
The Outlook formatting being wonky is the reason I don't put HTML into the body of the message that I'm e-mailing. I much prefer to make my report/output using ODS PDF or ODS RTF, both of which have lovely formatting and font control and page control and then just attach that file to the email.
Cynthia

View solution in original post

8 REPLIES 8
Cynthia_sas
SAS Super FREQ

Hi:

  Is there a reason that you're using ODS HTML3 for your example? I believe the default in ODS HTML3 was to translate your font size to a "relative" number that would then be displayed in the browser based on the relative size.

 

  So taking email out of the picture and running just the PROC ODSTEXT to ODS HTML3, I also get the font changed to size 3.

Cynthia_sas_0-1671156273362.png

However, switching to either "regular" ODS HTML or ODS HTML4 or ODS HTML5, I get the 11pt specified, as shown below:

 

ODS HTML4:

Cynthia_sas_1-1671156460035.png

 

ODS HTML5:

Cynthia_sas_2-1671156482323.png

 

Here's the code I ran:

ods html5(id=5) path='c:\temp' file='odstext_ht5.html' style=htmlblue;
ods html(id=4) path='c:\temp' file='odstext_ht4.html' style=htmlblue;
ods html3(id=3) path='c:\temp' file='odstext_ht3.html' style=htmlblue; 

proc odstext;
  p "Hi all,"    /  style=[fontsize=11pt fontfamily=Calibri];
run;

ods html3(id=3) close;
ods html(id=4) close;
ods html5(id=5) close;

I took email out of the picture and used style=htmlblue for all 3 output files. I would recommend switching away from ODS HTML3 and/or do your file as a PDF or RTF attachment, because both of those destinations expect text to be specified in font sizes, while HTML doesn't always expect absolute font sizes.

Cynthia

 

ChrisNZ
Tourmaline | Level 20

Hi Cynthia,

 

Thank for your reply.

I use destination html3 in a effort to get slightly more usable results in Outlook as advised in https://support.sas.com/kb/21/133.html.

Other destinations lose all their formatting in Outlook. Destination MSOffice2K adds random boxes everywhere.

 

Also, SAS seems to have stabilised its style syntax to omit underscores for all keywords?  fontsize= fontfamily= etc. Is that the case everywhere? That's a relief tbh. 

 

Thanks, Chris

 

 

Cynthia_sas
SAS Super FREQ
Hi:
The Outlook formatting being wonky is the reason I don't put HTML into the body of the message that I'm e-mailing. I much prefer to make my report/output using ODS PDF or ODS RTF, both of which have lovely formatting and font control and page control and then just attach that file to the email.
Cynthia
ChrisNZ
Tourmaline | Level 20

Thanks Cynthia.

Outlook switched from the IE renderer to the Word renderer 15 years ago, so it's disheartening that despite the plethora of html destinations, it is still unsupported even though it's the de facto corporate email tool.

Disappointing too that my font specification are simply ignored. I guess I need to write the HTML report by hand.

Thanks again for your always appreciated contribution! 🙂 

ChrisNZ
Tourmaline | Level 20

Would there be a template style like

proc template;
define style style1;
style usertext / fontfamily="Calibri" fontsize=11pt ;
style cellcontents / fontfamily="Calibri" fontsize=11pt ;

for proc odstext text that would override size=3?

 

Cynthia_sas
SAS Super FREQ

Hi:

  I played around with a few PROC TEMPLATE solutions, but ODS HTML3 always created relative font sizes. I think that was part of how HTML3 worked with the original in-line styles. However, the ODS HTMLCSS destination also produced HTML3 output, but with CSS style specified. So when I tried your original code just with ODS HTMLCSS, then I did get the style override used, as shown below:

Cynthia_sas_0-1671572286579.png

Of course, there is still Microsoft Outlook to contend with. I don't know whether Outlook will respect the HTMLCSS type of style specification. There's a chance that it will. But, as you can see in the DOCTYPE, ODS HTMLCSS does produce HTML 3.2 version of HTML output.

Cynthia

ChrisNZ
Tourmaline | Level 20

Thanks for this Cynthia.

I wasn't even aware of this version of the HTML output destination.

I gave it a go and sadly it's also badly received by Outlook .

proc odstext text is alright (though line spacing is altered), but ods text=, because it generates tables, is displayed surrounded by black lines.

It looks like the HTML has to be crafted manually.

Thanks again for your help!

 

 

 

 

 

Cynthia_sas
SAS Super FREQ
Hi: You might try ODS CHTML, as your destination then. It produces absolutely bare bones HTML without any DOCTYPE so there's a possibility that Outlook won't urp all over it.
Cynthia

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1478 views
  • 0 likes
  • 2 in conversation