iyarar Posted December 24, 2013 Share Posted December 24, 2013 Hi, I am using the following code to export data to excel. But this code is working in vcl and standalone server mode, does not work in isapi mode. I need the code to work in ISAPI mode. Do you have any idea for help me ? var Excel, wSheet: Variant; i,j:integer; s,Fl:string; Begin If Myq_Report.RecordCount>0 Then Begin try Excel:= CreateOleObject('Excel.Application'); except Exit; end; Excel.Visible := False; Excel.Workbooks.Add; wSheet:= Excel.WorkBooks[1].WorkSheets[1]; wSheet.Cells[2,1] := 'Company'; wSheet.Cells[2,1].Columns.ColumnWidth:=20; wSheet.Cells[2,2] := 'Date'; wSheet.Cells[2,2].Columns.ColumnWidth:=10; wSheet.Cells[2,3] := 'Time'; wSheet.Cells[2,3].Columns.ColumnWidth:=5; wSheet.Cells[1,1]:='SERVICE LIST'; wSheet.Rows[1].RowHeight := 20; wSheet.Rows[1].Font.Size := 14; wSheet.Rows[1].Font.Color:=ClWhite; wSheet.Range['A1:R1'].Mergecells:=True; wSheet.Range['A1:R1'].Interior.ColorIndex:=16; wSheet.Range['A1:R1'].HorizontalAlignment := -4108; wSheet.Range['A1:R1'].VerticalAlignment := -4108; Fl:='servicelist_'+FormatDateTime('YYMMDDhhmmnnss',now)+'.xls'; wSheet.SaveAs(UniServerModule.LocalCachePath+Fl); s := UniServerModule.LocalCacheURL; s := StringReplace(s,'\','/',[rfReplaceAll]); UniURLFrame1.URL := s+fl; Excel.quit; End; End; Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted December 24, 2013 Share Posted December 24, 2013 Dear İdris, please change UniServerModule.LocalCachePath to UniServerModule.StartPath or you can use that s:= UniServerModule.LocalCachePath; s := StringReplace(s,'\','/',[rfReplaceAll]); UniSession.SendFile(s+DosyaAdi,DosyaAdi); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.