Skip to content

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

Merged
merged 4 commits into from
Apr 1, 2019

Conversation

Siemienik
Copy link
Member

@Siemienik Siemienik commented Dec 1, 2018

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:
image
after i open this file and save without any changes:
image

Backward compability

My solution was designed to handle current col/row and calculate it to nativeCol, 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

…g from xlsx with fully back compatible.

NEW Anchor model
NEW Integration tests test for image`s reader & writer
NEW Unit tests for Anchor
@Siemienik Siemienik changed the title Improvements for images (correct reading/writing stream) Improvements for images (correct reading/writing possitions) Dec 1, 2018
@Siemienik
Copy link
Member Author

Siemienik commented Jan 10, 2019

Hi everyone, I didn't note any maintainer's activity, so as long as it's required I am going to maintain this wonderful open source library in my fork: https://github.com/p3rio/exceljs

I hope that, in the future both repositories become to be merged ;)

Copy link
Member

@alubbe alubbe left a 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?

@@ -620,5 +631,13 @@ Worksheet.prototype = {
this.views = value.views;
this.autoFilter = value.autoFilter;
this._media = value.media;

var self = this;
Copy link
Member

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
Copy link
Member

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

Copy link
Member Author

@Siemienik Siemienik Jan 15, 2019

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?

Copy link
Member

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?

Copy link
Collaborator

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

@Siemienik
Copy link
Member Author

Thank You @alubbe for review, I will make required fixes as soon as possible ;)

@alubbe
Copy link
Member

alubbe commented Jan 21, 2019

Happy now with this PR code-wise, but I can't speak to the functionality. Can anyone test it with an actual excel file?

@Siemienik
Copy link
Member Author

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 v1.7.0):
https://github.com/exceljs/exceljs/blob/c8e2ce5190a3b627a33c90a7fee1358351443440/spec/integration/data/images.xlsx

@moddaman
Copy link

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?
In your commits I can see som use of the Anchor class?

Could you update the readme?

@kaidoj
Copy link

kaidoj commented Feb 13, 2019

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.
}

@Siemienik
Copy link
Member Author

@kaidoj could You share excel files which were failed?

@Siemienik
Copy link
Member Author

@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.

@alubbe
Copy link
Member

alubbe commented Mar 12, 2019

@kaidoj could you please share a file where it doesn't work?
@Siemienik why are the tests red - is our test runner broken? :D

@dogusev
Copy link
Contributor

dogusev commented Mar 29, 2019

@alubbe
Any chance to have it merged?

@alubbe
Copy link
Member

alubbe commented Mar 31, 2019

@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

@guyonroche awesome, will be great to have you back! :)

@mjiskinng
Copy link

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..

@Siemienik
Copy link
Member Author

Siemienik commented Jul 26, 2021

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 :
"exceljs":"^4.2.1" ?

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

Successfully merging this pull request may close these issues.

7 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy