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

Calling OdfTableCell.setFormatString("yyyy-MM-dd") throws NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • simple-odfdom-0.8
    • odfdom-0.8.7
    • java
    • None
    • Operating System: Windows
      Platform: PC
    • 157

    Description

      NullPointException when setting format string to a new spreadsheet document. The following is the sample code:
      OdfSpreadsheetDocument doc = (OdfSpreadsheetDocument) OdfSpreadsheetDocument.newSpreadsheetDocument();
      doc.getOrCreateDocumentStyles();

      OdfTable table = OdfTable.newTable(doc,rownumber,clmnumber);
      table.setTableName("sheet"+sheeti);
      for(int row=0;row<rownumber;row++)

      { OdfTableRow tablerow = table.getRowByIndex(row); OdfTableCell cell = tablerow.getCellByIndex(0); cell.setDateValue(currenttime); cell.setFormatString("yyyy-MM-dd"); ------(1) cell.setTimeValue(currenttime); cell.setFormatString("HH:mm"); ------(2) }

      Exception will be thrown when executing statement (1).
      When executing statement (2), error message "This function doesn't support time cell" will be printed out.
      Can you check if it is possible to support time values easily in "setFormatString" method, since I noticed OdfTimeStyle is ready there.

      Attachments

        Issue Links

          Activity

            People

              svanteschubert@odftoolkit.org Svante Schubert
              devin@odftoolkit.org devin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: