如何插入编程在C#中的Excel单元格的新行? [英] How to insert programmatically a new line in an Excel cell in C#?
问题描述
我使用的Aspose库创建一个Excel文档。某处在一些小区,我需要插入文本的两个部分之间新的线路。
I'm using the Aspose library to create an Excel document. Somewhere in some cell I need to insert a new line between two parts of the text.
我试图为\ r \ N的,但它不工作,只显示两个方形符号细胞。不过,我可以preSS Alt + Enter键创建在同一小区中的换行。
I tried "\r\n" but it doesn't work, just displays two square symbols in cell. I can however press Alt+Enter to create a new line in that same cell.
我要如何插入新行编程?
How do I insert a new line programmatically?
推荐答案
从细胞的Aspose论坛:<一href="http://www.aspose.com/community/forums/thread/163248/how-to-use-new-line-char-with-in-a-cell.aspx">How在单元格中使用新行字符用?
From the Aspose Cells forums: How to use new line char with in a cell?
在提供的文字,你应该设置单元格的IsTextWrapped风格真正
After you supply text you should set the cell's IsTextWrapped style to true
worksheet.Cells[0, 0].Style.IsTextWrapped = true;
这篇关于如何插入编程在C#中的Excel单元格的新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!