90
Views
3
Comments
[Advanced Excel] Cell Vertical Alignment not working
Question
advanced-excel
Service icon
Forge asset by Carlos Freitas

When I set the CellFormat.VerticalAlignment to 0 the documentation implies that the vertical alignment of the cell will be set to Top. This does not work. The problem lies in the extensions ApplyFormatToRange method. The line "if (format.ssSTCellFormat.ssVerticalAlignment > 0)" should be testing for greater than or equal 0 e.g. "if (format.ssSTCellFormat.ssVerticalAlignment >= 0)". Making this change fixes the problem. 

I think there are also other tests in that method e.g. for ssHorizontalAlignment which should be changed in the same way.

Regards,

Nick

2017-06-27 09-39-19
Jan Hidding

Hello,

Is this already implemented in the latest version, because the vertical alignment to the top of a cell is still not working.

2025-09-25 22-50-38
Hanno

Hi Jan

If it is not working as expected, I guess the code hasn't been fixed yet ;)

I'll have a look and revert ASAP.

Hanno

2025-09-25 22-50-38
Hanno

Hi Jan

This is now fixed in the latest version.

Thanks for bringing it to my attention again!

Hanno

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.