Save workbook even if folder doesn't exist

Hi,

I just wondering if there is a way save a workbook when the destination folder is not created yet.

In others words have aspose.cells create the directory on the fly.

I know the usuall way to save is workbook.save(filepath)

but another is workbook.save(filepath,xlsSaveOptions)

so I wonder if inside xlsSaveOptions there is a way to force folder creation when they don't exist as requere by filepath

thanks

Hi,

I am afraid, this feature does not exist and also it does not look relevant to me. Because xlsSaveOptions are related specifically to excel files while this feature relates to disk I/O.

Anyway, we will further think on it and decide if it should be added.

BTW, you can easily create your own custom function that checks the path of the output file and if the folder does not exist, create a folder.

Hi,

We have fixed this issue.

Please download: Aspose.Cells for .NET v6.0.1.7

We have added a new property SaveOptions.CreateDirectory.

C#


Workbook workbook = new Workbook();

XlsSaveOptions saveOptions = new XlsSaveOptions();

saveOptions.CreateDirectory = true;

workbook.Save(“D:\ddddd\test.xls”,saveOptions);


Thank you for your response.

This is a good feature to have it help makes our code easy to follow