回复 7楼dof的帖子
下面的代码怎么能让三个“13”和后面的“07”都合并呢?第一列可以正常合并,但最后一列不行。
“13”那个如果放上面一行就合并,放下面就不合并,这个有办法么?
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private DataTable dtData = new DataTable();
- private void Form1_Load(object sender, EventArgs e)
- {
- dtData.Columns.Add(new DataColumn());
- dtData.Columns.Add(new DataColumn());
- dtData.Columns.Add(new DataColumn());
- dtData.Columns.Add(new DataColumn());
- dtData.Columns.Add(new DataColumn());
- dtData.Columns.Add(new DataColumn());
- dtData.Columns.Add(new DataColumn());
- dtData.Columns.Add(new DataColumn());
- for (int i = 0; i < 20000; i++)
- {
- DataRow drData = dtData.NewRow();
- drData[0] = "00" + i;
- drData[1] = "01";
- drData[2] = "02";
- drData[3] = "03";
- drData[4] = "04";
- drData[5] = "05";
- drData[6] = "06";
- drData[7] = "07";
- dtData.Rows.Add(drData);
- drData = dtData.NewRow();
- drData[0] = "00" + i;
- drData[1] = "11";
- drData[2] = "12";
- drData[3] = "13";
- drData[4] = "13";
- drData[5] = "13";
- drData[6] = "16";
- drData[7] = "07";
- dtData.Rows.Add(drData);
- }
- fpSpread1_Sheet1.RowCount = 0;
- fpSpread1_Sheet1.RowCount = 10;
- }
- private void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
- {
- fpSpread1_Sheet1.RowCount = dtData.Rows.Count;
- fpSpread1.ActiveSheet.SetRowMerge(-1, FarPoint.Win.Spread.Model.MergePolicy.Restricted);
- fpSpread1.ActiveSheet.SetColumnMerge(-1, FarPoint.Win.Spread.Model.MergePolicy.Restricted);
- fpSpread1.SetBounds(fpSpread1.Bounds.X, fpSpread1.Bounds.Y, fpSpread1.Bounds.Width + 1, fpSpread1.Bounds.Height);
- fpSpread1.ActiveSheet.DataAutoSizeColumns = false;
- fpSpread1.ActiveSheet.DataSource = dtData;
- }
- }
复制代码 |