* -------------------------------------------------------------------- * * * * Sample proc demonstrating the use of Patrick Bower's Excel Class * * Library (September 2008). Internal comments in the classes * * explain the available features. * * * * Use of the Excel class requires both Janus Web Server and Janus SOAP * * which provides the functions for structuring the output spreadsheet * * in XML format. * * * * -------------------------------------------------------------------- * UTABLE LSTBL=10000 LVTBL=2000 LNTBL=200 OPENC JANWEB Begin in JANWEB i excelclass in JANWEB i excelclass_addCSVLine %t is object excel %styleList is longstring %typeList is longstring %valuelist is longstring * Mime-type setting: Note that some browsers will be sensitive only to * the URL suffix, so will treat the downloaded page as a spreadsheet * only if it ends in ".xls". Other browsers will key on the mime-type, * or "Content-Disposition" setting. To guarantee that your code works * across all browsers, you should ensure that all three are set correctly: Call $web_type('application/octet-stream') Call $web_response('Content-Disposition', 'attachment; filename=dataextract.xls') * Instantiate a new Excel spreadsheet %t = new('test' , - title = 'LOAD DATA VIA CSV' , - subject = 'Test of CSV Load' , - author = 'Paddy' , - keywords = 'CSV,Load' , - Description = 'Testing CSV load and document properties', - Category = 'Data Load' , - Manager = 'Paddy' , - Company = 'Marks and Spencer plc') * Apply some styling and add lines to the sheet %t:setStyle('Default',,,,,,,'#ffffcc') %t:setStyle('S1','optima',10,1,0,'White',2,'Navy','C','90') %t:setStyle('S2','optima',10,1,0,'White',2,'Navy','C') %t:newRow %styleList = 'S1,S1,S2,S1,' %typeList = 'Number,String,String,Number,' %valueList = '3344,4343,6767,544,' %t:addCSVLine(%valueList,%typeList,%styleList,',') %t:websend End