Skip to content

The number of pictures obtained by the getPicture function is incorrect #1628

@yicixin

Description

@yicixin

Description
I have an xlsx file, there is already a picture in cell A1 of Sheet1, execute the following code, add another picture in cell A1, and then get the picture on cell A1, the number is wrong.

Steps to reproduce the issue:

  1. Use excel to create a new xlsx file and add a picture to cell A1 of Sheet1
  2. Use excelize to open the xlsx file and add another picture in cell A1 of Sheet1
  3. Use Excelize to get pictures on cell A1 in sheet1, and output the number
func TestGetPictures(t *testing.T) {
	f, err := excelize.OpenFile("normal.xlsx")
	if err != nil {
		return
	}
	defer f.Close()
	err = f.AddPicture("Sheet1", "A1", "1.jpg", nil)
	if err != nil {
		return
	}
	pics, err := f.GetPictures("Sheet1", "A1")
	if err != nil {
		return
	}
	fmt.Println(len(pics))
}

Describe the results you received:
The number of pictures I got is 1
Describe the results you expected:
The number I expected is 2

Environment details (OS, Microsoft Excel™ version, physical, etc.):
excelize version: master branch
go version: go1.20
os: windows64
arch: amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions