hyperliskdev / exceljs

Excel Workbook Manager
MIT License
2 stars 0 forks source link

MacOS Node Tests Failing #2

Open hyperliskdev opened 5 months ago

hyperliskdev commented 5 months ago

spec/integration/issues/issue-1328-xlsx-worksheet-reader-date.spec.js:28:28

switch (c.t) {
                      case 's': {
                        const index = parseInt(c.v.text, 10);
                        if (sharedStrings) {
                          cell.value = sharedStrings[index];
                        } else {
                          cell.value = {
                            sharedString: index,
                          };
                        }
                        break;
                      }

                      case 'inlineStr':
                      case 'str':
                        cell.value = utils.xmlDecode(c.v.text);
                        break;

                      case 'e':
                        cell.value = {error: c.v.text};
                        break;

                      case 'b':
                        cell.value = parseInt(c.v.text, 10) !== 0;
                        break;

                      default:
                        if (utils.isDateFmt(cell.numFmt)) {
                          cell.value = utils.excelToDate(
                            parseFloat(c.v.text),
                            properties.model && properties.model.date1904
                          );
                        } else {
                          cell.value = parseFloat(c.v.text);
                        }
                        break;
                    }
                  }

image

Ultimately, the value that is being read here is the first value in the first cell but we want to read the value in A2 because it contains the matching date for the test. image

hyperliskdev commented 5 months ago

image

So first, the s attribute is style index, then attribute t is type. Type S is sharedString and the value likely relates to the sharedString Index. The first shared index value is the word "Date". image

For some reason, the test for this date issue is grabbing the first cell with the sharedString.

hyperliskdev commented 5 months ago

image

Another thing is that the cell that contains the date has a styleIndex reference to 1 and this references cellXfs area of the styles xml. image

hyperliskdev commented 5 months ago

okay so in the testing branch for this issue, I have discovered that for some reason, macos devices cannot grab the actual text from the sharedStrings.xml file.

hyperliskdev commented 5 months ago

Okay, so after reruning some tests, for some reason, it only happens intermittently that the macos devices read the sharedStrings as a literal index.