We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Workbook.SaveOptions.CreateDirectory does not work

I am using the sample encrypted workbook found in your example projects. The option to create the output directory when it does not exist is not working.

Aspose.Cells.LoadOptions opts = new Aspose.Cells.LoadOptions();
opts.Password = "1234";
Aspose.Cells.Workbook wb = new Workbook(@"..\..\data\encrypted.xls", opts);
wb.Decrypt("1234");
wb.SaveOptions.CreateDirectory = true;
wb.Save(@"c:\temp\decrypted\decrypted.xls");

Save() throws error: "Could not find a part of the path 'c:\temp\decrypted\decrypted.xls'."

This code runs correctly if "c:\temp\decrypted" is created first.

Hi Jeff,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after running your sample code with the latest version: Aspose.Cells
for .NET v8.3.0.4
. The code throws exception as you mentioned instead of creating a directory.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43229 - Workbook.SaveOptions.CreateDirectory does not work.

Hi Jeff,

Thanks for using Aspose.Cells.

Please change the code as the following

C#


XlsSaveOptions saveOptions = new XlsSaveOptions();

saveOptions.CreateDirectory = true;


// workbook.SaveOptions.CreateDirectory = true;

workbook.Save(@“d:\temp\decrypted\decrypted.xls”, saveOptions);


We will obsolete Workbook.SaveOptions property in the next fix.

Please see the full modified code for your reference.

C#

Aspose.Cells.LoadOptions opts = new Aspose.Cells.LoadOptions();

opts.Password = “1234”;

Aspose.Cells.Workbook wb = new Workbook(@"…\data\encrypted.xls", opts);

wb.Decrypt(“1234”);


XlsSaveOptions saveOptions = new XlsSaveOptions();

saveOptions.CreateDirectory = true;


wb.Save(@“c:\temp\decrypted\decrypted.xls”, saveOptions);

This works great.


Thank you.

Hi Jeff,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

The issues you have found earlier (filed as CELLSNET-43229) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.