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

Reproducing tutorial the spreadsheet is empty #1919

Closed
lcc opened this issue Jun 8, 2024 · 1 comment
Closed

Reproducing tutorial the spreadsheet is empty #1919

lcc opened this issue Jun 8, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@lcc
Copy link

lcc commented Jun 8, 2024

Description
Running the code at the README the generated spreadsheet cannot be open

package main

import (
	"fmt"

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

func main() {
	f := excelize.NewFile()
	defer func() {
		if err := f.Close(); err != nil {
			fmt.Println(err)
		}
	}()
	// Create a new sheet.
	index, err := f.NewSheet("Sheet2")
	if err != nil {
		fmt.Println(err)
		return
	}
	// Set value of a cell.
	f.SetCellValue("Sheet2", "A2", "Hello world.")
	f.SetCellValue("Sheet1", "B2", 100)
	// Set active sheet of the workbook.
	f.SetActiveSheet(index)
	// Save spreadsheet by the given path.
	if err := f.SaveAs("Book1.xlsx"); err != nil {
		fmt.Println(err)
	}
}

Steps to reproduce the issue:

  1. Add this code and run the program

Describe the results you received:
Empty spreadsheet and with errors (according to microsoft excell)

Describe the results you expected:
Generated spreadsheet

Output of go version:
go version go1.21.0

Excelize version or commit ID:
v2.8.1

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

@xuri
Copy link
Member

xuri commented Jun 9, 2024

Thanks for your issue. If you are reporting a new issue, make sure that we do not have any duplicates already exist. If it does not work with Go 1.21.0, please reference the issues #1465, #1595, #1603, #1608, #1614, #1619, #1620, #1621, #1623, #1633, #1637, #1641, #1642, #1648, #1651, #1652, #1656, #1657, #1660, #1663, #1670, #1686, #1734, #1752, #1764, #1768, #1774 and #1840. There are some incompatible changes in the Go 1.21.0 encoding/xml library. I have given feedback to the Go team and created a patch for it (golang/go#61881), and it has been fixed on Go 1.21.1. Please using the Go 1.20.14 and previous Go released version or upgrade to Go 1.21.1 and later. I have added notice on the README and documentation website for this, and I've closed this. If you have any questions, please let me know, and reopen this anytime.

@xuri xuri closed this as completed Jun 9, 2024
@xuri xuri added the duplicate This issue or pull request already exists label Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants