Shared formulas disappear in Cells for C++

I have a problem in Aspose.Cells for C++. If I open a file and then save it, formulas in some cells disappear. Just the values remain.

The probable reason - shared formulas. It looks like Aspose saves the formula in the first cell only, and Excel doesn’t understand it.

Here is a simple example. aiTest.cpp reads the content from test.xlsx and saves it to result.xlsx. Formulas disappear in the cells marked by yellow. I use 32 bit library, version 24.1.

Could you help me with this issue?

Source code:

int main(int argc, const char* argv[])
{
::SetConsoleOutputCP(CP_UTF8);
if (argc < 2)
{
std::cout << “aiTest.exe infile [outfile]” << std::endl;
return 0;
}
Aspose::Cells::Startup();

License license;
try
{
license.SetLicense(u"ai.lic");
}
catch (…)
{
std::cout << “Invalid license” << std::endl;
}

Workbook book((Workbook_Impl*)nullptr);
try
{
book = Workbook(argv[1]);
}
catch (…)
{
std::cout << "Failed to open file " << argv[1] << std::endl;
return -1;
}
std::cout << "Open file " << book.GetFileName().ToUtf8() << std::endl;

if (argc > 2)
{
try
{
book.Save(argv[2]);
}
catch (…)
{
std::cout << “Failed to save file” << argv[2] << std::endl;
return -1;
}
std::cout << "Save file " << book.GetFileName().ToUtf8() << std::endl;
}

Aspose::Cells::Cleanup();
return 0;
}
shared.7z (18,9 КБ)

@riadma,

Thanks for the sample files.

After an initial test, I was able to reproduce the issue as you mentioned. I found that simply loading and re-saving your XLSX file removed some shared formulas and inserted resultant values into those cells instead of formulas in the output XLSX file.

We require thorough evaluation of your issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSCPP-1052

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@riadma
The bug will be fixed in Aspose.Cells for C++ v24.2. Thanks.

The issues you have found earlier (filed as CELLSCPP-1052) have been fixed in this update. This message was posted using Bugs notification tool by duojie.yang