title: With Apache Poi how do I create multivalue spreadsheet cells so displayed properly in MS Excel not just OpenOffice
body: <p>I am using Jakarta Poi to create an .xlsx file from Java which can be opened in Excel/Office. Some of the cells represent multiple values and are originally null separated e.g 'fred/u000/tom' when I set in the cell I replace the null characters with '\n'</p>
  
  <p>This all worked fine with OpenOffice, it raises the height of these rows to accomodate the multiple lines. But I found OpenOffice was taking a significantly longer to open files in xlsx format then xls format so I invested in Microsoft Excel and this displays the same file with all the values all on a single line.</p>
  
  <p><a href="https://i.stack.imgur.com/fTC2e.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fTC2e.jpg" alt="Open Office"></a></p>
  
  <p><a href="https://i.stack.imgur.com/yfy1j.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yfy1j.jpg" alt="MS Excel"></a></p>
  
  <p>If you go into edit a value then Excel increases the height to accomodate the multiple values, but why doesn't it do it on read.</p>
  
  <p><a href="https://i.stack.imgur.com/3zCo1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3zCo1.jpg" alt="MS Excel Edit"></a>
  Since there is no need to edit the spreadsheet is there something else I can use instead of '\n' or some option to force Excel to display the file like OpenOffice</p>
  
  <p>code extract</p>
  
  <pre><code>private void addFieldValue(Session session, Worksheet sheet, Row r, int spreadsheetIndex, SongFieldNameColumnWidth sfncw, SongChanges fieldChanges, Song song)
  {
      SongFieldName   songFieldName = sfncw.getSongFieldName();
      String          value = "";
      org.apache.poi.ss.usermodel.Cell c ;
      c=r.createCell(spreadsheetIndex);
  
      //Chnanges have been made to this field
      if(fieldChanges!=null)
      {
          if (changeType == SongChangeType.ADD)
          {
              value = fieldChanges.getNewValue().replace('\u0000', '\n');
              c.setCellValue(value);
              c.setCellStyle(fieldAddedStyle);
  
          }
          else if (changeType == SongChangeType.EDIT)
          {
              value = fieldChanges.getNewValue().replace('\u0000', '\n');
              c.setCellValue(value);
              c.setCellStyle(fieldChangedStyle);
              //addCellComment(r, c, sheet, fieldChanges.getOriginalValue());
          }
          else if (changeType == SongChangeType.DELETE)
          {
              c.setCellStyle(fieldDeletedStyle);
          }
      }
      sfncw.setColumnWidthFromValue(value);
  }
  </code></pre>