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 КБ)