Hi, I am trying to have a stored process write to the browser some javascript function before generating an Excel file using excelXP tagset. It seems to work on chrome but I get an issue with IE. The stored process basically write my first data step to the beginning of the excel file. I don't understand why because I redirect the code to Excel only after my first data step. /* First data step to write to the browser*/ data _null_; file _webout; put "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'></script>"; put"<script type='text/javascript'>"; put"function detectIE() {"; put"var ua = window.navigator.userAgent;"; put"var msie = ua.indexOf('MSIE ');"; put"var trident = ua.indexOf('Trident/');"; put"if (msie > 0) {"; put" // IE 10 or older => return version number"; put"return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);"; put"}"; put"else if (trident > 0) {"; put"// IE 11 (or newer) => return version number"; put"var rv = ua.indexOf('rv:');"; put"return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);"; put"}"; put"else {"; put"window.stop();"; put"document.execCommand('Stop');"; put"alert('Please use Internet Explorer');"; put"newWindow = window.open('', '_self', '');"; put"window.close(newWindow);"; put" // other browser"; put"return false;"; put"}"; put"}"; put"window.onpaint = detectIE();"; put '</script>'; run; /* Then I redirect the Excel for the Excelxp tagset*/ %let RV=%sysfunc(stpsrv_header(Content-type,application/vnd.ms-excel)); %let RV=%sysfunc(stpsrv_header(Content-disposition,attachment; filename= Histostaffperformance.xml)); ODS listing close; ODS noresults; ODS tagsets.ExcelXP file=_webout STYLE=SRReportStyle_custom2 options (Embedded_titles = 'yes' Embedded_Footnotes = 'yes' sheet_name= 'Histo_performance' autofilter= 'yes' frozen_headers= '3' autofit_height= 'yes' absolute_column_width= '20,20,15,30,13' ); TITLE1 j=l color=cxF8971D h=14pt bold "Histology - Staff Performance"; PROC REPORT DATA=all NOWD style(Header)=[just=center ]; COLUMN taskdate histotech testtype steps count; DEFINE Taskdate /CENTER 'Date' ; DEFINE histotech /CENTER "Histotech" ; DEFINE testtype /CENTER "Test Type" ; DEFINE steps /CENTER "Step" ; DEFINE count /CENTER "# cases" ; run; RUN; ods tagsets.excelxp close; ods listing;
... View more