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

SetCellValue type int64 get a wrong negative number #2068

Closed
2 tasks done
wellzm opened this issue Jan 17, 2025 · 3 comments
Closed
2 tasks done

SetCellValue type int64 get a wrong negative number #2068

wellzm opened this issue Jan 17, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@wellzm
Copy link

wellzm commented Jan 17, 2025

Description

if type int64 value bigger than max value of int (2147483647) will get a negative number

https://github.com/qax-os/excelize/blob/master/cell.go#L218

i have to transform this value to string type as temporary solution

Steps to reproduce the issue

for examlpe:

var int64Value = int64(3445478214)
f.SetCellValue("Sheet1", "A1", int64Value)

this code will get negative number,
because force transform int64 value into int value: int(int64Value)

Describe the results you received

a negative number like:
-200000

Describe the results you expected

right int64 number

Go version

1.16.1

Excelize version or commit ID

v1.4.0

Environment

windows

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@xuri
Copy link
Member

xuri commented Jan 19, 2025

Thanks for your issue. I tested with v2.9.0 and master branch code, and it works well. Please try to upgrade the lasted version. If it still doesn't work, please let me know.

@imirkin
Copy link
Contributor

imirkin commented Jan 19, 2025

@xuri you seem to be using the "int" type which is platform dependent. I'd assume the issue only shows on a 32-bit platform?

@xuri xuri closed this as completed in b936343 Jan 21, 2025
@xuri xuri added the bug Something isn't working label Jan 21, 2025
@xuri xuri moved this to Bugfix in Excelize v2.9.1 Jan 21, 2025
@xuri
Copy link
Member

xuri commented Jan 21, 2025

Thanks for your issue. I fixed this by made SetCellInt function required int64 data type parameter. Please upgrade to the master branch code, and these breaking changes will be released on the next version.

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
Status: Bugfix
Development

No branches or pull requests

3 participants