您好,
我使用以下代码,没有能够重现问题,您看下是否遗漏了关键的步骤
- fpSpread1.ActiveSheet.Cells[0, 0].Text = "测试";
- fpSpread1.ActiveSheet.Cells[0,1].ColumnSpan = 4;
- fpSpread1.ActiveSheet.Cells[0, 1].Text = "很长很长\n很长很长很长\n很长很长很长很长很长很\n长很长很长很长长很长很长很长长很长很长很长";
- MaxNum = 12;
- FarPoint.Win.Spread.CellType.EnhancedColumnHeaderRenderer ecr = new FarPoint.Win.Spread.CellType.EnhancedColumnHeaderRenderer();
- ecr.WordWrap = true;
- fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer = ecr;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- /**
- float len_txt = 0;
- for (int i = 0; i < MaxNum; i++)
- {
- len_txt = fpSpread1.ActiveSheet.GetPreferredColumnWidth(i);
- fpSpread1.ActiveSheet.Columns[i].Width = len_txt;
- }
- * */
- float len_txt = 0;
- for (int i = 0; i < MaxNum; i++)
- {
- len_txt = fpSpread1.ActiveSheet.GetPreferredRowHeight(i);
- fpSpread1.ActiveSheet.Rows[i].Height = len_txt;
- }
- }
复制代码
另外,我测试的版本是最新8.1,不知道您的版本是多少? |