TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
selvaraj
NA
1
0
Query: Closing and Killing the Excel.exe from the processor
Aug 1 2006 6:56 AM
Hi, i've developed a web application to retrieve the data from Sqlserver 2000 and fill it in the Dataset then, using the dataset i'l write the data into the Excel template file by opening the Excel and copying the excel sheet writing the data into it. After writing the data i'l save the template file as a new file with different name. then i'm closing the Excel books, sheets and quits the excel application. My problem is after closing and quiting the Excel application also the Excel.exe is still running idle in the processor, so i can't open the excel file. Only After killing the Excel.exe only i'm able to open the saved Excel File. In my application multiple user can access the same application so multiple Excel.exe will be running in the process. How to find out my Excel.exe and kill it. Here is my code: using System; using Excel; using System.IO; using System.Net; using System.Collections; using System.ComponentModel; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Diagnostics; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Runtime.InteropServices; using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared; using RealImageReports.Reports; using RealImageReports.Include; namespace RealImageReports { public class ExcelWriter { Excel.ApplicationClass _excel = new Excel.ApplicationClass(); Excel.Workbooks oBooks; Excel._Workbook oBook; Excel.Worksheet ws; public void WorkSheetOpen(string path, string filename) { oBooks = _excel.Workbooks; oBook = oBooks.Open(path + filename, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing ); _excel.Visible = true; } public void WriteData(string path, string filename, DataSet _ds, string theatre, string Ads, string STime, string ETime) { ws =(Worksheet) oBook.Worksheets[1]; ws.Activate(); ws.Copy(ws, Type.Missing); ws.Name = theatre; ws=(Worksheet) oBook.Worksheets[theatre]; ws.Activate(); FillHeadersParam(theatre, Ads, STime, ETime); FillDataRows(ws, _ds); } public void FillHeadersParam(string theatre, string Ads, string STime, string ETime) { AddItemToSpreadsheet(5, 2, ws, theatre); AddItemToSpreadsheet(5, 6, ws, STime); AddItemToSpreadsheet(6, 2, ws, Ads); AddItemToSpreadsheet(6, 6, ws, ETime); AutoFitColumn(ws, 2); AutoFitColumn(ws, 5); } public void WorkSheetClose() { ws =oBook.Sheets.get_Item(1) as Excel.Worksheet; ws.Activate(); ws.Visible = Excel.XlSheetVisibility.xlSheetVeryHidden; oBook.Save(); oBook.Close(XlSaveAction.xlSaveChanges,Type.Missing, Type.Missing); oBooks.Close(); oBooks.Application.Quit(); _excel.Quit(); Marshal.ReleaseComObject(ws); Marshal.ReleaseComObject(oBook); Marshal.ReleaseComObject(oBooks); Marshal.ReleaseComObject(_excel); } } } keenly waiting for your reply. Regards, Selvaraj.A
Reply
Answers (
0
)
Object reference error in custom control
SortCommend event is being fired twice