Scenario: Aspose.Cells 24.8. Create a protected XLS file with built-in properties. Then open this file.
Issue: Invalid values of Category and ContentStatus properties.
var wb = new Workbook()
{
BuiltInDocumentProperties =
{
Category = "category",
ContentStatus = "contentStatus",
}
};
wb.Protect(ProtectionType.All, "p1");
var xlsStream = new MemoryStream();
wb.Save(xlsStream, new XlsSaveOptions() { });
xlsStream.Position = 0;
var wb2 = new Workbook(xlsStream, new LoadOptions(LoadFormat.Excel97To2003)
{ Password = "p1" });
var bip = wb.BuiltInDocumentProperties;
var bip2 = wb2.BuiltInDocumentProperties;
Assert.Multiple(() =>
{
Assert.That(bip2.Category, Is.EqualTo(bip.Category),
"Invalid Category");
Assert.That(bip2.ContentStatus, Is.EqualTo(bip.ContentStatus),
"Invalid ContentStatus");
});
Thanks.
For internal reference: MDP-18515.
@oleksii88
It seems you are encountering an issue with the Category
and ContentStatus
properties in an Excel file created using Aspose.Cells. When you create a protected XLS file and then read it back, the values of these built-in properties are not as expected.
Here are a few points to consider:
-
Built-in Properties: The Category
and ContentStatus
properties are built-in document properties in Excel. According to the Aspose.Cells documentation, while you can set these properties, they are system-defined and may not always behave as expected when the document is saved and reloaded.
-
Protection and Saving: When you protect a workbook and save it, there might be some internal handling of the document properties that could lead to unexpected values upon reloading. This could be a result of how the protection is applied or how the properties are serialized in the XLS format.
-
Version Compatibility: Ensure that the version of Aspose.Cells you are using is up to date, as there may have been fixes or improvements related to document properties in newer releases.
-
Testing with Different Formats: If possible, try saving the workbook in a different format (like XLSX) and see if the issue persists. This can help determine if the problem is specific to the XLS format.
-
Reporting the Issue: Since you mentioned an internal reference (MDP-18515), it might be beneficial to report this issue to Aspose support if it continues to be a problem. They can provide more specific guidance or a fix if this is a known issue.
Here’s a sample code snippet that demonstrates how to set built-in properties and protect a workbook:
var wb = new Workbook()
{
BuiltInDocumentProperties =
{
Category = "category",
ContentStatus = "contentStatus",
}
};
wb.Protect(ProtectionType.All, "p1");
var xlsStream = new MemoryStream();
wb.Save(xlsStream, new XlsSaveOptions() { });
xlsStream.Position = 0;
var wb2 = new Workbook(xlsStream, new LoadOptions(LoadFormat.Excel97To2003)
{ Password = "p1" });
var bip2 = wb2.BuiltInDocumentProperties;
Console.WriteLine($"Category: {bip2.Category}, ContentStatus: {bip2.ContentStatus}");
This code sets the properties, protects the workbook, and then reads the properties back. You can use this as a basis for further testing.
If the issue persists, please consider reaching out to Aspose support for more detailed assistance.
@oleksii88
By testing with sample code on the latest version v24.8, we can reproduce the issue. Found Category and ContentStatus properties in created XLS with incorrect values.
var wb = new Workbook()
{
BuiltInDocumentProperties =
{
Category = "category",
ContentStatus = "contentStatus",
}
};
wb.Protect(ProtectionType.All, "p1");
var xlsStream = new MemoryStream();
wb.Save(xlsStream, new XlsSaveOptions() { });
xlsStream.Position = 0;
var wb2 = new Workbook(xlsStream, new LoadOptions(LoadFormat.Excel97To2003)
{ Password = "p1" });
var bip = wb.BuiltInDocumentProperties;
Console.WriteLine($"Category: {bip.Category}, ContentStatus: {bip.ContentStatus}");
var bip2 = wb2.BuiltInDocumentProperties;
Console.WriteLine($"Category: {bip2.Category}, ContentStatus: {bip2.ContentStatus}");
The output:
Category: category, ContentStatus: contentStatus
Category: contentStatus, ContentStatus:
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-56458
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@oleksii88
We are pleased to inform you that your issue has been resolved. The fix will be included in our upcoming release (Aspose.Cells for .NET 24.9) that we plan to release in the first half of September 2024. You will be notified when the next version is released.
The issues you have found earlier (filed as CELLSNET-56458) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi