Posted 16 June 2021, 7:26 pm EST
Hello,
I am trying to set the HorizontalAlignment & VerticalAlignment at the column level.
for (int i = 1, iteratorTest = modAlias.gnDeepestLevel; i <= iteratorTest; i++)
{
SS.ActiveSheet.SetColumnWidth(i - 1, 20);
SS.ActiveSheet.ColumnHeader.Columns[i - 1].CellType = new FarPoint.Win.Spread.CellType.ImageCellType(); // Picture
SS.ActiveSheet.ColumnHeader.Columns[i - 1].Label = String.Empty;
FarPoint.Win.Spread.Column col = SS.ActiveSheet.Columns[i - 1];
col.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;
col.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;}
It works fine when the winform loads but when the columns of Spread sheet are dragged and resized, the HorizontalAlignment changes to left( the image appears to be on left in the cell instead of being at center when dragged).
My question is: How can i maintain the alignment to be at Centre even after columns being resized??