There is a limit in Excel for header and/or footer length. It is 255 characters. See https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3. But apache poi does not considering that limit while using org.apache.poi.ss.usermodel.Header and Footer. So using apache poi it is possible crating corrupt Excel files when header and/or footer length is greater than 255 characters. That should be avoided.