回复 3楼figoyu的帖子
以下是我的测试代码,请参考:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- this.FpSpread1.ActiveSheetView.Cells[0, 0].BackColor = Color.Red;
- this.FpSpread1.ActiveSheetView.Cells[1, 1].BackColor = Color.Red;
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- int rowCount = this.FpSpread1.Sheets[0].RowCount;
- int colCount = this.FpSpread1.Sheets[0].ColumnCount;
- List<Cell> cells = new List<Cell>();
- for (int i = 0; i < rowCount; i++)
- {
- for (int j = 0; j < colCount; j++)
- {
- if (this.FpSpread1.Sheets[0].Cells[i,j].BackColor==Color.Red)
- {
- cells.Add(this.FpSpread1.Sheets[0].Cells[i, j]);
- }
- }
- }
- }
复制代码 |