-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add support for adding images anchored to one cell #746
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
Conversation
You can test it by adding |
I just added it to my |
I think you need to provide either |
@karlvr definitely. If |
It sounds reasonable. I wonder if there is other image loading code in this library. Might well be!
…On 5 Apr 2019, 12:03 AM +1300, Brian Le ***@***.***>, wrote:
@karlvr definitely. If ext is not specified, we should use the original image's dimensions. One might get the image programmatically somewhere without knowing the exact width and height. Obviously there are libraries out there that help with finding images' sizes, but still would be nice if your PR does it out of the box
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Looking into this now. Looks good, my only comment so far would be to offset tl by -1, -1 like the two-cell anchor. I'll look into this |
Hi @karlvr , I have an issue using this functionality - exporting images looks great but they aren't getting deleted when I deleted a row from the Excel file. When I use use the default (tl: br:) the attribute editAs: 'oneCell' resolved this issue, but it doesn't seem to work when I use tl: ext: Did anyone else came across this problem? |
@karlvr I have issues when using ext for image size. The excel says that "We found unreadable content in 'Export.xlsx'. Do you want to recovery the contents of this workbook?" After repairing the file using excel, its opening fine. The error log says "Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)". So i compared the drawing1.xml from both repaired and unrepaired workbooks. And found that if i remove editAs="oneCell" attribute from all xdr:oneCellAnchor tags, the error is gone. |
If you set ext with height and width it works but you get the MS error and repair. I did a diff on the drawings xml of the original and repaired. No changes what-so-ever were made other than on the root xdr:oneCellAnchor where excelJS sets an attribute 'editAs="absolute"' or 'editAs="oneCell"', Microsoft wipes that out (no attribute at all). That is the only change. So very confused on what the heck we need to do to make this work. Should you not be setting this attribute? Is it defined elsewhere where MS is barfing? |
+1 |
Addresses #738 #650 and is related to #702.
There is a bug in
cell-position-xform.js
that assumes that columns are 640,000 EMU wide and 180,000 EMU tall. This assumption is broken if you customise cell width or height, and the bug appears if you use fractional columns or rows to try to position your image.This PR adds support for adding images using just a
tl
and then providing anext
that contains awidth
andheight
in pixels. The width and height are converted internally to EMU using a conversion at 96dpi. That seems to be the right thing to do, but something I'm a little unsure about!This change should read as well as write the one-cell-anchor-xform, although I have only used writing so far but there is a test for reading and writing.