diff --git a/col.go b/col.go index 4d19a2aa3e..bbb5d29845 100644 --- a/col.go +++ b/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++ } diff --git a/picture_test.go b/picture_test.go index 95bb39e9fa..54f9bb0cbc 100644 --- a/picture_test.go +++ b/picture_test.go @@ -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()) }