Skip to content

Commit 2694a36

Browse files
martskinsmasquino
andauthored
Update dependencies module to fix vulnerabilities (#271)
- Add documentation for SelectedItems fields in PivotTableField data type - Adjust LineOptions data type define position - Update documentation for AutoFitColWidth and AddPivotTable functions - Upgrade GitHub Action packages version --------- Co-authored-by: Martin Asquino <martin.asquino@pedidosya.com>
1 parent d7456a4 commit 2694a36

6 files changed

Lines changed: 45 additions & 29 deletions

File tree

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: env GO111MODULE=on go test -v -timeout 60m -race ./... -coverprofile='coverage.txt' -covermode=atomic
4242

4343
- name: Codecov
44-
uses: codecov/codecov-action@v5
44+
uses: codecov/codecov-action@v6
4545
env:
4646
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4747
with:

col.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,9 @@ func (f *File) autoFitColWidth(sheet string, col, rows int, defaultFnt *Font) (f
935935
// AutoFitColWidth provides a function to auto fit columns width according to
936936
// their text content with font format. If the selected range contains hidden
937937
// columns and those columns have content, this function will unhide the hidden
938-
// columns. Not that this function calculates the width of the text
938+
// columns. Note that this function calculates the width of the text
939939
// approximately based on the font format, currently does not support merged
940-
// cells. the actual width may be different when you open the workbook in Office
940+
// cells, the actual width may be different when you open the workbook in Office
941941
// applications. This process can be relatively slow on large worksheets, so
942942
// this should normally only be called once per column, at the end of your
943943
// processing.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/xuri/efp v0.0.1
1010
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9
1111
golang.org/x/crypto v0.49.0
12-
golang.org/x/image v0.25.0
12+
golang.org/x/image v0.38.0
1313
golang.org/x/net v0.52.0
1414
golang.org/x/text v0.35.0
1515
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 h1:+C0TIdyyYmzadGaL/HBL
1616
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
1717
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
1818
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
19-
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
20-
golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
19+
golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE=
20+
golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
2121
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
2222
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
2323
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=

pivotTable.go

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ type PivotTableOptions struct {
9090
// NumFmt specifies the number format ID of the data field, this filed only
9191
// accepts built-in number format ID and does not support custom number format
9292
// expression currently.
93+
//
94+
// SelectedItems specifies the default selected items in a pivot table field.
95+
// The selected items must be values within the cell range referenced by that
96+
// field.
9397
type PivotTableField struct {
9498
Compact bool
9599
Data string
@@ -107,7 +111,7 @@ type PivotTableField struct {
107111
// options. Note that the same fields can not in Columns, Rows and Filter
108112
// fields at the same time.
109113
//
110-
// For example, create a pivot table on the range reference Sheet1!G2:M34 with
114+
// For example, create a pivot table on the range reference Sheet1!G4:M31 with
111115
// the range reference Sheet1!A1:E31 as the data source, summarize by sum for
112116
// revenue:
113117
//
@@ -127,13 +131,17 @@ type PivotTableField struct {
127131
// }
128132
// }()
129133
// // Create some data in a sheet
130-
// month := []string{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
134+
// month := []string{"Jan", "Feb", "Mar", "Apr", "May",
135+
// "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
131136
// year := []int{2017, 2018, 2019}
132137
// types := []string{"Meat", "Dairy", "Beverages", "Produce"}
133138
// revenue := []int{3217, 4512, 3891, 4738, 3054, 4265, 3643, 4901, 3378, 4126}
134139
// region := []string{"East", "West", "North", "South"}
135-
// if err := f.SetSheetRow("Sheet1", "A1", &[]string{"Month", "Year", "Type", "Revenue", "Region"}); err != nil {
140+
// if err := f.SetSheetRow(
141+
// "Sheet1", "A1", &[]string{"Month", "Year", "Type", "Revenue", "Region"},
142+
// ); err != nil {
136143
// fmt.Println(err)
144+
// return
137145
// }
138146
// for row := 2; row < 32; row++ {
139147
// f.SetCellValue("Sheet1", fmt.Sprintf("A%d", row), month[(row-2)%len(month)])
@@ -144,19 +152,27 @@ type PivotTableField struct {
144152
// }
145153
// if err := f.AddPivotTable(&excelize.PivotTableOptions{
146154
// DataRange: "Sheet1!A1:E31",
147-
// PivotTableRange: "Sheet1!G2:M34",
148-
// Rows: []excelize.PivotTableField{{Data: "Month", DefaultSubtotal: true}, {Data: "Year"}},
149-
// Filter: []excelize.PivotTableField{{Data: "Region"}},
150-
// Columns: []excelize.PivotTableField{{Data: "Type", DefaultSubtotal: true}},
151-
// Data: []excelize.PivotTableField{{Data: "Revenue", Name: "Summarize", Subtotal: "Sum"}},
152-
// RowGrandTotals: true,
153-
// ColGrandTotals: true,
154-
// ShowDrill: true,
155-
// ShowRowHeaders: true,
156-
// ShowColHeaders: true,
157-
// ShowLastColumn: true,
155+
// PivotTableRange: "Sheet1!G4:M30",
156+
// Rows: []excelize.PivotTableField{
157+
// {Data: "Month", DefaultSubtotal: true}, {Data: "Year"},
158+
// },
159+
// Filter: []excelize.PivotTableField{
160+
// {Data: "Region"}},
161+
// Columns: []excelize.PivotTableField{
162+
// {Data: "Type", DefaultSubtotal: true},
163+
// },
164+
// Data: []excelize.PivotTableField{
165+
// {Data: "Revenue", Name: "Summarize", Subtotal: "Sum"},
166+
// },
167+
// RowGrandTotals: true,
168+
// ColGrandTotals: true,
169+
// ShowDrill: true,
170+
// ShowRowHeaders: true,
171+
// ShowColHeaders: true,
172+
// ShowLastColumn: true,
158173
// }); err != nil {
159174
// fmt.Println(err)
175+
// return
160176
// }
161177
// if err := f.SaveAs("Book1.xlsx"); err != nil {
162178
// fmt.Println(err)

xmlChart.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,15 @@ type cPageMargins struct {
610610
T float64 `xml:"t,attr"`
611611
}
612612

613+
// LineOptions directly maps the format settings of the line.
614+
type LineOptions struct {
615+
Type LineType
616+
Dash LineDashType
617+
Fill Fill
618+
Smooth bool
619+
Width float64
620+
}
621+
613622
// ChartNumFmt directly maps the number format settings of the chart.
614623
type ChartNumFmt struct {
615624
CustomNumFmt string
@@ -717,15 +726,6 @@ type ChartMarker struct {
717726
Size int
718727
}
719728

720-
// LineOptions directly maps the format settings of the chart line.
721-
type LineOptions struct {
722-
Type LineType
723-
Dash LineDashType
724-
Fill Fill
725-
Smooth bool
726-
Width float64
727-
}
728-
729729
// ChartDataLabel directly maps the format settings of the chart labels.
730730
type ChartDataLabel struct {
731731
Alignment Alignment

0 commit comments

Comments
 (0)