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

Excelize should have GetColStyle and GetRowStyle #1293

Closed
thomascharbonnel opened this issue Aug 1, 2022 · 2 comments
Closed

Excelize should have GetColStyle and GetRowStyle #1293

thomascharbonnel opened this issue Aug 1, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@thomascharbonnel
Copy link
Contributor

Description

SetColStyle and SetRowStyle exist but there is no equivalent read method to read a column/row's style. Ideally this would return col/row styles without parsing the entire worksheet's XML (if that's possible?).

@lanfeust21
Copy link

yes, that would allow to copy style from existing File and have a better designed output

@xuri xuri added enhancement New feature or request in progress Working in progress labels Sep 6, 2022
@xuri xuri closed this as completed in 0c5cdfe Sep 6, 2022
@xuri
Copy link
Member

xuri commented Sep 6, 2022

This library supported getting row style ID by the GetRowOpts function since version 2.6.1. For example, get the style ID of each row on Sheet1:

rows, err := f.Rows("Sheet1")
if err != nil {
	fmt.Println(err)
	return
}
var rowNum int
for rows.Next() {
	rowNum++
	rowOpts := rows.GetRowOpts()
	fmt.Printf("the style ID of row %d is %d\n", rowNum, rowOpts.StyleID)
}
if err = rows.Close(); err != nil {
	fmt.Println(err)
}

I have added new a function GetColStyle, now you can get the column style ID by it like this:

styleID, err := f.GetColStyle("Sheet1", "C")

@xuri xuri removed the in progress Working in progress label Sep 6, 2022
xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
- Fix generate workbook corruption after insert cols/rows in some case
- Update unit tests
- Update dependencies module
xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
- Fix generate workbook corruption after insert cols/rows in some case
- Update unit tests
- Update dependencies module
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
- Fix generate workbook corruption after insert cols/rows in some case
- Update unit tests
- Update dependencies module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants