Free Support Forum - aspose.com

Check hasMarcros with xlsx file

I’m working with xlsx file, and I want to check if the workbook contains macros with HasMacro Property --> but when checking this an exception (Object reference not set) is thrown.

Another problem is when converting to pdf, the date isn’t correctly converted.

If attached the file.
I’ working wiht Aspose.Cells 4.4.0.30 and aspose.pdf 3.6.1.11

Hi,

Related HasMacro property issue, we will figure it out soon.

For conversion issue, I think you 'd better use Worksheet.AutofitColumns() to get the proper display of the date values. Moreover, if the dates are note converted into your desired format, you may also use the following sample code to set your desired custom format for those date columns in the worksheet:

Aspose.Cells.Cells cells = wb.Worksheets[0].Cells;
Style style = wb.Styles[wb.Styles.Add()];
style.Custom = "d-mmm-yy";
StyleFlag flag = new StyleFlag();
flag.NumberFormat = true;
cells.Columns[0].ApplyStyle(style, flag);
Thank you.

Please try this attached version.

Currently for Excel2007 xlsx files, we will stripe out the macros. So this property is no use for xlsx files.

Thanks it works for me