- private void buttonItem21_Click(object sender, EventArgs e)
- {
- SheetView sv_洞身衬砌表 = fpSpread1.Sheets["洞身衬砌表"];
- if (sv_洞身衬砌表 == null)
- return;
- SheetView sv_洞室表 = this.fpSpread1.Sheets["洞室表"];
- if (sv_洞室表 == null)
- return;
- sv_洞室表.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1;
- //第一步:导入衬砌分段表的里程
- int LinRow = sv_洞身衬砌表.NonEmptyRowCount;//使用的行数(包括表头2行)
- for (int i = 0; i < LinRow - 2; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- sv_洞室表.Cells[i + 3, 14 + j].Value = sv_洞身衬砌表.Cells[i + 2, 1 + j].Value;//
- }
- for (int k = 0; k < 6; k++)
- {
- string FormlaString = "INDEX(FREQUENCY(R4C" + (k * 2 + 2).ToString() + ":R1000C" + (k * 2 + 2).ToString() + ",R4C15" + ":R" + (LinRow + 2).ToString() + "C15" + ")," + (i + 2).ToString() + ")"; //"IF(ISERROR(VLOOKUP(RC38,词典!R3C1:R300C16," + n.ToString() + ",0)),\"\",VLOOKUP(RC38,词典!R3C1:R300C16," + n.ToString() + ",0))";
- sv_洞室表.Cells[i + 3, k + 18].Formula = FormlaString;
- }
- }
- //注意:里程列需要终点里程,这样才能统计最后一段的洞室
- sv_洞室表.Cells[LinRow + 1, 14].Formula = "R[-1]C[1]";
- sv_洞室表.Cells[LinRow + 1, 14].BackColor = Color.DarkOliveGreen;
-
- }
复制代码 |