Close workbook without saving

Hi


A simple question but one I couldn’t find the answer to online

How do I close a workbook created programatically with saving it. The scenario is that the creation of the workbook starts and invalid data discovered along the way means the precess has to be aborted and the workbook discarded.

Thanks in Advance
Matt

Hi,

Well, I am not very sure about your query. But I think if you don't want to save the excel file just don't use Workbook.Save() method.

The simple coding steps involved might be:

Workbook workbook = new Workbook();

// You code goes here.

Condition --> if invalid data found
{
return;
}

else
{

workbook.Save(strFilePath................);
}

Thank you.