Image location don't respect Column width
See original GitHub issueI set custom column width while defining sheet columns. When adding an image using coordinate (50% column to use), the image don’t respect my custom width.
Additional explanation: https://github.com/exceljs/exceljs/issues/650#issuecomment-645887635
Code :
sheet.columns = [
{ header: 'Id', key: 'id', width: 10 },
{ header: 'Name', key: 'name', width: 32 },
];
var imageId2 = workbook.addImage({
base64: myBase64Image,
extension: 'png',
});
sheet.getColumn(4).width = 38;
// sheet.addImage(imageId2, 'B2:D6');
sheet.addImage(imageId2, {
tl: { col: 1, row: 1 },
br: { col: 1.5, row: 4 }
});
sheet.addImage(imageId2, {
tl: { col: 3, row: 1 },
br: { col: 3.5, row: 4 }
});
workbook.xlsx.writeBuffer({
base64: true
})
.then(function(xls64) {
// done
var data = new Blob([xls64], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
saveAs(data, "output.xlsx");
});
Actual result :
Expected result:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Img doesn't respect width in html (with flexbox) - Stack Overflow
You want to set the dimensions of your container, then have the image inside expand to fill it. I'd reshuffle it like this:...
Read more >C37: Using CSS max-width and height to fit images | WAI - W3C
This is done by using CSS max-width and height property techniques that adapt to the available space and keep the original dimensions of...
Read more >table-layout - CSS: Cascading Style Sheets - MDN Web Docs
Table and column widths are set by the widths of table and col elements or by the width of the first row of...
Read more >Preventing a Grid Blowout | CSS-Tricks
To apply our fix, we need to make sure that there is the column has a definite minimum width instead of auto ....
Read more >HTML Tag: Change The Width Of A Picture In HTML »
If you specify the width, it may be much too small for some users and much too big for others. Most of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Siemienik Still facing image alignment issue with custom column width.
First I am reading a excel file and then I am only adding the image on a particular cell. If width of the column for that cell is default column width then image alignment is working fine using col and row but If the excel file that I am reading, have custom column width then adding image to a cell that has custom width , in that right image alignment is not working.