Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-662

removing a trailing space causes a content alert when opening an exported file with Excel

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.0.0
    • 5.12.2
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      1. import keikai-662.xlsx
      2. export it in xlsx format
      3. open the file with Excel

      Current Result

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>Repair Result to keikai-662-export0.xml</logFileName><summary>Errors were detected in file '/Users/hawk/Downloads/keikai-662-export.xlsx'</summary><repairedRecords summary="Following is a list of repairs:"><repairedRecord>Repaired Records: Table from /xl/tables/table1.xml part (Table)</repairedRecord></repairedRecords></recoveryLog>
      

      Expected Result

      no alert

      Debug Information

      • keikai trims String tbColName = tbCol.getName().trim(); a table header for KEIKAI-550, but Excel checks consistency between a table header and its display value in sharedStrings.xml. Since these 2 values don't match each other, Excel shows an alert.
        If you check the exported file > sharedStrings.xml, it contains a tailing space:
        <si><t xml:space="preserve">Has Space at the End </t></si>
        

        But the text in table header doesn't have the tailing space, this mismatch causes an Excel alert.

      • verification
        protected void exportCell(Row poiRow, SCell cell) {
        ...
        		case STRING:
        			poiCell.setCellType(Cell.CELL_TYPE_STRING);
        			if(cell.isRichTextValue()) {
                                        ...
        			} else {
        				poiCell.setCellValue(cell.getStringValue().trim());
        			}
        			break;
        ..
        

        If I trim the cell string value, too, Excel can open the exported file without the alert.

      Workaround

      • remove the tailing space character in the table header

        1. alert.png
          18 kB
          hawk
        2. keikai-662.xlsx
          10 kB
          hawk

            DevChu DevChu
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: