SAS在RTF頁眉頁腳中插入圖片logo
作為一個(gè)在CRO公司工作的SAS程序員我們會(huì)遇到甲方提到的各種需求,最近一個(gè)藥廠需要在RTF文件的頁眉中加入他們公司的logo,小編以前見識(shí)有限的時(shí)候以為SAS實(shí)現(xiàn)不了這個(gè)功能,在網(wǎng)上搜索了一下還真讓我找到了,今天跟大家分享一下,先看一下圖片效果吧。
下面是相關(guān)的code:
%let path = C:\temp\;
ods rtf file="&path.image.rtf" startpage=never;
ods escapechar='^';
title1 justify = left '^S={preimage="&path.fama.png"} ' justify = right 'Page ^{thispage} of ^{lastpage}';
proc print data=sashelp.class;
run;
ods rtf close;
還可以把圖片放到RTF文件中
下面是相關(guān)的code:
ods rtf file="c:\temp\test.rtf" startpage=never;
ods escapechar='^';
proc print data=sashelp.class;
run;
ods text='^S={preimage="C:\temp\fama.png" just=c}';
proc print data=sashelp.class;
run;
ods rtf close;
關(guān)鍵代碼是ods text(通常放置一些文本),ods escapechar(將 ^ 設(shè)置為轉(zhuǎn)義字符),然后是 ^S={ } 這是在RTF(和其他目標(biāo))中插入樣式和類似內(nèi)容的方式.然后我們只使用preimage 這意味著在下一位之前放一張圖片(文本,這里是空白的)。如果在正文中插入圖片就用ods text,如果想在頁眉或者頁腳插入圖片就用title或footnote。
請(qǐng)前往:http://lygongshang.com/TeacherV2.html?id=166