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

empty sheetname will cause damaged file #1361

Closed
eaglexiang opened this issue Sep 27, 2022 · 2 comments
Closed

empty sheetname will cause damaged file #1361

eaglexiang opened this issue Sep 27, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@eaglexiang
Copy link
Contributor

eaglexiang commented Sep 27, 2022

Description

Steps to reproduce the issue:

  1. Run this demo
  2. You get one damaged file
  3. MS Excel cannot open this file unless you fix sheetname of workbook.xml inner test.xlsx file.
package main

import "github.com/xuri/excelize/v2"

func main() {
	f := excelize.NewFile()
	f.NewSheet("")
	err := f.SaveAs("test.xlsx")
	if err != nil {
		panic(err)
	}
}

Describe the results you received:

I got a damaged excel file.

Describe the results you expected:

Err returned by Method NewSheet or other Export-class Methods.

Output of go version:

go version go1.18.3 windows/amd64

Excelize version or commit ID:

v2.6.1

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

Microsoft® Excel® 适用于 Microsoft 365MSO (版本 2208 Build 16.0.15601.20148) 64 位

@xuri xuri added the bug Something isn't working label Sep 27, 2022
@eaglexiang
Copy link
Contributor Author

Adding err to NewSheet is simple but broken, Adding err to Export-class Methods like SaveAs and WriteTo may cause too many changes. So I gave up contributing this time. :)

@xuri xuri added the in progress Working in progress label Sep 27, 2022
@xuri xuri closed this as completed in efcf599 Sep 27, 2022
@xuri
Copy link
Member

xuri commented Sep 28, 2022

Thanks for your issue, I have fixed it. Please upgrade to the master branch code, and this patch will be released in the next version.

@xuri xuri removed the in progress Working in progress label Sep 28, 2022
xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
- Fix default number format parse issue with a long string of digits
- Fix creating a sheet with an empty name cause a corrupted file
- The `GetCellStyle` function no longer return master cell style of the merge cell range
- Using the specialized name in variables and functions
xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
- Fix default number format parse issue with a long string of digits
- Fix creating a sheet with an empty name cause a corrupted file
- The `GetCellStyle` function no longer return master cell style of the merge cell range
- Using the specialized name in variables and functions
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
- Fix default number format parse issue with a long string of digits
- Fix creating a sheet with an empty name cause a corrupted file
- The `GetCellStyle` function no longer return master cell style of the merge cell range
- Using the specialized name in variables and functions
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
None yet
Development

No branches or pull requests

2 participants