Click here to Skip to main content
15,945,119 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to convert Pin
Richard Deeming31-Jan-03 5:23
mveRichard Deeming31-Jan-03 5:23 
GeneralFully managed HTML validator/reformator Pin
Chris Maunder31-Jan-03 4:34
cofounderChris Maunder31-Jan-03 4:34 
GeneralRe: Fully managed HTML validator/reformator Pin
TigerNinja_31-Jan-03 5:00
TigerNinja_31-Jan-03 5:00 
GeneralRe: Fully managed HTML validator/reformator Pin
Chris Maunder31-Jan-03 7:54
cofounderChris Maunder31-Jan-03 7:54 
GeneralRe: Fully managed HTML validator/reformator Pin
Richard Deeming31-Jan-03 5:30
mveRichard Deeming31-Jan-03 5:30 
GeneralRe: Fully managed HTML validator/reformator Pin
Thesisus31-Jan-03 7:11
Thesisus31-Jan-03 7:11 
GeneralDestroying Excel object Pin
Vitesh Aggarwal31-Jan-03 3:45
Vitesh Aggarwal31-Jan-03 3:45 
GeneralRe: Destroying Excel object Pin
Ed K31-Jan-03 4:16
Ed K31-Jan-03 4:16 
Here is a code snippet from a class I'm using to export some data from an excel sheet. I think it answers your question.
///////// these are declared as member variables...copied here for clarity
        private Excel.ApplicationClass m_objExcel =  null;
        private Excel.Workbooks m_objBooks = null;
        private Excel._Workbook m_objBook = null;
        //private Excel.Sheets m_objSheets = null;
        private Excel._Worksheet m_objSheet = null;
        private Excel.Range m_objRange =  null;	
        private object oMissing = System.Reflection.Missing.Value;
///////////////////////////////////////////////////////////////

	try
	{
		FileInfo inf = new FileInfo(excelFileName);
		
		m_objExcel = new Excel.ApplicationClass();
		m_objExcel.Visible = false;
		m_objBooks = m_objExcel.Workbooks;
		m_objBook = m_objBooks.Open(inf.FullName, oMissing, oMissing,
			oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, 
			oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);

		m_objSheet = (Excel._Worksheet)m_objBook.Sheets[2];

		string transformFileName = string.Format(@"{0}\{1}.cvt",inf.DirectoryName,inf.Name);

		m_objSheet.SaveAs(transformFileName,Excel.XlFileFormat.xlTextWindows,oMissing,oMissing,oMissing,false,false,oMissing,oMissing,oMissing);

		activeFile = new FileInfo(transformFileName);

	}
	catch(Exception ex)
	{
		throw ex;
	}
	finally
	{
		if( m_objBook != null)
		{
			m_objBook.Close(false, oMissing, oMissing);
			System.Runtime.InteropServices.Marshal.ReleaseComObject (m_objBook);
			m_objBook = null;
			System.Runtime.InteropServices.Marshal.ReleaseComObject (m_objBooks);
			m_objBooks = null;
			m_objExcel.Quit();
			System.Runtime.InteropServices.Marshal.ReleaseComObject (m_objExcel);
			m_objExcel = null;	
		}
	}


ed

Regulation is the substitution of error for chance.
QuestionTooltip like window? Pin
Roger Alsing31-Jan-03 3:22
Roger Alsing31-Jan-03 3:22 
AnswerRe: Tooltip like window? Pin
Richard Deeming31-Jan-03 3:46
mveRichard Deeming31-Jan-03 3:46 
GeneralRe: Tooltip like window? Pin
Roger Alsing31-Jan-03 3:50
Roger Alsing31-Jan-03 3:50 
GeneralI would like to create a button that allow to open html page. Pin
zoltix31-Jan-03 2:56
zoltix31-Jan-03 2:56 
GeneralRe: I would like to create a button that allow to open html page. Pin
TigerNinja_31-Jan-03 5:09
TigerNinja_31-Jan-03 5:09 
GeneralRe: I would like to create a button that allow to open html page. Pin
zoltix31-Jan-03 5:30
zoltix31-Jan-03 5:30 
GeneralRe: I would like to create a button that allow to open html page. Pin
Anonymous31-Jan-03 19:52
Anonymous31-Jan-03 19:52 
Questionis machine.config cached ??? Pin
Dato31-Jan-03 2:48
Dato31-Jan-03 2:48 
GeneralReusing closed/disposed forms Pin
31-Jan-03 0:58
suss31-Jan-03 0:58 
GeneralRe: Reusing closed/disposed forms Pin
leppie31-Jan-03 4:18
leppie31-Jan-03 4:18 
GeneralExcel automation Pin
Mauricio Ritter30-Jan-03 23:49
Mauricio Ritter30-Jan-03 23:49 
GeneralCan't get MAC address using ManagementClass Pin
EnkelIk30-Jan-03 21:15
EnkelIk30-Jan-03 21:15 
GeneralRe: Can't get MAC address using ManagementClass Pin
EnkelIk4-Feb-03 23:11
EnkelIk4-Feb-03 23:11 
GeneralSystemMenu Pin
ShulapovMax30-Jan-03 20:50
ShulapovMax30-Jan-03 20:50 
GeneralRe: SystemMenu Pin
Roger Alsing31-Jan-03 1:03
Roger Alsing31-Jan-03 1:03 
QuestionCursor Change while UserControl Drag And Drop ? Pin
Paresh Gheewala30-Jan-03 15:43
Paresh Gheewala30-Jan-03 15:43 
AnswerRe: Cursor Change while UserControl Drag And Drop ? Pin
Paresh Gheewala31-Jan-03 10:56
Paresh Gheewala31-Jan-03 10:56 

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.