diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-06-28 20:56:42 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-06-28 20:56:42 +0800 |
commit | 14eca84073c05e7514634c0949785256295a7500 (patch) | |
tree | d7233dc155ee58630fb23e85d544910c6ff5e325 /col.go | |
parent | 66e5d1fa801680f87a647a968fd4965ef9668b9a (diff) |
Function `GetColWidth()` and `GetRowHeight()` has been exported, relate issue #68.
Diffstat (limited to 'col.go')
-rw-r--r-- | col.go | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -157,26 +157,26 @@ func (f *File) positionObjectPixels(sheet string, colStart, rowStart, x1, y1, wi // Calculate the absolute x offset of the top-left vertex. for colID := 1; colID <= colStart; colID++ { - xAbs += f.getColWidth(sheet, colID) + xAbs += f.GetColWidth(sheet, colID) } xAbs += x1 // Calculate the absolute y offset of the top-left vertex. // Store the column change to allow optimisations. for rowID := 1; rowID <= rowStart; rowID++ { - yAbs += f.getRowHeight(sheet, rowID) + yAbs += f.GetRowHeight(sheet, rowID) } yAbs += y1 // Adjust start column for offsets that are greater than the col width. - for x1 >= f.getColWidth(sheet, colStart) { - x1 -= f.getColWidth(sheet, colStart) + for x1 >= f.GetColWidth(sheet, colStart) { + x1 -= f.GetColWidth(sheet, colStart) colStart++ } // Adjust start row for offsets that are greater than the row height. - for y1 >= f.getRowHeight(sheet, rowStart) { - y1 -= f.getRowHeight(sheet, rowStart) + for y1 >= f.GetRowHeight(sheet, rowStart) { + y1 -= f.GetRowHeight(sheet, rowStart) rowStart++ } @@ -188,15 +188,15 @@ func (f *File) positionObjectPixels(sheet string, colStart, rowStart, x1, y1, wi height += y1 // Subtract the underlying cell widths to find end cell of the object. - for width >= f.getColWidth(sheet, colEnd) { + for width >= f.GetColWidth(sheet, colEnd) { colEnd++ - width -= f.getColWidth(sheet, colEnd) + width -= f.GetColWidth(sheet, colEnd) } // Subtract the underlying cell heights to find end cell of the object. - for height >= f.getRowHeight(sheet, rowEnd) { + for height >= f.GetRowHeight(sheet, rowEnd) { rowEnd++ - height -= f.getRowHeight(sheet, rowEnd) + height -= f.GetRowHeight(sheet, rowEnd) } // The end vertices are whatever is left from the width and height. @@ -205,9 +205,9 @@ func (f *File) positionObjectPixels(sheet string, colStart, rowStart, x1, y1, wi return colStart, rowStart, xAbs, yAbs, colEnd, rowEnd, x2, y2 } -// getColWidth provides function to get column width in pixels by given sheet +// GetColWidth provides function to get column width in pixels by given sheet // name and column index. -func (f *File) getColWidth(sheet string, col int) int { +func (f *File) GetColWidth(sheet string, col int) int { xlsx := f.workSheetReader(sheet) if xlsx.Cols != nil { var width float64 @@ -224,9 +224,9 @@ func (f *File) getColWidth(sheet string, col int) int { return defaultColWidthPixels } -// getRowHeight provides function to get row height in pixels by given sheet +// GetRowHeight provides function to get row height in pixels by given sheet // name and row index. -func (f *File) getRowHeight(sheet string, row int) int { +func (f *File) GetRowHeight(sheet string, row int) int { xlsx := f.workSheetReader(sheet) for _, v := range xlsx.SheetData.Row { if v.R == row && v.Ht != "" { |