xls file is corrupted after upgrading apache poi from version 4.0.1 to the latest versions ( version 4.1.2 and version 5.0.0)

The below code works fine with apache poi version 4.0.1 but after upgrading apache poi to the latest versions (version 4.1.2 or version 5.0.0) the xls file generated is corrupted and when i try to …