ODF Toolkit
  1. ODF Toolkit
  2. ODFTOOLKIT-185

Error setting column width with german locale

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: odfdom-0.8.7
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None
    • Environment:
      Operating System: Mac OS
      Platform: Macintosh
      URL: http://www.ansys.de

      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");

        Issue Links

          Activity

            People

            • Assignee:
              subruch
              Reporter:
              subruch
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Development