If you are running a ForNAV report based on version 5.3 or earlier in Business Central 16 or newer, you might run into the following error when you save your report as an Excel document:
A transaction must be started before changes can be made to the database.
Microsoft Excel export problems are typically caused by problems in the exported data or a version mismatch between the loaded and required version of a Microsoft.NET assembly named DocumentFormat.OpenXml.
If it is a data problem, then you can often solve it by following the Excel Troubleshooting guide to collect debug data.
If it is the assembly problem, you can see something similar to the following in your event log on the service tier machine:
The message in the event log is:
The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Solution
Download the installer OpenXMLSDKV25.msi.
https://github.com/OfficeDev/Open-XML-SDK/releases/tag/v2.5
After installing this MSI package, the required assembly in the required version 2.5 is in the Assembly GAC on the computer.
You must RESTART your service tier after installing the package. Otherwise, it will not see the installed file.