Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Images are not supporting #58

Closed
dgofman opened this issue Jan 15, 2016 · 7 comments
Closed

Images are not supporting #58

dgofman opened this issue Jan 15, 2016 · 7 comments

Comments

@dgofman
Copy link
Contributor

dgofman commented Jan 15, 2016

Hi. I found lot of issues with image API's

  1. The file size is increasing by using the same image cross worksheets.
  2. Image width/height is not scaling and is impossible re-size if dimension is not the same
  3. Image repeats in the cell.
  4. it's challenge to calculate EMU size and position, I have no idea why we should pass EMU value instead pixels.
  5. Cannot use other anchor image formats 'oneCellAnchor' is hard codded.
dgofman added a commit to dgofman/excel4node that referenced this issue Jan 15, 2016
dgofman added a commit to dgofman/excel4node that referenced this issue Jan 16, 2016
@dgofman
Copy link
Contributor Author

dgofman commented Jan 16, 2016

Ok, I fixed all these issue please review my pull request

#59

image

@seungkim11
Copy link

I downloaded your pull request, but my image is shrinking
var img = ws.Image('myimage.jpg');
img.Position(1,1, 0, 0);

@dgofman
Copy link
Contributor Author

dgofman commented Jan 17, 2016

You have two approaches.

  1. Set image size using ABSOLUTE or ONE_CELL anchors (second attribute in my pull request)
  2. Using TWO_CELL anchor will set a cell size automatically

Four options how to embed images:

//Absolute position near D3
ws.Image('sampleFiles/image1.png', ws.Image.ABSOLUTE).Position(218, 400).Size(255, 50); //arguments: y-pixels, x-pixels

//A3
ws.Image('sampleFiles/image1.png', ws.Image.ONE_CELL).Position(3, 1, 10, 40).Size(255, 50); //arguments: row, column, {offsetY, offsetX} (in pixels optional)

//A1-F2
ws.Image('sampleFiles/image1.png', ws.Image.TWO_CELL).Position(1, 1, 2, 6, 2, 5); //arguments: begin-row, begin-column, end-row, end-column, {offsetY, offsetX} (in pixels - optional)

//D5
ws.Image('sampleFiles/image1.png', ws.Image.TWO_CELL).Position(5, 4); //arguments: row, column

@seungkim11
Copy link

It's working nicely. Thank you!

@dgofman
Copy link
Contributor Author

dgofman commented Jan 17, 2016

Welcome!

@natergj
Copy link
Owner

natergj commented Jan 20, 2016

merged into version 0.4.0. Thanks, @dgofman

@pravosleva
Copy link

Hello!
ws.Image is not a function. What I have to do?

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants