Click here to Skip to main content
15,917,568 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: where can i declare a global variable ? Pin
Mohammed Amine1-Aug-06 3:44
Mohammed Amine1-Aug-06 3:44 
AnswerRe: where can i declare a global variable ? Pin
Guffa4-Aug-06 11:52
Guffa4-Aug-06 11:52 
AnswerRe: where can i declare a global variable ? [modified] Pin
albCode1-Aug-06 4:00
albCode1-Aug-06 4:00 
GeneralRe: where can i declare a global variable ? Pin
Mohammed Amine1-Aug-06 4:43
Mohammed Amine1-Aug-06 4:43 
QuestionDataGrid Label problem ?? Pin
nabeelkhan1-Aug-06 1:33
nabeelkhan1-Aug-06 1:33 
AnswerRe: DataGrid Label problem ?? Pin
ToddHileHoffer1-Aug-06 2:12
ToddHileHoffer1-Aug-06 2:12 
AnswerRe: DataGrid Label problem ?? Pin
dansoft1-Aug-06 2:15
dansoft1-Aug-06 2:15 
QuestionQuery: Closing and Killing the Excel.exe from the processor Pin
Selvaraj Anantha Raman1-Aug-06 1:08
Selvaraj Anantha Raman1-Aug-06 1:08 
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
AnswerRe: Query: Closing and Killing the Excel.exe from the processor Pin
ToddHileHoffer1-Aug-06 2:17
ToddHileHoffer1-Aug-06 2:17 
GeneralRe: Query: Closing and Killing the Excel.exe from the processor Pin
RichardGrimmer2-Aug-06 7:51
RichardGrimmer2-Aug-06 7:51 
QuestionGetting client ID of server side control Pin
Malcolm Smart1-Aug-06 0:52
Malcolm Smart1-Aug-06 0:52 
AnswerRe: Getting client ID of server side control Pin
Malcolm Smart1-Aug-06 2:07
Malcolm Smart1-Aug-06 2:07 
QuestionSharepoint RPCs, Pin
nicolas.alonzo1-Aug-06 0:44
nicolas.alonzo1-Aug-06 0:44 
AnswerRe: Sharepoint RPCs, Pin
nicolas.alonzo2-Aug-06 0:07
nicolas.alonzo2-Aug-06 0:07 
QuestionSending Mail in Dot Net Pin
aaraaayen1-Aug-06 0:44
aaraaayen1-Aug-06 0:44 
AnswerRe: Sending Mail in Dot Net Pin
_AK_1-Aug-06 0:53
_AK_1-Aug-06 0:53 
AnswerRe: Sending Mail in Dot Net Pin
Tim Kohler1-Aug-06 2:59
Tim Kohler1-Aug-06 2:59 
AnswerRe: Sending Mail in Dot Net Pin
eggsovereasy1-Aug-06 4:29
eggsovereasy1-Aug-06 4:29 
QuestionHi, Text_Changed please Pin
Mohammed Amine1-Aug-06 0:34
Mohammed Amine1-Aug-06 0:34 
AnswerRe: Hi, Text_Changed please Pin
Ista3-Aug-06 3:06
Ista3-Aug-06 3:06 
QuestionImageButton in datagrid Pin
ewhizz1-Aug-06 0:29
ewhizz1-Aug-06 0:29 
AnswerRe: ImageButton in datagrid Pin
_AK_1-Aug-06 0:42
_AK_1-Aug-06 0:42 
GeneralRe: ImageButton in datagrid Pin
ewhizz1-Aug-06 0:48
ewhizz1-Aug-06 0:48 
GeneralRe: ImageButton in datagrid Pin
_AK_1-Aug-06 0:52
_AK_1-Aug-06 0:52 
GeneralRe: ImageButton in datagrid Pin
ewhizz1-Aug-06 0:58
ewhizz1-Aug-06 0:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.