forked from p30928647/excelize
This commit is contained in:
parent
08ba2723fe
commit
a246db6a40
|
@ -94,7 +94,7 @@ func TestChartSize(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !assert.Equal(t, 14, anchor.To.Col, "Expected 'to' column 14") ||
|
if !assert.Equal(t, 14, anchor.To.Col, "Expected 'to' column 14") ||
|
||||||
!assert.Equal(t, 27, anchor.To.Row, "Expected 'to' row 27") {
|
!assert.Equal(t, 29, anchor.To.Row, "Expected 'to' row 29") {
|
||||||
|
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
11
rows.go
11
rows.go
|
@ -380,6 +380,9 @@ func (f *File) getRowHeight(sheet string, row int) int {
|
||||||
return int(convertRowHeightToPixels(*v.Ht))
|
return int(convertRowHeightToPixels(*v.Ht))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ws.SheetFormatPr != nil && ws.SheetFormatPr.DefaultRowHeight > 0 {
|
||||||
|
return int(convertRowHeightToPixels(ws.SheetFormatPr.DefaultRowHeight))
|
||||||
|
}
|
||||||
// Optimization for when the row heights haven't changed.
|
// Optimization for when the row heights haven't changed.
|
||||||
return int(defaultRowHeightPixels)
|
return int(defaultRowHeightPixels)
|
||||||
}
|
}
|
||||||
|
@ -390,7 +393,7 @@ func (f *File) getRowHeight(sheet string, row int) int {
|
||||||
// height, err := f.GetRowHeight("Sheet1", 1)
|
// height, err := f.GetRowHeight("Sheet1", 1)
|
||||||
func (f *File) GetRowHeight(sheet string, row int) (float64, error) {
|
func (f *File) GetRowHeight(sheet string, row int) (float64, error) {
|
||||||
if row < 1 {
|
if row < 1 {
|
||||||
return defaultRowHeightPixels, newInvalidRowNumberError(row)
|
return defaultRowHeight, newInvalidRowNumberError(row)
|
||||||
}
|
}
|
||||||
ht := defaultRowHeight
|
ht := defaultRowHeight
|
||||||
ws, err := f.workSheetReader(sheet)
|
ws, err := f.workSheetReader(sheet)
|
||||||
|
@ -840,10 +843,8 @@ func (f *File) SetRowStyle(sheet string, start, end, styleID int) error {
|
||||||
// cell from user's units to pixels. If the height hasn't been set by the user
|
// cell from user's units to pixels. If the height hasn't been set by the user
|
||||||
// we use the default value. If the row is hidden it has a value of zero.
|
// we use the default value. If the row is hidden it has a value of zero.
|
||||||
func convertRowHeightToPixels(height float64) float64 {
|
func convertRowHeightToPixels(height float64) float64 {
|
||||||
var pixels float64
|
|
||||||
if height == 0 {
|
if height == 0 {
|
||||||
return pixels
|
return 0
|
||||||
}
|
}
|
||||||
pixels = math.Ceil(4.0 / 3.0 * height)
|
return math.Ceil(4.0 / 3.4 * height)
|
||||||
return pixels
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ const (
|
||||||
pivotTableVersion = 3
|
pivotTableVersion = 3
|
||||||
defaultPictureScale = 1.0
|
defaultPictureScale = 1.0
|
||||||
defaultChartDimensionWidth = 480
|
defaultChartDimensionWidth = 480
|
||||||
defaultChartDimensionHeight = 290
|
defaultChartDimensionHeight = 260
|
||||||
defaultChartLegendPosition = "bottom"
|
defaultChartLegendPosition = "bottom"
|
||||||
defaultChartShowBlanksAs = "gap"
|
defaultChartShowBlanksAs = "gap"
|
||||||
defaultShapeSize = 160
|
defaultShapeSize = 160
|
||||||
|
|
Loading…
Reference in New Issue