Skip to content

SetColStyle not honoring given style #467

@SteveTalt

Description

@SteveTalt

Description
SetColStyle seems to be corrupting spreadsheets. It doesn't seem to matter what data is in the column or which column or sheet you use.

I created this simple code to re-produce it:

package main

import (
	"github.com/excelize"
)

// define globals

var xlfile = "testlocal.xlsx"
var xlsheetname = "test"

// main
func main() {
	var (
		file *excelize.File
		err  error
	)
	// open the file
	file, err = excelize.OpenFile(xlfile)
	errorhandler(err)

	err = file.SetColStyle(xlsheetname, "C", 7)
	errorhandler(err)
	file.Save()

}

func errorhandler(e error) {
	if e != nil {
		panic(e)
	}
}

Steps to reproduce the issue:

  1. Create a spreadsheet named localtest.xlsx and a sheet named test
  2. run this test code against it
  3. open the spreadsheet and see it needs repair

Describe the results you received:
image
Repair Log:
`

Repair Result to testlocal5.xml

Errors were detected in file '/Users/stalt/Documents/go/src/setcoltest/testlocal.xlsx'Repaired Records: Column information from /xl/worksheets/sheet1.xml part

`

Describe the results you expected:
I expect the column to be formated with

Output of go version:

$ go version
go version go1.10 darwin/amd64

Excelize version or commit ID:

commit id: 448f552

Environment details (OS, Microsoft Excel™ version, physical, etc.):
macOS Mojave 10.14.5
Excel for Mac 16.27 (19071500)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions