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.
Unfortunately, activation email could not send to your email. Please try again.

How can I check if a worksheet object has been Close()''ed

Thread ID:

Created:

Updated:

Platform:

Replies:

66721 Aug 1,2007 12:43 PM Aug 2,2007 07:05 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Scott#
Asked On August 1, 2007 12:43 PM

I think I have only hit this problem when jumping around code in the debugger but I have gotten an error when I call workbook.Close(...) more than once.

I already check that (workbook != null) but I would like to check something else to prevent an error.

I tried "(workbook.ActiveSheet != null)" but that didn't worked when the workbookk has been closed.


Any ideas?

Melba Winshia [Syncfusion]
Replied On August 2, 2007 07:05 AM

Hi Scott,

Thank you for your interest in Essential XlsIO.

We do not have any API to check if a worksheet object has been closed or not. But you can you can check this by using below code snippet.

[C#]

try
{
workbook.Close();
}
catch (System.NullReferenceException ex)
{
MessageBox.Show("workbook is already closed");
}


Please refer the sample in the below link which illustrates the above.

http://websamples.syncfusion.com/samples/XlsIO.Windows/66721/main.htm

Please try this and let me know if this helps.

Thanks,
Melba

CONFIRMATION

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.

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.

;