2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Syncfusion Excel (XlsIO) library is a .NET Excel library used to create, read, and edit Excel documents. Also, converts Excel documents to PDF files. This article illustrates how to make a line break inside an Excel cell. The Excel cell should be set with wrap text first and then the text should be broken. The following complete code snippet explains this. C# using System; using Syncfusion.XlsIO; namespace LineBreak { class Program { static void Main(string[] args) { using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Excel2016; IWorkbook workbook = application.Workbooks.Create(1); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1"].CellStyle.WrapText = true; worksheet.Range["A1"].Text = String.Format("Hello\nWorld"); workbook.SaveAs("Output.xlsx"); } } } }
A working sample can be downloaded from LineBreak.zip On executing the sample, you will get the output as follows. Line Break Take a moment to peruse the documentation, where you can find basic worksheet data manipulation options along with features like Conditional Formatting, worksheet calculations through Formulas, adding Charts in worksheet or workbook, organizing and analyzing data through Tables and Pivot Tables, appending multiple records to worksheet using Template Markers, and most importantly PDF and Image conversions etc. with code examples. Click here to explore the rich set of Syncfusion Excel (XlsIO) library features. Note: Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer the link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.
|
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.