-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Improvements for images (correct reading/writing possitions) #702
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
…g from xlsx with fully back compatible. NEW Anchor model NEW Integration tests test for image`s reader & writer NEW Unit tests for Anchor
I hope that, in the future both repositories become to be merged ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know enough about images in excel, but I like the tests, so I think this can be merged. Should we maybe do a rebase?
lib/doc/worksheet.js
Outdated
@@ -620,5 +631,13 @@ Worksheet.prototype = { | |||
this.views = value.views; | |||
this.autoFilter = value.autoFilter; | |||
this._media = value.media; | |||
|
|||
var self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line is not needed
@@ -0,0 +1,56 @@ | |||
/** | |||
* Copyright (c) 2018 Paweł Siemienik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think this shouldn't be in individual files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alubbe In each file is copyright/author block similar to this, if it's wrong could you write how it should looks like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah indeed - I had completely missed that. Let's leave that in then.
@guyonroche I've only seen licenses repeated in every file if you want to charge license fees for your IP, but since we use MIT I think there's no need to have this repeated everywhere - it's just noise that needs maintenance. Would you be okay with removing them everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alubbe Yeah - We could probably get away with just the LICENCE file with links from the README.md and main excel.js file.
I finally have more spare time now so I can start working through the PRs. I'll test this one tomorrow morning
Thank You @alubbe for review, I will make required fixes as soon as possible ;) |
Happy now with this PR code-wise, but I can't speak to the functionality. Can anyone test it with an actual excel file? |
I had to made this fixes for my businesses project when I read and modify xlsx files. With this PL it works fine. below is link to xlsx file, what i prepared for test purposes. If you have possible, just download, open&write it (exceljs |
nice @Siemienik Looking to forward to this being merged. Until then i have updated my package.json to use `"exceljs": "github:p3rio/exceljs#build"``. How do i use this functionality? Do I use it the same way? Could you update the readme? |
This did not work for me. I tested my excel in 3 different Excel readers and it only worked in one. Images where placed wrong. For now i went back to my fork. That atleast works with my offsets set. tl: {
col: imageColumnPosition + 0.05,
row: i + 0.05,
},
br: {
col: imageColumnPosition + 0.95,
row: i + 0.95 //this aint working either. I have to use 1 but that is bad. Image overlapping row line.
} |
@kaidoj could You share excel files which were failed? |
@moddaman it enough to use images like before. This PR fixes counting possitions for images in reader and writer. Before that, reader and writer ignore current column width and always use the same value, so when column width was larger than 'this const' it put image to another column. |
@kaidoj could you please share a file where it doesn't work? |
@alubbe |
@guyonroche awesome, will be great to have you back! :) |
Hi Guyz how to solve this issue. Any idea if i add dependencies "exceljs": "github:p3rio/exceljs#build" it still throws error i believe its clashing with the latest exceljs. Any idea how can i work with both in parallel using image functionality of p3rio and rest from master. Please help me this issue is now taking more than 1 month.. |
@mjiskinng Since 1 Apr 2019 this PR is included in the ExcelJS main package. Could you use : |
Improvements for image`s positioning/stretching and their properly writing to xlsx and readign from xlsx with fully backward compatibility.
Before that changes,
Reading images positions works wrong. This example show it very well,


original file looks that:
after i open this file and save without any changes:
Backward compability
My solution was designed to handle current
col
/row
and calculate it tonativeCol
,nativeColOff
,nativeRow
,nativeRowOff
. A lot of tests was written to ensure properly working with dependents apps .I will be glad for quick checking/approval this pull request, I am open for your comments and ready to make some fixes.
issues
#650
#467