Skip to content

Commit bffb5d6

Browse files
committed
make the caller of getRowHeight function adapt row number change, update comment: use rows number instead of rows index.
1 parent e354db6 commit bffb5d6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

col.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,9 @@ func (f *File) positionObjectPixels(sheet string, col, row, x1, y1, width, heigh
592592
}
593593

594594
// Subtract the underlying cell heights to find end cell of the object.
595-
for height >= f.getRowHeight(sheet, rowEnd) {
596-
height -= f.getRowHeight(sheet, rowEnd)
595+
for height >= f.getRowHeight(sheet, rowEnd+1) {
597596
rowEnd++
597+
height -= f.getRowHeight(sheet, rowEnd)
598598
}
599599

600600
// The end vertices are whatever is left from the width and height.

picture.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,10 @@ func (f *File) drawingResize(sheet string, cell string, width, height float64, f
618618
if inMergeCell {
619619
cellWidth, cellHeight = 0, 0
620620
c, r = rng[0], rng[1]
621-
for col := rng[0] - 1; col < rng[2]; col++ {
621+
for col := rng[0]; col <= rng[2]; col++ {
622622
cellWidth += f.getColWidth(sheet, col)
623623
}
624-
for row := rng[1] - 1; row < rng[3]; row++ {
624+
for row := rng[1]; row <= rng[3]; row++ {
625625
cellHeight += f.getRowHeight(sheet, row)
626626
}
627627
}

rows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func (f *File) SetRowHeight(sheet string, row int, height float64) error {
266266
}
267267

268268
// getRowHeight provides a function to get row height in pixels by given sheet
269-
// name and row index.
269+
// name and row number.
270270
func (f *File) getRowHeight(sheet string, row int) int {
271271
ws, _ := f.workSheetReader(sheet)
272272
for i := range ws.SheetData.Row {
@@ -280,7 +280,7 @@ func (f *File) getRowHeight(sheet string, row int) int {
280280
}
281281

282282
// GetRowHeight provides a function to get row height by given worksheet name
283-
// and row index. For example, get the height of the first row in Sheet1:
283+
// and row number. For example, get the height of the first row in Sheet1:
284284
//
285285
// height, err := f.GetRowHeight("Sheet1", 1)
286286
//

0 commit comments

Comments
 (0)