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

This closes #2061, fix border styles missing after saved workbook #2064

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

81 changes: 81 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Bug report
description: Create a report to help us improve
body:
- type: markdown
attributes:
value: |
If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.

- type: textarea
id: description
attributes:
label: Description
description: Briefly describe the problem you are having in a few paragraphs.
validations:
required: true

- type: textarea
id: reproduction-steps
attributes:
label: Steps to reproduce the issue
description: Explain how to cause the issue in the provided reproduction.
placeholder: |
1.
2.
3.
validations:
required: true

- type: textarea
id: received
attributes:
label: Describe the results you received
validations:
required: true

- type: textarea
id: expected
attributes:
label: Describe the results you expected
validations:
required: true

- type: input
id: go-version
attributes:
label: Go version
description: |
Output of `go version`:
placeholder: e.g. 1.23.4
validations:
required: true

- type: input
id: excelize-version
attributes:
label: Excelize version or commit ID
description: |
Which version of Excelize are you using?
placeholder: e.g. 2.9.0
validations:
required: true

- type: textarea
id: env
attributes:
label: Environment
description: Environment details (OS, Microsoft Excel™ version, physical, etc.)
render: shell
validations:
required: true

- type: checkboxes
id: checkboxes
attributes:
label: Validations
description: Before submitting the issue, please make sure you do the following
options:
- label: Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
required: true
- label: The provided reproduction is a minimal reproducible example of the bug.
required: true
44 changes: 0 additions & 44 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Feature request
description: Suggest an idea for this project
body:
- type: markdown
attributes:
value: |
If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.

- type: textarea
id: description
attributes:
label: Description
description: Describe the feature that you would like added
validations:
required: true

- type: textarea
id: additional-context
attributes:
label: Additional context
description: Any other context or screenshots about the feature request here?

- type: checkboxes
id: checkboxes
attributes:
label: Validations
description: Before submitting the issue, please make sure you do the following
options:
- label: Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.
required: true
2 changes: 1 addition & 1 deletion numfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4661,7 +4661,7 @@ var (
}
)

// getSupportedLanguageInfo returns language infomation by giving language code.
// getSupportedLanguageInfo returns language information by giving language code.
// This function does not support different calendar type of the language
// currently. For example: the hexadecimal language code 3010429 (fa-IR,301)
// will be convert to 0429 (fa-IR).
Expand Down
29 changes: 10 additions & 19 deletions styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -1441,16 +1441,16 @@ func (f *File) getThemeColor(clr *xlsxColor) string {
func (f *File) extractBorders(bdr *xlsxBorder, s *xlsxStyleSheet, style *Style) {
if bdr != nil {
var borders []Border
extractBorder := func(lineType string, line xlsxLine) {
if line.Style != "" {
extractBorder := func(lineType string, line *xlsxLine) {
if line != nil && line.Style != "" {
borders = append(borders, Border{
Type: lineType,
Color: f.getThemeColor(line.Color),
Style: inStrSlice(styleBorders, line.Style, false),
})
}
}
for i, line := range []xlsxLine{
for i, line := range []*xlsxLine{
bdr.Left, bdr.Right, bdr.Top, bdr.Bottom, bdr.Diagonal, bdr.Diagonal,
} {
if i < 4 {
Expand Down Expand Up @@ -2128,29 +2128,20 @@ func newBorders(style *Style) *xlsxBorder {
var border xlsxBorder
for _, v := range style.Border {
if 0 <= v.Style && v.Style < 14 {
var color xlsxColor
color.RGB = getPaletteColor(v.Color)
line := &xlsxLine{Style: styleBorders[v.Style], Color: &xlsxColor{RGB: getPaletteColor(v.Color)}}
switch v.Type {
case "left":
border.Left.Style = styleBorders[v.Style]
border.Left.Color = &color
border.Left = line
case "right":
border.Right.Style = styleBorders[v.Style]
border.Right.Color = &color
border.Right = line
case "top":
border.Top.Style = styleBorders[v.Style]
border.Top.Color = &color
border.Top = line
case "bottom":
border.Bottom.Style = styleBorders[v.Style]
border.Bottom.Color = &color
border.Bottom = line
case "diagonalUp":
border.Diagonal.Style = styleBorders[v.Style]
border.Diagonal.Color = &color
border.DiagonalUp = true
border.Diagonal, border.DiagonalUp = line, true
case "diagonalDown":
border.Diagonal.Style = styleBorders[v.Style]
border.Diagonal.Color = &color
border.DiagonalDown = true
border.Diagonal, border.DiagonalDown = line, true
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions xmlStyles.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ type xlsxBorder struct {
DiagonalDown bool `xml:"diagonalDown,attr,omitempty"`
DiagonalUp bool `xml:"diagonalUp,attr,omitempty"`
Outline bool `xml:"outline,attr,omitempty"`
Left xlsxLine `xml:"left"`
Right xlsxLine `xml:"right"`
Top xlsxLine `xml:"top"`
Bottom xlsxLine `xml:"bottom"`
Diagonal xlsxLine `xml:"diagonal"`
Left *xlsxLine `xml:"left"`
Right *xlsxLine `xml:"right"`
Top *xlsxLine `xml:"top"`
Bottom *xlsxLine `xml:"bottom"`
Diagonal *xlsxLine `xml:"diagonal"`
Vertical *xlsxLine `xml:"vertical"`
Horizontal *xlsxLine `xml:"horizontal"`
}
Expand Down