本帖最后由 Richard.Ma 于 2020-11-10 12:01 编辑
通过给单元格文本添加换行符可以实现你的需求,比如你提到的helloworld,分割后加入“\n”,再拼接就行
- fpSpread1.ActiveSheet.ActiveCell.CellType = new TextCellType() { Multiline = true, WordWrap = true };
- string[] warpstring= fpSpread1.ActiveSheet.ActiveCell.Value.ToString().Split(new char[] { 'w' }); ;
- fpSpread1.ActiveSheet.ActiveCell.Value = warpstring[0] + "\nw" + warpstring[1];
- fpSpread1.ActiveSheet.ActiveRow.Height = fpSpread1.ActiveSheet.ActiveRow.GetPreferredHeight();
复制代码
|