auto rotate view based on max dimension of flat c#

I have a macro that auto generate flats, add values from custom properties and auto dimension of flat for manufacturing process. On flat view the dimension are automated I can retrieve the dimensions list from this view, but I want to rotate it if dimension on Y is bigger than X.

1) Do we have a function or method for specific dimensions placed horizontal or vertical to use it later as flag for rotation by comparing values.

2) Another hypothesis is to retrieve the view dimensions and rotate it ??

I hope I made my self clear.

Thank you

SolidworksApi macros