0

In my program I create an excel file with a formula containing a reference to a table (listobject). When opening the resulting excel file the formula shows the #NAME? error until the user selects the formula and exits it again.

First I do:

worksheet.Cells["A2"].Formula = "=INDEX(personData, MATCH(B2, personData[displayName]), 0)";
workbook.CalculateFormula();

When I open the resulting workbook in excel the formula for A2 is slightly changed in capitalization:

=INDEX(PERSONDATA,MATCH(B2,personData[displayName]),0)

When focusing the formula and exiting again the formula becomes

=INDEX(personData,MATCH(B2,personData[displayName]),0)

What's the source of the capitalization?
What am I missing?

UPDATE
I've been able to narrow the problem down to the fact that the formula breaks when the referenced table is on another tab than the formula. When I move it to the same tab everything works as expected.
Updating the aspose.cells library to the most current version of aspose.cells (8.6.0.0) didn't help. Adding a tab reference to the referenced (lookup!personData) name is invalid.

Posted short post and example code on Aspose forum as requested: http://www.aspose.com/community/forums/permalink/658097/658097/showthread.aspx#658097

4

1 回答 1

2

在我看来,Aspose.Cells 是一个错误。请尝试最新版本:Aspose.Cells for .NET 8.5.2(从 Aspose 网站下载),它应该可以解决此问题。还请在 Aspose.Cells 论坛上发布此问题以及您的示例 excel 文件,以便我们可以运行您的代码并找出问题的根本原因。

大多数情况下,这样的错误意味着 Aspose.Cells 无法计算公式。您能否也将您的工作簿保存为 PDF 格式,看看它是否显示正确的值或错误。

注意:我在 Aspose 担任开发人员布道师

于 2015-09-21T03:15:11.777 回答