以下代码是否满足你的需求:
- FarPoint.Win.Spread.Model.CellRange cr = fpSpread1.ActiveSheet.GetSelection(0);
- Font font = new Font(toolStripComboBox1.Text, fpSpread1.Font.Size, fpSpread1.Font.Style);
- if (toolStripComboBox1.Text != "")
- {
- for (int i = cr.Row; i < cr.Row + cr.RowCount; i++)
- {
- for (int j = cr.Column; j < cr.Column + cr.ColumnCount; j++)
- {
- if (fpSpread1.ActiveSheet.Cells[i, j].Font == null)
- fpSpread1.ActiveSheet.Cells[i, j].Font = font;
- else
- fpSpread1.ActiveSheet.Cells[i, j].Font = new Font(toolStripComboBox1.Text, fpSpread1.ActiveSheet.Cells[i, j].Font.Size, fpSpread1.ActiveSheet.Cells[i, j].Font.Style);
- }
- }
- }
复制代码 |