title: Writing text with maximum length in Apache POI to cell
body: <p>For an application I have to test if a text will fit into a cell in Apache POI. </p>
  
  <p>To test some things quickly, I wrote a small demo application, where I wrote the maximal allowed amount of characters to a cell. I encountered that the number of characters I could write to a cell </p>
  
  <p>So, this is the demo application:</p>
  
  <pre><code>Workbook wb = new HSSFWorkbook();
  Sheet sheet = wb.createSheet("Test");
  
  for (int idx = 0; idx &lt; 5; idx++) {
      Row row = sheet.createRow(idx);
      Cell cell = row.createCell(0);
      cell.setCellValue(StringUtils.repeat("-", wb.getSpreadsheetVersion().getMaxTextLength()));
  }
  
  FileOutputStream out = new FileOutputStream("test.xls");
  wb.write(out);
  
  out.close();
  wb.close();
  </code></pre>
  
  <p>But when opening the created excel file, I failed to read the cells I've written to, prompting that the cell could only contain between 1 and 255 characters. But this is different than what I get from "wb.getSpreadsheetVersion().getMaxTextLength()". Does some characters in the text require some special treatment? Note that when writing more than 255 times "-" directly into excel, I do not have any problems.</p>
  
  <p>Using "*" instead of "-" works as expected.</p>