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

AppProperties.Company will be lost when NewSheet #1298

Closed
jnst opened this issue Aug 2, 2022 · 2 comments
Closed

AppProperties.Company will be lost when NewSheet #1298

jnst opened this issue Aug 2, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@jnst
Copy link

jnst commented Aug 2, 2022

Description

SSIA

Screen Shot 2022-08-02 at 13 39 44

Steps to reproduce the issue:

  1. go get github.com/xuri/excelize/v2
  2. Run the following code
  3. Check saved excel file (File -> Properties... -> Summary)
package main

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

func main() {
	f := excelize.NewFile()
	if err := f.SetDocProps(&excelize.DocProperties{
		Category:       "category",
		ContentStatus:  "Draft",
		Created:        "2019-06-04T22:00:10Z",
		Creator:        "Go Excelize",
		Description:    "This file created by Go Excelize",
		Identifier:     "xlsx",
		Keywords:       "Spreadsheet",
		LastModifiedBy: "Go Author",
		Modified:       "2019-06-04T22:00:10Z",
		Revision:       "0",
		Subject:        "Test Subject",
		Title:          "Test Title",
		Language:       "en-US",
		Version:        "1.0.0",
	}); err != nil {
		panic(err)
	}
	if err := f.SetAppProps(&excelize.AppProperties{
		Application:       "Microsoft Excel",
		ScaleCrop:         true,
		DocSecurity:       3,
		Company:           "Company Name",
		LinksUpToDate:     true,
		HyperlinksChanged: true,
		AppVersion:        "16.0000",
	}); err != nil {
		panic(err)
	}
	f.NewSheet("new sheet") // <-------- TODO: It will be lost here. Commenting it out makes it work correctly.
	if err := f.SaveAs("sample.xlsx"); err != nil {
		panic(err)
	}
}

Output of go version:

$ go version
go version go1.18.4 darwin/amd64

Excelize version or commit ID:

$ grep excelize go.mod
        github.com/xuri/excelize/v2 v2.6.0 // indirect

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

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.7
BuildVersion:   19H1615
Microsoft Excel for Mac
Version 16.63.1 (22071301)
License: Microsoft 365 Subscription
@xuri xuri added bug Something isn't working in progress Working in progress labels Aug 2, 2022
@xuri xuri closed this as completed in 504d469 Aug 2, 2022
@xuri
Copy link
Member

xuri commented Aug 2, 2022

Thanks for your feedback. This issue has been fixed, 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 Aug 2, 2022
@jnst
Copy link
Author

jnst commented Aug 3, 2022

Thanks for the fix! <3

xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
xuri added 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
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants