ALT + ENTER feature in Excel using Aspose.Cells for .NET

Hi,

I want to know, How to achieve the ALT+ENTER functionality (in Excel) programatically in aspose cell. I need to explicitly make the text wrapping workout without setting the textwrapper property.

Thanks.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

I am afraid, the feature as per your request is not available. You will have to set the Style.IsTextWrapped to make the text wrapped.

Please check the complete runnable code that can be used by you as a workaround. I have also attached the output file generated by the code and screenshot for your reference.

C#


Workbook workbook = new Workbook();


Worksheet worksheet = workbook.Worksheets[0];


Cell cell = worksheet.Cells[“A1”];


cell.PutValue(“Some text wrapped.\r\nSome text wrapped.”);


Style style = cell.GetStyle();

style.IsTextWrapped = true;

cell.SetStyle(style);


workbook.Save(“output.xlsx”, SaveFormat.Xlsx);

Screenshot: