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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] When using the addImage method and specifying the cell width with tl and br after changing the cell width, the intended width is not set. #2730

Open
RyokoKassai opened this issue Mar 27, 2024 · 0 comments

Comments

@RyokoKassai
Copy link

RyokoKassai commented Mar 27, 2024

馃悰 Bug Report

When using the addImage method and specifying the cell width with tl and br after changing the cell width, the intended width is not set. The image is displayed with a smaller cell width than specified.

Is there a way to specify the "br" while changing the cell width?
Please note that I also want to set the editAs property at the same time, so specifying it with br instead of ext is necessary.

Lib version: 4.4.0

Steps To Reproduce

鈻爅avascript source

const workbook = new ExcelJS.Workbook();

const worksheet = workbook.addWorksheet('My Sheet');
worksheet.columns = [
    { header: 'Id', key: 'id', width: 10 },
    { header: 'Name', key: 'name', width: 32 },
    { header: 'test', key: 't1', width: 32 },
    { header: 'test2', key: 't2', width: 32 },
    { header: 'test3', key: 't3', width: 32 },
  ];

// read image files
const imageId = workbook.addImage({
    filename: 'img_7483.jpg',
    extension: 'jpg',
});

worksheet.addImage(imageId,{
    tl:{col:2,row:2},
    br:{col:3.8,row:3.5},
    editAs:'twoCell'
});

// save Excel file
workbook.xlsx.writeFile(outputfile)
    .then(() => {
        console.log('completed!');
    })
    .catch(error => {
        console.error('an error ocurred.', error);
    });

The expected behaviour:

Expected: The specified "br" is applied to the changed cell width, and the image is displayed.
Actual: The image is displayed with a smaller cell width than specified.
out_otamesi_gazo.xlsx

@RyokoKassai RyokoKassai changed the title [BUG] When using the addImage method and specifying the cell width with tl and br, the intended width is not set. [BUG] When using the addImage method and specifying the cell width with tl and br after changing the cell width, the intended width is not set. Mar 27, 2024
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

No branches or pull requests

1 participant