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

Free Support Forum - aspose.com

Worksheets properties not carried from SpreadsheetML to Workbook object

Hi,

Could you please advise on why Properties are not copied when constructing Workbook with MemoryStream from SpreadsheetML?

I load the SpreadsheetML file from the path and the xml object does contain:

<ProtectObjects>True</ProtectObjects>
<ProtectScenarios>True</ProtectScenarios>

Where the new object “new Workbook(updatedFile, loadOptions)” does not have tchem, either with loadOptions or not.

        using ( var stream = new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ) )
        {
            var xml = System.Xml.Linq.XDocument.Load(stream);
            using (var updatedFile = new MemoryStream())
            {
                xml.Save(updatedFile);
                updatedFile.Seek(0, SeekOrigin.Begin);
                return new Workbook(updatedFile, loadOptions);
            }
        } 

Thanks,
Lukasz

Oh, apologies, I have not been accurate, it does contain the Properties, however, they are false.

@acturisaspose,

Thanks for sharing us the sample code and details.

Please provide us your template SpreadsheetML file, so we could evaluate your issue on our end. Also, how do you check the properties via Aspose.Cells APIs in code?

Thank you for your prompt response.

Hereby the SpreadsheetML attached.

I check them in Debug mode. after creating Workbook object from the stream I inspect the object to see that the below are set to True instead of False.

        workbook.Worksheets[0].Protection.AllowEditingObject = true;
        workbook.Worksheets[0].Protection.AllowEditingScenario = true;<a class="attachment" href="/uploads/discourse_instance3/7127">EFile.zip</a> (2.8 KB)

EFile.zip (2.8 KB)

@acturisaspose,

Thanks for the template file.

I observed the issue as you mentioned by using the simplest lines of code with your template SpreadsheetML file. I found Worksheets protection properties are not carried from SpreadsheetML to Workbook.
e.g
Sample code:

 Workbook workbook = new Workbook("e:\\test2\\EFile.xml"); 

            workbook.Save("e:\\test2\\out1.xlsx");

I have logged a ticket with an id “CELLSNET-45687” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

I am looking forward to hearing from you.

Thanks,
Lukasz

Hi,

Would the future fix include carrying all properties from SpreadsheetML to Workbook?

I was wondering if I should log with you some other issues with properties not being carried, as I have observed that AllowInsertingHyperlink and adding a comment are not carried.

Thanks,
Lukasz

@acturisaspose,

Well, the fixed version for your issue would include the fix of your mentioned issue only. It is better you should add respective threads (one per each issue) with all the details, sample code and template files, etc. to highlight each issue, we will log appropriate tickets for your issues.

Thank you for your response

@acturisaspose

Thanks for using Aspose APIs.

This is to inform you that we have fixed your issue CELLSNET-45687 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

@acturisaspose,

Please try our latest version/fix: Aspose.Cells for .NET v17.9.5.

Your issue “CELLSNET-45687” should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-45687) have been fixed in Aspose.Cells for .NET 17.10.