Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
To ensure that text in a cell can be read, explicit line breaks and text wrapping can be applied. Text wrapping turns one line into several in a cell, while explicit line breaks put breaks exactly where you want them.
To wrap text in a cell, use the Style.setTextWrapped method.
Java
// Add Text to the First Cell with Explicit Line Breaks
cell.get(0, 0).setValue("I am using \nthe latest version of \nAspose.Cells \nto test this functionality");
// Get Cell's Style
Style style = cell.get(0, 0).getStyle();
// Set the Text Wrap property to true
style.setTextWrapped(true);
// Set Cell's Style
cell.get(0, 0).setStyle(style); CellStyle.setWrapText should be set to true for wrapped text.
Java
Row row = sheet.createRow(2);
Cell cell = row.createCell(2);
cell.setCellValue("Use \n with word wrap on to create a new line");
// To enable newlines you need to set a cell style with wrap=true
CellStyle cs = wb.createCellStyle();
cs.setWrapText(true);
cell.setCellStyle(cs);
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.