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

Add SetColStyle for stream writer #1493

Closed
inX-Su opened this issue Mar 15, 2023 · 3 comments
Closed

Add SetColStyle for stream writer #1493

inX-Su opened this issue Mar 15, 2023 · 3 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@inX-Su
Copy link

inX-Su commented Mar 15, 2023

Description
SetColStyle not working

Steps to reproduce the issue:

func test() {
	file := excelize.NewFile()
	writer, _ := file.NewStreamWriter("sheet1")
	row := make([]interface{}, 0)
	row = append(row, 100)
	writer.SetRow("A1", row)
	// $ format
	dollarStyle, _ := file.NewStyle(&excelize.Style{
		NumFmt: 177,
	})
	file.SetColStyle("sheet1", "A", dollarStyle)

	file.SaveAs("a.xlsx")
}
@xuri
Copy link
Member

xuri commented Mar 15, 2023

Thanks for your issue. The SetColStyle function is not a streaming API, so it won't work in stream mode, we need to implement it for stream writer, and contribution are welcome.

@xuri xuri changed the title SetColStyle not working Add SetColStyle for stream writer Mar 15, 2023
@xuri xuri added the enhancement New feature or request label Mar 15, 2023
@inX-Su
Copy link
Author

inX-Su commented Mar 15, 2023

I find the SetColWidth function supported for streaming API, however, it also doesn't work.

func main() {
	file := excelize.NewFile()

	writer, _ := file.NewStreamWriter("Sheet1")
	row := make([]interface{}, 0)
	row = append(row, 101)
	row = append(row, 123)
	writer.SetRow("A1", row)

	writer.SetColWidth(2, 3, 20)

	file.SaveAs("a.xlsx")
}

@xuri
Copy link
Member

xuri commented Mar 15, 2023

As the documentation notice: "you must call the SetColWidth function before the SetRow function." This was duplicate with issue #1294, I closed this merged into #1294.

@xuri xuri closed this as completed Mar 16, 2023
@xuri xuri added the duplicate This issue or pull request already exists label Mar 16, 2023
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 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants