HorizontalAlignment doesn't work upon Column resized

Posted by: abhishek1991rana on 16 June 2021, 7:26 pm EST

  • 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??

  • Posted 16 June 2021, 10:53 pm EST - Updated 30 September 2022, 4:19 am EST

    Hi,

    The Alignment should remain same even after resizing/moving a column.

    I created a simple application using your code and I noticed no issues.

    Please see the attached GIF.

    Let me know if I’m missing anything to observe the issue you have described.

    Regards,

    Jitender

  • Posted 17 June 2021, 4:46 pm EST

    Hey, Thanks :slight_smile:

    It worked for me.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels