Why does LibreOffice ignore Apache poi setLandscape(true) option where MS Excel does not

I wanted to change excel page orientation to horizontal(landscape), so I used apache poi method PrintSetup.setLandscape(true).
Unfortunetly It seems not working approprietly in Libre office, though I can see it right in MS Office.
The settings show that Landscape option is selected, but right picture shows portrait.
What LibreOffice show you and what LibreOffice’settings have are different.
I don’t know how to resolve it.
I will take any advice appreciate. Thank you.

When the file is opened in Libre Office and MS Office,

Just file a bug report, attaching the problematic generated file.

I submitted.

Please always mention where did you submit that. Without that, your notification helps no one who would want to track the progress.

That is tdf#147238.

Problem with custom paper size. When opened in LO, the page orientation is landscape. If in LO you change the paper size to, for example, A4, then everything is displayed correctly.

I don’t know this is right solution, but I used Apache poi XSSF PrintSetup setLandscape(false).
This is working as I intended. I guess Libre Office has something about page orientation that is reverse of MS Office.

The layout of print pages is controled by page styles. This is a concpet that does not exist in MS Office. As a matter of course LibreOffice can import MS Office files but it is not a native editor for these proprietary file formats. LibreOffice has its own set of file formats which are not proprietary.