Click here to Skip to main content
15,905,071 members
Home / Discussions / C#
   

C#

 
GeneralRe: Photoshop like image editor with a drag and drop image gallery Pin
hammerstein052-Jun-10 5:58
hammerstein052-Jun-10 5:58 
GeneralRe: Photoshop like image editor with a drag and drop image gallery Pin
Anıl Yıldız2-Jun-10 6:01
Anıl Yıldız2-Jun-10 6:01 
GeneralRe: Photoshop like image editor with a drag and drop image gallery Pin
ikbegins2-Jun-10 21:09
ikbegins2-Jun-10 21:09 
QuestionFlickering screen when minimizing Pin
TimSWatson1-Jun-10 21:57
TimSWatson1-Jun-10 21:57 
AnswerRe: Flickering screen when minimizing Pin
Pete O'Hanlon1-Jun-10 22:17
mvePete O'Hanlon1-Jun-10 22:17 
GeneralRe: Flickering screen when minimizing Pin
TimSWatson1-Jun-10 23:10
TimSWatson1-Jun-10 23:10 
GeneralRe: Flickering screen when minimizing Pin
Pete O'Hanlon1-Jun-10 23:23
mvePete O'Hanlon1-Jun-10 23:23 
QuestionCreate 2007 excel-file with C# Pin
Mc_Topaz1-Jun-10 21:36
Mc_Topaz1-Jun-10 21:36 
I'm having trouble creating an 2007 Excel file from scratch using Microsoft.Office.Interop.Excel with C#.

Here is a part of my own class I'm using to create a non existing excel-file or open an existing excel-file

using Microsoft.Office.Interop.Excel;

public ExcelFile(string excelFile)
{
    application = new Application();

    if (!File.Exists(excelFile))
    {
        this.workbook = application.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
        this.workbook.SaveAs(excelFile, XlFileFormat.xlAddIn8, "", "", false, false, XlSaveAsAccessMode.xlNoChange, XlSaveConflictResolution.xlLocalSessionChanges, false, Type.Missing, Type.Missing, true);
        this.workbook.Close(true, Type.Missing, Type.Missing);
     }
     this.workbook = application.Workbooks.Open(excelFile, 0, false, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
}


Notice I check if the excel file exist on the computer before I use it.
If the excel-file don't exist I'm trying to create it, close it and open it so I can use it in my application.
But when I try to open it after creating it, the "application.workbook.open()"-method crashes in a COMException.
If I use an excel-file which already exist, the "application.workbook.open()"-method don't crash.

What do I miss? I used this page as source: http://csharp.net-informations.com/excel/csharp-create-excel.htm[^]
AnswerRe: Create 2007 excel-file with C# Pin
Henry Minute2-Jun-10 1:48
Henry Minute2-Jun-10 1:48 
QuestionImage on specific tree node Pin
KaurGurpreet1-Jun-10 19:04
KaurGurpreet1-Jun-10 19:04 
AnswerMessage Closed Pin
1-Jun-10 20:55
stancrm1-Jun-10 20:55 
GeneralRe: Image on specific tree node Pin
KaurGurpreet1-Jun-10 21:19
KaurGurpreet1-Jun-10 21:19 
GeneralRe: Image on specific tree node Pin
Mycroft Holmes1-Jun-10 22:52
professionalMycroft Holmes1-Jun-10 22:52 
GeneralRe: Image on specific tree node Pin
Pete O'Hanlon1-Jun-10 23:00
mvePete O'Hanlon1-Jun-10 23:00 
QuestionInstalling web service on windows 2008 Pin
KaurGurpreet1-Jun-10 19:02
KaurGurpreet1-Jun-10 19:02 
QuestionSecuring a web method Pin
KaurGurpreet1-Jun-10 19:00
KaurGurpreet1-Jun-10 19:00 
AnswerRe: Securing a web method Pin
SarahMcM1-Jun-10 20:36
SarahMcM1-Jun-10 20:36 
GeneralRe: Securing a web method Pin
KaurGurpreet1-Jun-10 21:20
KaurGurpreet1-Jun-10 21:20 
GeneralRe: Securing a web method Pin
SarahMcM2-Jun-10 11:46
SarahMcM2-Jun-10 11:46 
QuestionMessage Removed Pin
1-Jun-10 18:22
amaankhan1-Jun-10 18:22 
AnswerRe: help Pin
Mycroft Holmes1-Jun-10 19:34
professionalMycroft Holmes1-Jun-10 19:34 
GeneralRe: help Pin
amaankhan1-Jun-10 19:46
amaankhan1-Jun-10 19:46 
AnswerRe: help Pin
Abhinav S1-Jun-10 19:35
Abhinav S1-Jun-10 19:35 
QuestionRemove Item from listbox Pin
future38391-Jun-10 17:55
future38391-Jun-10 17:55 
Questionexe not executed Pin
prithaa1-Jun-10 17:44
prithaa1-Jun-10 17:44 

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.