Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: Conditional compiling - what ends up in the exe file Pin
Ennis Ray Lynch, Jr.2-Oct-08 2:56
Ennis Ray Lynch, Jr.2-Oct-08 2:56 
QuestionCreating Access DB Tables Pin
Planker1-Oct-08 6:57
Planker1-Oct-08 6:57 
AnswerRe: Creating Access DB Tables Pin
Dave Kreskowiak1-Oct-08 11:04
mveDave Kreskowiak1-Oct-08 11:04 
Questionpreventing system standby/hibernate from within Winforms app Pin
Neophyte301-Oct-08 5:50
Neophyte301-Oct-08 5:50 
AnswerRe: preventing system standby/hibernate from within Winforms app Pin
DaveyM691-Oct-08 6:05
professionalDaveyM691-Oct-08 6:05 
GeneralRe: preventing system standby/hibernate from within Winforms app Pin
Neophyte302-Oct-08 0:31
Neophyte302-Oct-08 0:31 
Questionlist of remote printers Pin
arkiboys1-Oct-08 4:38
arkiboys1-Oct-08 4:38 
QuestiondataTable save as excel programatically Pin
michael_jhons1-Oct-08 4:26
michael_jhons1-Oct-08 4:26 
hello everybody

i have a function that save my datatable to an excel file:
int columnIndex = 0;
Microsoft.Office.Interop.Excel.ApplicationClass excel = new Microsoft.Office.Interop.Excel.ApplicationClass();
excel.Application.Workbooks.Add(true);
foreach (DataColumn dc in dataSet.Tables[1].Columns)
{
    columnIndex++;
    excel.Cells.ColumnWidth = 25;
    excel.Cells[1, columnIndex] = dc.ColumnName;
}

int rowIndex = 0;
foreach (DataRow dr in dataSet.Tables[1].Rows)
{
    rowIndex++;
    columnIndex = 0;
    foreach (DataColumn dc in dataSet.Tables[1].Columns)
    {
        columnIndex++;
        excel.Cells[rowIndex + 1, columnIndex] = dr[dc.ColumnName];
    }

}


excel.Save(@"C:\SomeName.xls");

what is going on is that a pop up window ask me "if i need to save my excel sheet', if i agree both files are saved one in c:/someName.xls and another for the pop up window. i don't want the pop up to be displayed i just need to save programatically my datatable.
i'm new in excel things please any help

kind regards
AnswerRe: dataTable save as excel programatically Pin
Wendelius1-Oct-08 4:37
mentorWendelius1-Oct-08 4:37 
GeneralRe: dataTable save as excel programatically Pin
michael_jhons1-Oct-08 5:04
michael_jhons1-Oct-08 5:04 
GeneralRe: dataTable save as excel programatically Pin
michael_jhons1-Oct-08 5:23
michael_jhons1-Oct-08 5:23 
GeneralRe: dataTable save as excel programatically Pin
Wendelius2-Oct-08 4:19
mentorWendelius2-Oct-08 4:19 
QuestionFetch Data from a Site Pin
ivix4u1-Oct-08 3:42
ivix4u1-Oct-08 3:42 
GeneralRe: Fetch Data from a Site Pin
Pete O'Hanlon1-Oct-08 3:45
mvePete O'Hanlon1-Oct-08 3:45 
GeneralRe: Fetch Data from a Site Pin
Ashfield1-Oct-08 8:51
Ashfield1-Oct-08 8:51 
AnswerRe: Fetch Data from a Site Pin
Alan Balkany2-Oct-08 3:47
Alan Balkany2-Oct-08 3:47 
QuestionOut of memoryexception Pin
Mogaambo1-Oct-08 3:38
Mogaambo1-Oct-08 3:38 
AnswerRe: Out of memoryexception Pin
Alan Balkany1-Oct-08 3:47
Alan Balkany1-Oct-08 3:47 
GeneralRe: Out of memoryexception Pin
Simon P Stevens1-Oct-08 5:17
Simon P Stevens1-Oct-08 5:17 
AnswerRe: Out of memoryexception Pin
PIEBALDconsult1-Oct-08 4:07
mvePIEBALDconsult1-Oct-08 4:07 
AnswerRe: Out of memoryexception Pin
Dave Kreskowiak1-Oct-08 4:11
mveDave Kreskowiak1-Oct-08 4:11 
AnswerRe: Out of memoryexception Pin
leppie1-Oct-08 4:23
leppie1-Oct-08 4:23 
GeneralRe: Out of memoryexception Pin
Mogaambo1-Oct-08 4:31
Mogaambo1-Oct-08 4:31 
AnswerRe: Out of memoryexception Pin
Le centriste1-Oct-08 6:56
Le centriste1-Oct-08 6:56 
QuestionAutoscale Windows form Pin
Ethen1-Oct-08 2:36
Ethen1-Oct-08 2:36 

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.