Skip to content

[BUG] Inline image is not parsed #2855

Open
@liudonghua123

Description

@liudonghua123

🐛 Bug Report

I tried to use this package to parse data.xlsx and want to get the inline image, but it failed.

Lib version: 4.4.0

Steps To Reproduce

import ExcelJS  from 'exceljs';
const { Workbook } = ExcelJS ;
const workbook = new Workbook();
const data = await workbook.xlsx.readFile('data.xlsx');

const worksheet = workbook.worksheets[0];
for (const image of worksheet.getImages()) {
  console.log('processing image row', image.range.tl.nativeRow, 'col', image.range.tl.nativeCol, 'imageId', image.imageId);
  // fetch the media item with the data (it seems the imageId matches up with m.index?)
  const img = workbook.model.media.find(m => m.index === image.imageId);
  console.log('found image for imageId', image.imageId, 'extension', img.extension);
  // fs.writeFileSync(`${image.range.tl.nativeRow}.${image.range.tl.nativeCol}.${img.name}.${img.extension}`, img.buffer);
}

The expected behaviour:

worksheet.getImages() should returns the inline images.

Possible solution (optional, but very helpful):

  1. worksheet.getImages() returns the inline images.
  2. worksheet.getCell('C2') returns the image data.

data.xlsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions