From 88de2f8d510b0959bbb672b80656d207bd0bc927 Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 22 Aug 2020 18:58:43 +0800 Subject: Default row height compatibility with Apache OpenOffice and Kingsoft WPS, unit test update and typo fixed --- sheet.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sheet.go') diff --git a/sheet.go b/sheet.go index a92221d..dedd2d9 100644 --- a/sheet.go +++ b/sheet.go @@ -1630,13 +1630,19 @@ func (f *File) relsReader(path string) *xlsxRelationships { func prepareSheetXML(xlsx *xlsxWorksheet, col int, row int) { rowCount := len(xlsx.SheetData.Row) sizeHint := 0 + var ht float64 + var customHeight bool + if xlsx.SheetFormatPr != nil { + ht = xlsx.SheetFormatPr.DefaultRowHeight + customHeight = true + } if rowCount > 0 { sizeHint = len(xlsx.SheetData.Row[rowCount-1].C) } if rowCount < row { // append missing rows for rowIdx := rowCount; rowIdx < row; rowIdx++ { - xlsx.SheetData.Row = append(xlsx.SheetData.Row, xlsxRow{R: rowIdx + 1, C: make([]xlsxC, 0, sizeHint)}) + xlsx.SheetData.Row = append(xlsx.SheetData.Row, xlsxRow{R: rowIdx + 1, CustomHeight: customHeight, Ht: ht, C: make([]xlsxC, 0, sizeHint)}) } } rowData := &xlsx.SheetData.Row[row-1] -- cgit v1.2.1