Click here to Skip to main content
15,897,704 members
Home / Discussions / C#
   

C#

 
GeneralRe: Passing different variable types Pin
DaveyM6913-Apr-10 8:25
professionalDaveyM6913-Apr-10 8:25 
GeneralRe: Passing different variable types Pin
mprice21413-Apr-10 6:30
mprice21413-Apr-10 6:30 
GeneralRe: Passing different variable types Pin
Luc Pattyn13-Apr-10 6:46
sitebuilderLuc Pattyn13-Apr-10 6:46 
GeneralRe: Passing different variable types Pin
mprice21413-Apr-10 7:56
mprice21413-Apr-10 7:56 
GeneralRe: Passing different variable types Pin
Luc Pattyn13-Apr-10 8:02
sitebuilderLuc Pattyn13-Apr-10 8:02 
AnswerRe: Passing different variable types Pin
kevinnicol13-Apr-10 6:19
kevinnicol13-Apr-10 6:19 
GeneralRe: Passing different variable types Pin
mprice21413-Apr-10 6:32
mprice21413-Apr-10 6:32 
QuestionHow to Save the Excel file with some file format [modified] [Solved] Pin
yu-jian13-Apr-10 4:37
yu-jian13-Apr-10 4:37 
I need help. I want to save the datatable to a *.xls file. wBook.FileFormat is only get Attribute.
How to set the file type to *.xls?Confused | :confused:

<code>
    Excel.Application app = new Microsoft.Office.Interop.Excel.ApplicationClass(); 
    try 
    { 
        app.Visible = false; 
        Excel.Workbook wBook = app.Workbooks.Add(true); 
        Excel.Worksheet wSheet = wBook.Worksheets[1] as Excel.Worksheet; 
        if (dt.Rows.Count > 0) 
        { 
            int row = 0; 
            row = dt.Rows.Count; 
            int col = dt.Columns.Count; 
            for (int i = 0; i < row; i++) 
            { 
                for (int j = 0; j < col; j++) 
                { 
                    string str = dt.Rows[i][j].ToString(); 
                    wSheet.Cells[i + 2, j + 1] = str; 
                } 
            } 
        } 
        int size = dt.Columns.Count; 
        for (int i = 0; i < size; i++) 
        { 
            wSheet.Cells[1, 1 + i] = dt.Columns[i].ColumnName; 
        } 
        app.DisplayAlerts = false; 
        app.AlertBeforeOverwriting = false; 
        wBook.Save(); 
        app.Save(filePath); 
        app.SaveWorkspace(filePath); 
        app.Quit(); 
        app = null; 
    } 
    catch (Exception err) 
    {
        return -1;
    } 
    finally 
    { 
    }
   </code>

modified on Friday, April 16, 2010 8:07 AM

AnswerRe: How to Save the Excel file with some file format Pin
Dan Mos13-Apr-10 5:13
Dan Mos13-Apr-10 5:13 
Questiondatagrid checkbox Pin
Morgs Morgan13-Apr-10 4:26
Morgs Morgan13-Apr-10 4:26 
AnswerRe: datagrid checkbox Pin
J imran13-Apr-10 8:16
J imran13-Apr-10 8:16 
GeneralRe: datagrid checkbox Pin
Morgs Morgan13-Apr-10 9:33
Morgs Morgan13-Apr-10 9:33 
Questionsmart device Forms-Database Pin
Tunisien8613-Apr-10 2:18
Tunisien8613-Apr-10 2:18 
AnswerRe: smart device Forms-Database Pin
Luc Pattyn13-Apr-10 2:55
sitebuilderLuc Pattyn13-Apr-10 2:55 
AnswerRe: smart device Forms-Database [modified] Pin
Tim Yen13-Apr-10 2:55
Tim Yen13-Apr-10 2:55 
GeneralRe: smart device Forms-Database Pin
Luc Pattyn13-Apr-10 3:11
sitebuilderLuc Pattyn13-Apr-10 3:11 
GeneralRe: smart device Forms-Database Pin
Tunisien8613-Apr-10 4:17
Tunisien8613-Apr-10 4:17 
AnswerRe: smart device Forms-Database [modified] Pin
O.Phil13-Apr-10 4:11
O.Phil13-Apr-10 4:11 
GeneralRe: smart device Forms-Database Pin
Luc Pattyn13-Apr-10 4:20
sitebuilderLuc Pattyn13-Apr-10 4:20 
GeneralRe: smart device Forms-Database Pin
O.Phil13-Apr-10 4:26
O.Phil13-Apr-10 4:26 
GeneralRe: smart device Forms-Database Pin
Luc Pattyn13-Apr-10 4:29
sitebuilderLuc Pattyn13-Apr-10 4:29 
GeneralRe: smart device Forms-Database Pin
Tunisien8613-Apr-10 6:01
Tunisien8613-Apr-10 6:01 
GeneralRe: smart device Forms-Database Pin
O.Phil13-Apr-10 22:45
O.Phil13-Apr-10 22:45 
QuestionIDENT_CURRENT Pin
devvvy12-Apr-10 22:47
devvvy12-Apr-10 22:47 
AnswerRe: IDENT_CURRENT Pin
Pete O'Hanlon12-Apr-10 23:01
mvePete O'Hanlon12-Apr-10 23:01 

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.