We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create a excel file in C# without visitable to Excel window

Thread ID:




3772 Apr 8,2003 01:37 AM UTC WinForms 0
Tags: FAQ
.net beginner
Asked On April 8, 2003 01:37 AM UTC

I am using the following code to open a Excel window but I don't know how to open a sheet and set value on it and close it. Thanks in advance. //Variable Type excel; object[] parameter= new object[1]; object excelObject; try { //Get the excel object excel = Type.GetTypeFromProgID("Excel.Application"); //Create instance of excel excelObject = Activator.CreateInstance(excel); //Set the parameter whic u want to set parameter[0] = true; //Set the Visible property excel.InvokeMember("Visible", BindingFlags.SetProperty, null, excelObject, parameter); } catch(Exception e) { Console.WriteLine("Error Stack {0} ", e.Message) ; } finally { //When this object is destroyed the Excel application will be closed //So Sleep for sometime and see the excel application Thread.Sleep(5000); //Relaese the object //GC.RunFinalizers() }


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon