|
|
@@ -72,7 +72,7 @@ func (sh *Sheet) Cell(row, col int) *Cell {
|
|
|
return new(Cell)
|
|
|
}
|
|
|
|
|
|
-//Set the width of a single column or multipel columns.
|
|
|
+//Set the width of a single column or multiple columns.
|
|
|
func (s *Sheet) SetColWidth(startcol, endcol int, width float64) error {
|
|
|
if startcol > endcol {
|
|
|
return fmt.Errorf("Could not set width for range %d-%d: startcol must be less than endcol.", startcol, endcol)
|
|
|
@@ -91,7 +91,7 @@ func (s *Sheet) SetColWidth(startcol, endcol int, width float64) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// Dump sheet to it's XML representation, intended for internal use only
|
|
|
+// Dump sheet to its XML representation, intended for internal use only
|
|
|
func (s *Sheet) makeXLSXSheet(refTable *RefTable, styles *xlsxStyleSheet) *xlsxWorksheet {
|
|
|
worksheet := newXlsxWorksheet()
|
|
|
xSheet := xlsxSheetData{}
|
|
|
@@ -110,6 +110,12 @@ func (s *Sheet) makeXLSXSheet(refTable *RefTable, styles *xlsxStyleSheet) *xlsxW
|
|
|
xFont, xFill, xBorder, xCellStyleXf, xCellXf := style.makeXLSXStyleElements()
|
|
|
fontId := styles.addFont(xFont)
|
|
|
fillId := styles.addFill(xFill)
|
|
|
+
|
|
|
+ // HACK - adding light grey fill, as in OO and Google
|
|
|
+ greyfill := xlsxFill{}
|
|
|
+ greyfill.PatternFill.PatternType = "lightGrey"
|
|
|
+ styles.addFill(greyfill)
|
|
|
+
|
|
|
borderId := styles.addBorder(xBorder)
|
|
|
xCellStyleXf.FontId = fontId
|
|
|
xCellStyleXf.FillId = fillId
|
|
|
@@ -150,10 +156,28 @@ func (s *Sheet) makeXLSXSheet(refTable *RefTable, styles *xlsxStyleSheet) *xlsxW
|
|
|
xC.S = XfId
|
|
|
}
|
|
|
xRow.C = append(xRow.C, xC)
|
|
|
+
|
|
|
+ if cell.HMerge > 0 || cell.VMerge > 0 {
|
|
|
+ // r == rownum, c == colnum
|
|
|
+ mc := xlsxMergeCell{}
|
|
|
+ start := fmt.Sprintf("%s%d", numericToLetters(c), r+1)
|
|
|
+ endcol := c + cell.HMerge
|
|
|
+ endrow := r + cell.VMerge + 1
|
|
|
+ end := fmt.Sprintf("%s%d", numericToLetters(endcol), endrow)
|
|
|
+ mc.Ref = start + ":" + end
|
|
|
+ if worksheet.MergeCells == nil {
|
|
|
+ worksheet.MergeCells = &xlsxMergeCells{}
|
|
|
+ }
|
|
|
+ worksheet.MergeCells.Cells = append(worksheet.MergeCells.Cells, mc)
|
|
|
+ }
|
|
|
}
|
|
|
xSheet.Row = append(xSheet.Row, xRow)
|
|
|
}
|
|
|
|
|
|
+ if worksheet.MergeCells != nil {
|
|
|
+ worksheet.MergeCells.Count = len(worksheet.MergeCells.Cells)
|
|
|
+ }
|
|
|
+
|
|
|
worksheet.Cols = xlsxCols{Col: []xlsxCol{}}
|
|
|
for _, col := range s.Cols {
|
|
|
if col.Width == 0 {
|