Click here to Skip to main content
15,894,546 members
Home / Discussions / C#
   

C#

 
GeneralRe: The address of pointer that pass to COM object is not right (only in x64) Pin
RYU^^6-Jun-08 0:13
RYU^^6-Jun-08 0:13 
QuestionImplementing Word's spell check in C# app Pin
Alex MacDonald29-May-08 11:59
Alex MacDonald29-May-08 11:59 
AnswerRe: Implementing Word's spell check in C# app Pin
Judah Gabriel Himango29-May-08 13:05
sponsorJudah Gabriel Himango29-May-08 13:05 
AnswerRe: Implementing Word's spell check in C# app Pin
Vasudevan Deepak Kumar29-May-08 18:20
Vasudevan Deepak Kumar29-May-08 18:20 
AnswerRe: Implementing Word's spell check in C# app Pin
buchstaben29-May-08 22:37
buchstaben29-May-08 22:37 
QuestionHow to rename my Solution Name (Vs2005) ? Pin
hdv21229-May-08 11:19
hdv21229-May-08 11:19 
AnswerRe: How to rename my Solution Name (Vs2005) ? Pin
Judah Gabriel Himango29-May-08 12:38
sponsorJudah Gabriel Himango29-May-08 12:38 
QuestionAdding data to a new worksheet in an existing workbook c# Pin
compninja2529-May-08 10:47
compninja2529-May-08 10:47 
Hey everyone. I've been scrounging around on here and finally figured out how to export the data to an excel document from my dataset, the only problem i'm having now is I can't add a new worksheet. I have a data set with that i've filled with three different tables and I need each table to go into a seperate worksheet (so the marketing guys can then use that for their photoshop stuff.) what I have so far is just adding different headers on the same sheet...

Excel.ApplicationClass excel = new Excel.ApplicationClass();
            excel.Application.Workbooks.Add(true);
            System.Data.DataTable table = data1.Tables["table1"];


            int Collindex = 0;
            int rowIndex = 2;
            excel.Cells[1, 1] = "table 1";
            foreach (System.Data.DataColumn col in table.Columns)
            {
                Collindex ++;
                excel.Cells[2, Collindex] = col.ColumnName;
            }            
            foreach (DataRow row in table.Rows)
            {
                rowIndex++;
                progbar2.PerformStep();
                progbar2.Refresh();
                Collindex = 0;
                foreach (DataColumn col in table.Columns)
                {
                    Collindex ++;
                    excel.Cells[rowIndex + 1, Collindex] = row[col.ColumnName];
                }
            }

            progbar1.PerformStep();
            progbar1.Refresh();
            
            table.Clear();
            table = data1.Tables["table2"];
            progbar2.Value = 0;
            progbar2.Refresh();
            progbar2.Maximum = data1.Tables["table2"].Rows.Count;
            progbar2.Refresh();           

            rowIndex = rowIndex + 3;
            excel.Cells[rowIndex, 1] = "table 2";
            foreach (DataRow row in table.Rows)
            {
                rowIndex++;
                progbar2.PerformStep();
                progbar2.Refresh();
                Collindex = 0;
                foreach (DataColumn col in table.Columns)
                {
                    Collindex++;
                    excel.Cells[rowIndex + 1, Collindex] = row[col.ColumnName];
                }
            }

            progbar1.PerformStep();
            progbar1.Refresh();

            table.Clear();
            table = data1.Tables["table3"];
            progbar2.Value = 0;
            progbar2.Refresh();
            progbar2.Maximum = data1.Tables["table3"].Rows.Count;
            progbar2.Refresh();
            label7.Text = "Safety Cover Pricing";
            label7.Refresh();

            rowIndex = rowIndex + 3;
            excel.Cells[rowIndex, 1] = "table3";
            foreach (DataRow row in table.Rows)
            {
                rowIndex++;
                progbar2.PerformStep();
                progbar2.Refresh();
                Collindex = 0;
                foreach (DataColumn col in table.Columns)
                {
                    Collindex++;
                    excel.Cells[rowIndex + 1, Collindex] = row[col.ColumnName];
                }
            }


I've played around with excel.application.worksheets.add() but can't get the syntax correct (if that's even the right object I want to be working with. I just need a point in the right direction.

Thank you!
AnswerRe: Adding data to a new worksheet in an existing workbook c# Pin
Judah Gabriel Himango29-May-08 12:37
sponsorJudah Gabriel Himango29-May-08 12:37 
GeneralRe: Adding data to a new worksheet in an existing workbook c# Pin
compninja2530-May-08 1:59
compninja2530-May-08 1:59 
GeneralRe: Adding data to a new worksheet in an existing workbook c# Pin
Robert Ernst28-Aug-08 11:34
Robert Ernst28-Aug-08 11:34 
QuestionWPF and C# Help Pin
Tyler Lovejoy29-May-08 10:20
Tyler Lovejoy29-May-08 10:20 
AnswerRe: WPF and C# Help Pin
Judah Gabriel Himango29-May-08 12:34
sponsorJudah Gabriel Himango29-May-08 12:34 
GeneralRe: WPF and C# Help Pin
Tyler Lovejoy30-May-08 2:53
Tyler Lovejoy30-May-08 2:53 
AnswerRe: WPF and C# Help Pin
Bert delaVega30-May-08 5:50
Bert delaVega30-May-08 5:50 
AnswerRe: WPF and C# Help Pin
Tyler Lovejoy2-Jun-08 6:25
Tyler Lovejoy2-Jun-08 6:25 
QuestionAppending Multiple RTF FIles Together for Printout Pin
redfish3429-May-08 9:15
redfish3429-May-08 9:15 
AnswerRe: Appending Multiple RTF FIles Together for Printout Pin
Thomas Stockwell30-May-08 10:43
professionalThomas Stockwell30-May-08 10:43 
QuestionIs it possible to change Intranet Zone to Full Trust thrue code? Pin
Phrone29-May-08 8:40
Phrone29-May-08 8:40 
AnswerRe: Is it possible to change Intranet Zone to Full Trust thrue code? Pin
Gareth H29-May-08 9:00
Gareth H29-May-08 9:00 
AnswerRe: Is it possible to change Intranet Zone to Full Trust thrue code? Pin
SomeGuyThatIsMe29-May-08 9:01
SomeGuyThatIsMe29-May-08 9:01 
RantRe: Is it possible to change Intranet Zone to Full Trust thrue code? Pin
Dan Neely29-May-08 9:58
Dan Neely29-May-08 9:58 
AnswerRe: Is it possible to change Intranet Zone to Full Trust thrue code? Pin
Judah Gabriel Himango29-May-08 10:28
sponsorJudah Gabriel Himango29-May-08 10:28 
RantI can't help myself Pin
Anthony Mushrow29-May-08 12:25
professionalAnthony Mushrow29-May-08 12:25 
Questionindex was ouside the bounds of the array Pin
NewToAspDotNet29-May-08 8:16
NewToAspDotNet29-May-08 8:16 

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.