forked from p30928647/excelize
This closes #1560, fix incorrect row number when get object position
This commit is contained in:
parent
78c974d855
commit
8e891b52c6
8
col.go
8
col.go
|
@ -605,14 +605,14 @@ func flatCols(col xlsxCol, cols []xlsxCol, replacer func(fc, c xlsxCol) xlsxCol)
|
|||
// height # Height of object frame.
|
||||
func (f *File) positionObjectPixels(sheet string, col, row, x1, y1, width, height int) (int, int, int, int, int, int) {
|
||||
// Adjust start column for offsets that are greater than the col width.
|
||||
for x1 >= f.getColWidth(sheet, col) {
|
||||
x1 -= f.getColWidth(sheet, col)
|
||||
for x1 >= f.getColWidth(sheet, col+1) {
|
||||
x1 -= f.getColWidth(sheet, col+1)
|
||||
col++
|
||||
}
|
||||
|
||||
// Adjust start row for offsets that are greater than the row height.
|
||||
for y1 >= f.getRowHeight(sheet, row) {
|
||||
y1 -= f.getRowHeight(sheet, row)
|
||||
for y1 >= f.getRowHeight(sheet, row+1) {
|
||||
y1 -= f.getRowHeight(sheet, row+1)
|
||||
row++
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ func TestAddPictureErrors(t *testing.T) {
|
|||
assert.NoError(t, f.AddPicture("Sheet1", "Q7", filepath.Join("test", "images", "excel.wmf"), nil))
|
||||
assert.NoError(t, f.AddPicture("Sheet1", "Q13", filepath.Join("test", "images", "excel.emz"), nil))
|
||||
assert.NoError(t, f.AddPicture("Sheet1", "Q19", filepath.Join("test", "images", "excel.wmz"), nil))
|
||||
assert.NoError(t, f.AddPicture("Sheet1", "Q25", "excelize.svg", &GraphicOptions{ScaleX: 2.1}))
|
||||
assert.NoError(t, f.AddPicture("Sheet1", "Q25", "excelize.svg", &GraphicOptions{ScaleX: 2.8}))
|
||||
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestAddPicture2.xlsx")))
|
||||
assert.NoError(t, f.Close())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue