Free Support Forum - aspose.com

Erroneous circular reference detection

Dear Sirs:

We generated the attached workbook with Aspose .Cells for .Net 4.4.1.17. When we load it into Excel it complains about a circular reference in cell Shares!C30 (and D30, etc.) When you go into that cell and hit F2 / Enter the value stays the same and the error goes away, so that shows that it had the correct number and it's not actually circular. The interesting thing about this expression is that it might be circular if it used the other branch of the IF, but it doesn't.

Also, we autofit the columns in Aspose, but I noticed that column B on this same sheet is too wide. If I auto-fit in Excel it changes to the correct width.

Thanks,
--Howard

Hi Howard,

Please try this attached version.

Laurence, thanks for the update. When I create an XLS with this version and open it in Excel 2003 I get the error "File error: data may have been lost." The file, however, does open and the circular reference errors are gone. I have attached the XLS. The problem appears related to cell Shares!B29. If you look at the previous version of the XLS you'll see in this cell:

=IF('Default Input'!B5=1,0.8,IF(PREV("#BADINDEX!")<500000,0.8,1))*B30

Now, the prev(...) nonsense is irrelevant in this computation as 'Default Input'!B5 is 1. In earlier versions this worked as expected, whereas in the latest version this causes file corruption and #N/A to appear in the cell. Also, I can paste this formula into B29 in Excel and it works as expected. When I change our code to not generate the unused branch of the IF the XLS file appears correct.

The column width problem persists in the XLS as attached but not in the one that loads correctly.

Regards,
Howard

Hi Howard,

Thanks for the template excel file.

Thanks for your further feedback, We will check and figure it out soon.

Thank you.

This problem is caused by Shares!B29. I fixed it in the attached version. Please try it.

Laurence, this version fixes the problem. Thanks!

--Howard