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

Make case-insensitive for the workbook extension name #1503

Closed
playGitboy opened this issue Mar 22, 2023 · 3 comments · Fixed by #1504
Closed

Make case-insensitive for the workbook extension name #1503

playGitboy opened this issue Mar 22, 2023 · 3 comments · Fixed by #1504

Comments

@playGitboy
Copy link
Contributor

比如

f := excelize.NewFile()
f.SaveAs("D:\\Temp\\test.XLsx")
f.Close()

会发现test.XLsx文件并未生成

调试查看file.go文件SaveAs函数,发现关键点应在

contentType, ok := map[string]string{
  ".xlam": ContentTypeAddinMacro,
  ".xlsm": ContentTypeMacro,
  ".xlsx": ContentTypeSheetML,
  ".xltm": ContentTypeTemplateMacro,
  ".xltx": ContentTypeTemplate,
}[filepath.Ext(f.Path)]

后面修改为strings.ToLower(filepath.Ext(f.Path))可解决增强容错

Version: Excelize [email protected]

@xuri
Copy link
Member

xuri commented Mar 22, 2023

Thanks for your issue. Would you like to create a pull request to fix that?

@xuri xuri changed the title SaveAs 用非小写扩展名保存失败 Make case-insensitive for the workbook extension name Mar 22, 2023
@playGitboy
Copy link
Contributor Author

Thanks for your issue. Would you like to create a pull request to fix that?

Sorry, the first pull request is not very familiar, I don't know if the submission is compliant.

@xuri
Copy link
Member

xuri commented Mar 23, 2023

Thanks for your contribution. This patch will be released in the next version.

fudali113 pushed a commit to fudali113/excelize that referenced this issue Apr 17, 2023
xuri pushed a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
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

Successfully merging a pull request may close this issue.

2 participants