Free Support Forum - aspose.com

ExportDataTableAsString + Sheet Protection

Hi,

Im exporting records to a datatable. Some of the cells / columns are protected in the range that i’m exporting.

If I do the export, the protected cells values comes back as a ‘0’…I need to get the actual value in the cell.
Can some one please advise!!!

<----- code snippet ----->
dataTable = sheet.Cells.ExportDataTableAsString(11, 1, 40, 5);
< ----------------------->

columns B, C and D are protected.

thanks

I don’t think it’s caused by sheet protection. What happens if you remove the sheet protection? Could you please post your file here? Thank you.

Hi, thanks for the QUICK response…

he he, I also don’t think it is the sheet protection.
The cells that are protected contains formulas. The formula is a referance to the first sheet!
For example:
=Sheet1!B12
=Sheet1!B13
etc…

I think the ExportDataTable works with the formula and does not return the actual value in the cell.

Is there a way that I can get the actual value return to the DataTable?

Regards

Since those cells contain formula, you should call Excel.CalculateFormula method first to get the result of those cells.

Thanks for the ver very quick response.

Only one problem…
seeing as the Excel.CalculateFormula is a Enterprise version function and we are only looking at purchasing the Professional version, I have to do it the longer way by reading the cell values and add it to the datatable. Not such a big hastle though!!!