Skip to content
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

AddPicture's OffsetY Method will cause the image to be displayed incorrectly #1560

Closed
jacobLiou1225 opened this issue Jun 11, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@jacobLiou1225
Copy link

jacobLiou1225 commented Jun 11, 2023

Description
(想知道為何OffsetY一旦>=20就會使圖片跑版,謝謝)
I want to place two pictures in a cell using the AddPicture Method, but when my OffsetY is greater than 20, the position of the pictures becomes incorrect.

Describe the results you received:

This is the result when OffsetY is 19.
image

This is the result when OffsetY is 20.
image

The image that was supposed to be in cell A1 has shifted to A2.
I have also tried using AutoFit: true but it didn't solve my problem.

Here's my code:

package main

import (
	_ "image/jpeg"
	_ "image/png"

	"github.com/xuri/excelize/v2"
)

func main() {
	f, _ := excelize.OpenFile("cat.xlsx")
	f.AddPicture("cat", "A1", "cat.png",
		&excelize.GraphicOptions{
			AutoFit:     true,
			ScaleX:      1,
			ScaleY:      1,
			OffsetX:     10,
			OffsetY:     20,
			Positioning: "absolute",
		},
	)
	f.SaveAs("output.xlsx")
}

here's the repository
https://github.com/jacobLiou1225/API-AddPicture-Question.git

Excelize version or commit ID: 2.7.1
golang version 1.19
Environment details : windows 10 21H2

Any help on this issue would be greatly appreciated. Thank you!

@xuri
Copy link
Member

xuri commented Jun 11, 2023

Thanks for your issue. Your provided repository was not found, could you provide a workbook and image as attachments without confidential info?

@xuri xuri added the needs more info This issue can't reproduce, need more info label Jun 11, 2023
@jacobLiou1225
Copy link
Author

jacobLiou1225 commented Jun 11, 2023

@xuri Thank you for responding so quickly! Here is the correct URL without confidential info:
https://github.com/jacobLiou1225/API-AddPicture-Question.git

@xuri xuri added bug Something isn't working in progress Working in progress and removed needs more info This issue can't reproduce, need more info labels Jun 11, 2023
@xuri xuri closed this as completed in 8e891b5 Jun 11, 2023
@xuri
Copy link
Member

xuri commented Jun 11, 2023

Thanks for your feedback. I have fixed this issue, please try to upgrade the master branch code, and this patch will be released in the next version.

@xuri xuri removed the in progress Working in progress label Jun 11, 2023
@jacobLiou1225
Copy link
Author

Thank you very much for your response. This project has been extremely helpful to me!

xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants