Default Spread Template

Posted by: laggen on 8 September 2017, 3:23 pm EST

  • Posted 8 September 2017, 3:23 pm EST

    When I put a new spread to a form it's always have VerticalAlignment = Top but I always want center.
    I can change it in the template but it's will be stored as a new template.

    is it's possible to change so it's be stored in the default template?
  • Marked as Answer

    Replied 8 September 2017, 3:23 pm EST


    You can add a line of code somewhere in the initialization code for the application (before any forms are created containing instances of FpSpread) that changes the default VerticalAlignment of new instances:

    FarPoint.Win.Spread.DefaultSpreadSkins.Default.DefaultStyle.VerticalAlignment = CellVerticalAlignment.Center;

    That should make all cells which don't have some style already applied inherit the default center vertical alignment setting. But that will only work for new instances that are created in run time; to apply that automatically in design time for new instances is much more complicated. I think you would need to create a custom control class inheriting from FpSpread, and add that code in its initialization.

    You can make a custom SpreadSkin with DefaultStyle.VerticalAlignment = CellVerticalAlignment.Center, and apply that to instances in design time using the Spread Skins editor:

    The Spread Skins editor is available in design time from the property grid with FpSpread is selected in the Windows Forms designer window, and you can use that to apply your custom skin to new instances of FpSpread.

  • Replied 8 September 2017, 3:23 pm EST

    Thanks :)
  • Replied 8 September 2017, 3:23 pm EST


    We are glad to know that your issue has been resolved.

Need extra support?

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

Learn More

Forum Channels