Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix xlsx parser can not compatible with rich text tags that are not closed #2001

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

WingMrL
Copy link

@WingMrL WingMrL commented Mar 11, 2022

Summary

Fix xlsx parser can not compatible with rich text tags that are not closed.

Test plan

Unable to read an xlsx containing a hyperlink described in rich text. Here's the error infos:

error:  TypeError: Cannot create property 'richText' on string ''
    at SharedStringXform.parseClose (/Users/wingmrl/Code/exceljs-demo/node_modules/exceljs/lib/xlsx/xform/strings/shared-string-xform.js:81:40)
    at SharedStringsXform.parseClose (/Users/wingmrl/Code/exceljs-demo/node_modules/exceljs/lib/xlsx/xform/strings/shared-strings-xform.js:111:24)
    at SharedStringsXform.parse (/Users/wingmrl/Code/exceljs-demo/node_modules/exceljs/lib/xlsx/xform/base-xform.js:67:21)

Related to source code (for typings update)

'use strict';

/**
 * Minimum reproducible program
 */

const fs = require('fs');
const stream = require('stream');

const Excel = require('../excel');

const filename = process.argv[2];
const buffer = fs.readFileSync(filename);
const workbook = new Excel.Workbook();

const streamReadable = new stream.Readable();
streamReadable.push(buffer);
streamReadable.push(null);

workbook.xlsx
  .read(streamReadable)
  .then(allWorksheet => {
    console.log('allWorksheet: ', allWorksheet);
  })
  .catch(error => {
    console.error('something went wrong', error.stack);
  });

@Siemienik Siemienik self-assigned this Apr 6, 2023
@zurmokeeper
Copy link
Contributor

@WingMrL Could you please move over here? I'd be happy to merge this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants