DialogResult dlg;
FarPoint.Win.Spread.NamedStyle ns = new FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault");
ns.BackColor = Color.LightBlue;
ns.Border = new FarPoint.Win.LineBorder(Color.DarkBlue, 2);
ns.CellType = new FarPoint.Win.Spread.CellType.TextCellType();
ns.Editor = new FarPoint.Win.Spread.CellType.TextCellType();
ns.Font = new Font("Comic Sans Serif", 12);
ns.ForeColor = Color.Red;
ns.Formatter = new FarPoint.Win.Spread.CellType.TextCellType();
ns.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right;
ns.Locked = true;
ns.Name = "StyleData";
ns.Parent = "DataAreaDefault";
ns.Renderer = new FarPoint.Win.Spread.CellType.TextCellType();
ns.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Bottom;
fpSpread1.NamedStyles.Add(ns);
fpSpread1.ActiveSheet.Cells[0, 0].StyleName = "StyleData";
fpSpread1.ActiveSheet.SetText(0, 0, "NamedStyle");
fpSpread1.ActiveSheet.Columns[0].Width = 120;
fpSpread1.ActiveSheet.Rows[0].Height = 80;
dlg = MessageBox.Show("Do you want to reset the named style?", "Reset", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
ns.ResetBackColor();
ns.ResetBorder();
ns.ResetCellType();
ns.ResetEditor();
ns.ResetFont();
ns.ResetForeColor();
ns.ResetFormatter();
ns.ResetHorizontalAlignment();
ns.ResetLocked();
ns.ResetParent();
ns.ResetProperty(FarPoint.Win.Spread.SheetStyleProperty.VerticalAlignment);
ns.ResetRenderer();
ns.ResetVerticalAlignment();
}