CustomDocumentProperties for Excel2007

Hello,

I tried to save CustomDocumentProperties in my excel document using latest Aspose.Cell release and custom properties are not saved.

I used the following code

Dim Workbook As New Aspose.Cells.Workbook

Workbook.Open(_FileName, Aspose.Cells.FileFormatType.Excel2007Xlsx)

Workbook.Worksheets.CustomDocumentProperties.Add([Property].PropertyName, [Property].PropertyValue)

Workbook.Save(_FileName, Aspose.Cells.FileFormatType.Excel2007Xlsx)

Is there something wrong with my code or this feature is not supported for Excel 2007?

Thnks in advance.

Hi,

We will support setting document properties for Excel2007 .xlsx file soon.

Thank you.

Hi,

Please try the attached version. This version supports to read and save custom properties to .xlsx files.

Thank you,

Hello,

I am trying 4.1.1.9. Custom properties are fine now.

But I can see that builtin properties doesn't work (except Title and Author)

BR,

Olexandr

Hi Olexandr,

Could you give us sample file with code, we will check it soon.

Thank you.

The code is pretty simple (StandardProperties is my class, any text constants could be used here)

Workbook.Open(_FileName, Aspose.Cells.FileFormatType.Excel2007Xlsx)

Workbook.Worksheets.BuiltInDocumentProperties.Author = StandartProperties.Author.PropertyValue

Workbook.Worksheets.BuiltInDocumentProperties.Category = StandartProperties.Category.PropertyValue

Workbook.Worksheets.BuiltInDocumentProperties.Comments = StandartProperties.Comments.PropertyValue

Workbook.Worksheets.BuiltInDocumentProperties.Company = StandartProperties.Company.PropertyValue

Workbook.Worksheets.BuiltInDocumentProperties.Keywords = StandartProperties.Keywords.PropertyValue

Workbook.Worksheets.BuiltInDocumentProperties.Manager = StandartProperties.Manager.PropertyValue

Workbook.Worksheets.BuiltInDocumentProperties.Subject = StandartProperties.Subject.PropertyValue

Workbook.Worksheets.BuiltInDocumentProperties.Title = StandartProperties.Title.PropertyValue

Workbook.Save(_FileName, Aspose.Cells.FileFormatType.Excel2007Xlsx)

Hi,

I used a template .xlsx file and following is my code which works fine (I retrieve all the properties values at runtime) except for the Category property:

Workbook workbook = new Workbook();
workbook.Open("d:\\test\\companybuiltin.xlsx",FileFormatType.Excel2007Xlsx);
DocumentProperties customProperties = workbook.Worksheets.BuiltInDocumentProperties;

DocumentProperty customProperty1 = customProperties["Author"];
string prop1 = (string)customProperty1.Value;
MessageBox.Show(prop1);

DocumentProperty customProperty2 = customProperties["Category"];
string prop2 = (string)customProperty2.Value;
MessageBox.Show(prop2);

DocumentProperty customProperty3 = customProperties["Comments"];
string prop3 = (string)customProperty3.Value;
MessageBox.Show(prop3);

DocumentProperty customProperty4 = customProperties["Company"];
string prop4 = (string)customProperty4.Value;
MessageBox.Show(prop4);

DocumentProperty customProperty5= customProperties["Keywords"];
string prop5 = (string)customProperty5.Value;
MessageBox.Show(prop5);

DocumentProperty customProperty6= customProperties["Subject"];
string prop6 = (string)customProperty6.Value;
MessageBox.Show(prop6);

DocumentProperty customProperty7= customProperties["Title"];
string prop7 = (string)customProperty7.Value;
MessageBox.Show(prop7);

DocumentProperty customProperty8= customProperties["Manager"];
string prop8 = (string)customProperty8.Value;
MessageBox.Show(prop8);

Thank you.

Some document properties are not supported yet, we will fix it soon. Thank you.

Hi Amjad,

I have problems not with gettin properites but with setting and saving them, but as I understand reply

karen.huang this feaure is not implemented yet (I find it strange that the feature is implemented for Aspose.Words as Word and Excel store builtin properties in a very similar way)

BR

Hi,

The attached version fixed this built-in properties issue. Please try it.

To the other issue about CalulateFormula exception from the post:

File “ASposeCantOpenIt.xlsx” contains Excel 2007 feature table and currently Aspose.Cells does not support to count table’s formula. So, if you call “CalculateFormula()”, a CellsException will thrown out.

If you need to know whether the exception is due to unsupported formula, please inform us, we can provide you a fix to throw an “unsupportedFormula” exception

Thank you

karen.huang:

If you need to know whether the exception is due to unsupported formula, please inform us, we can provide you a fix to throw an “unsupportedFormula” exception

Hi,

I would really appreciate such fix to be able to habdle this exception correctly.

But I have one question here: if the exception occurs will other formulas which are located after the unsupported one be calculated in the book when the exception occurs?

Thanks in advance

Hi,

I think you may utilize Workbook.CalculateFormula(true) for it.

Thank you.

Hello,

I've tried to use

Workbook.Open(_FileName, Aspose.Cells.FileFormatType.Excel2007Xlsx)

Workbook.CalculateFormula(True)

Workbook.Save(_FileName, Aspose.Cells.FileFormatType.Excel2007Xlsx)

and here is what I got - in attachment you can find two documents. The document "AfterCalculate EDIT ASposeCantOpenIt D44600-Wh 1.0.xlsx" was saved by Aspose after I executed CalculateFormula(True). Now excel says that the document is corrupted and suggest me to repair it.

We will check it soon. Thank you.

Hi,

Please try the attached fix.

Workbook.CalculateFormula() will throws CellsException with ExceptionType.Formula when it encounter unsupported formulas.

Workbook.CalculateFormula(True) will ignore calculate formula error and the exceptions will be swallowed.

Thank you

Hello,

4.1.1.12 helped me

Thank you