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

Issue getting estyle from GetStyle function #1963

Closed
devrodriguez opened this issue Jul 23, 2024 · 6 comments
Closed

Issue getting estyle from GetStyle function #1963

devrodriguez opened this issue Jul 23, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@devrodriguez
Copy link

devrodriguez commented Jul 23, 2024

Description
Im getting invalid memory address or nil pointer dereference when use GetStyle() > extractFills() functions, looks like if some background style does not set

Steps to reproduce the issue:

  1. It is not clear yet when is the problem come, user upload a modified file and the problem comes with the file
  2. I use file.GetStyle() function, I traced the error to GetBaseColor() function line:1385
  3. I get the below stack trace:
runtime error: invalid memory address or nil pointer dereference
        runtime.gopanic
		/usr/lib/go/src/runtime/panic.go:914
	runtime.panicmem
		/usr/lib/go/src/runtime/panic.go:261
	runtime.sigpanic
		/usr/lib/go/src/runtime/signal_unix.go:861
	github.com/xuri/excelize/v2.(*File).GetBaseColor
		/go/pkg/mod/github.com/xuri/excelize/**@v2.8.1/styles.go:1385
	github.com/xuri/excelize/v2.(*File).getThemeColor
		/go/pkg/mod/github.com/xuri/excelize/**@v2.8.1/styles.go:1422
	github.com/xuri/excelize/v2.(*File).extractFills
		/go/pkg/mod/github.com/xuri/excelize/**@v2.8.1/styles.go:1488
	github.com/xuri/excelize/v2.(*File).GetStyle
		/go/pkg/mod/github.com/xuri/excelize/**@v2.8.1/styles.go:1614
	github.com/melisource/fury_shipping-claims-backoffice/pkg/fprocess.ResetCellStyle
		/app/pkg/fprocess/fprocess.go:446

image
image

On above screenshots I can see that clrScheme.Lt1.SysClr is nil then when it try to get LastClr get panic.
Then my question is, Why SysClr is nil and what that it mean?

Describe the results you received:
invalid memory address or nil pointer dereference

Describe the results you expected:
Stye by index provided

Output of go version:

go version go1.21.6 darwin/arm64

Excelize version or commit ID:

v2.8.1

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

@devrodriguez
Copy link
Author

Is it exist other way for retrieve and modify some style, maybe I could use while issue is reviewed?

@xuri
Copy link
Member

xuri commented Jul 23, 2024

Thanks for your issue. Could you show us a complete, standalone example program or reproducible demo? If you open an existing workbook, please provide the file attachment without confidential info.

@xuri xuri added the needs more info This issue can't reproduce, need more info label Jul 23, 2024
@devrodriguez
Copy link
Author

devrodriguez commented Jul 23, 2024

issue_file.xlsx
Sure, above file its the issue file.
unfortunately I can't provide standalone example program.
I hope you can help me with the provided file.

thank you very much for your prompt response

@devrodriguez
Copy link
Author

On the other hand how can I understand what it mean propterty names like Lt1 Dk1 and others? Thks

@xuri xuri added bug Something isn't working and removed needs more info This issue can't reproduce, need more info labels Jul 23, 2024
@xuri xuri closed this as completed in 30c4cd7 Jul 23, 2024
@xuri
Copy link
Member

xuri commented Jul 23, 2024

Thanks for your feedback. This issue has been fixed, please upgrade to the master branch code by go get -u github.com/xuri/excelize/v2@master, and this patch will be released in the next version. You can get more details about Lt1 and Dk1 in ISO/IEC 29500:1 (ECMA-376 OOXML) specification §20.1.4.1.22 and §20.1.4.1.9.

@devrodriguez
Copy link
Author

Thank you for your prompt response and implementation of the fix!

@xuri xuri moved this to Bugfix in Excelize v2.9.0 Jul 23, 2024
zhangyimingdatiancai pushed a commit to zhangyimingdatiancai/excelize that referenced this issue Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Bugfix
Development

No branches or pull requests

2 participants