Uploaded image for project: 'ODF Toolkit'
  1. ODF Toolkit
  2. ODFTOOLKIT-185

Error setting column width with german locale

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • odfdom-0.8.7
    • None
    • java
    • None
    • Operating System: Mac OS
      Platform: Macintosh
      URL: http://www.ansys.de
    • 298

    Description

      During setting an new width of a column raises a NumberFormatException because the initial column width contains an invalid character due to mistake of using the default locale (in my case german wich uses "," instead of "." as decimal separator).

      The Wron code is located in the method "createTable" of class "OdfTable", approx. line 370.

      Wrong Code:
      columnStyle.setProperty(StyleTableColumnPropertiesElement.ColumnWidth,
      new DecimalFormat("000.0000").format(DEFAULT_TABLE_WIDTH / numCols) + "in");

      Corrected Code uses Locale.US:
      columnStyle.setProperty(StyleTableColumnPropertiesElement.ColumnWidth,
      new DecimalFormat("000.0000",new DecimalFormatSymbols(Locale.US)).
      format(DEFAULT_TABLE_WIDTH / numCols) + "in");

      Attachments

        Issue Links

          Activity

            People

              subruch@odftoolkit.org subruch
              subruch@odftoolkit.org subruch
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: