Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupted Excel file with conditional formatting inside pivot table #883

Closed
postulha opened this issue Jul 14, 2021 · 1 comment
Closed

Comments

@postulha
Copy link

Description

Corrupted Excel file is created after opening a file with conditional formatting inside pivot table, calling UpdateLinkedValue(), and saving it.

Steps to reproduce the issue:
Run the following code (copy input.xlsx to the same dir):

package main

import (
	"log"

	"github.com/360EntSecGroup-Skylar/excelize/v2"
)

func main() {
	f, err := excelize.OpenFile("./input.xlsx")
	if err != nil {
		log.Fatalf("open Excel file: %v", err)
	}

	if err := f.UpdateLinkedValue(); err != nil {
		log.Fatalf("update Excel linked values: %v", err)
	}

	if err = f.SaveAs("./output.xlsx"); err != nil {
		log.Fatalf("save Excel file: %v", err)
	}
}

Describe the results you received:
After opening the result file output.xlsx I see the message WORKBOOK REPAIRED We temporarily repaired this workbook so that you can open it in Reading View..

image

Describe the results you expected:
The result file is successfully opened without any warnings or errors.

Output of go version:

go version go1.16.3 linux/amd64

Excelize version or commit ID:

2.4.0

Environment details (OS, Microsoft Excel™ version, physical, etc.):
go env output:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/alex/.cache/go-build"
GOENV="/home/alex/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/alex/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/alex/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1758173493=/tmp/go-build -gno-record-gcc-switches"

Microsoft Excel version: Office 365 online on https://www.office.com

@xuri xuri added the in progress Working in progress label Jul 15, 2021
@xuri xuri closed this as completed in ec0ca8b Jul 15, 2021
@xuri
Copy link
Member

xuri commented Jul 15, 2021

Thanks for your feedback, I have fixed it, please try to use the master branch code, and this patch will be released in the next version.

@xuri xuri removed the in progress Working in progress label Jul 15, 2021
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants