你可以通过NamedStyle来管理。你可以将需要的样式,设置给NamedStyle,并把它应用到Cell上,一旦要清楚,将其删除即可。代码示例如下:- FarPoint.Win.Spread.NamedStyle backstyle = new FarPoint.Win.Spread.NamedStyle("BlueBack");
- backstyle.BackColor = Color.Blue;
- FarPoint.Win.Spread.NamedStyle text1style = new FarPoint.Win.Spread.NamedStyle("OrangeText", "BlueBack");
- text1style.ForeColor = Color.Orange;
- FarPoint.Win.Spread.NamedStyle text2style = new FarPoint.Win.Spread.NamedStyle("YellowText", "BlueBack");
- text2style.ForeColor = Color.Yellow;
- fpSpread1.NamedStyles.Add(backstyle);
- fpSpread1.NamedStyles.Add(text1style);
- fpSpread1.NamedStyles.Add(text2style);
- fpSpread1.ActiveSheet.Cells[0,0,4,0].StyleName = "OrangeText";
- fpSpread1.ActiveSheet.Cells[0,1,4,1].StyleName = "YellowText";
复制代码 |