title: Output string as currency format in excel by POI
body: <p>I want to output "2655.32" as "$2,655.32" in excel.</p>
  
  <p>Here is code snippet: </p>
  
  <pre><code>case 0:
      HSSFCellStyle style;
      style.setAlignment(HSSFCellStyle.ALIGN_RIGHT);
      style.setDataFormat((short) 7);
      cell.setCellValue(new HSSFRichTextString("2655.32"));
      cell.setCellStyle(style);
  break;
  </code></pre>
  
  <p>The generated excel cell doesn't show "$" or thousand comma ",", and there is an error check warning, <strong>"The number in this cell is formated as text or preceded by an apostrophe</strong>. I can get what I want by double clicking the cell to let excel fix it, the "$" and "," will show up. </p>
  
  <p>I know I can use  <code>cell.setCellValue(Double.parse("2655.32"))</code>  to parse the string to a double to solve this, but if so, I have to make sure the value is parseable and add try catch block to each of my switch case, which is very duplicate.</p>
  
  <p>I am wondering if there is a way to output this kind numeric string as text and keep the currency format at the same time? like this $2,655.32</p>