Skip to content

Commit 04f6d6c

Browse files
authored
Ref #2075, add new function SetColVisible for streaming writer to support set columns visibility (#2087)
- Add new exported error variable ErrStreamSetColVisible - Fix lint issues - Update copyright info - Update unit tests - Update dependencies modules
1 parent 86cef47 commit 04f6d6c

62 files changed

Lines changed: 128 additions & 77 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2016-2025 The excelize Authors.
3+
Copyright (c) 2016-2026 The excelize Authors.
44
Copyright (c) 2011-2017 Geoffrey J. Teale
55
All rights reserved.
66

adjust.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

calc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

calcchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

cell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

chart.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

col.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//
@@ -299,6 +299,13 @@ func (f *File) SetColVisible(sheet, columns string, visible bool) error {
299299
}
300300
ws.mu.Lock()
301301
defer ws.mu.Unlock()
302+
ws.setColVisible(minVal, maxVal, visible)
303+
return err
304+
}
305+
306+
// setColVisible provides a function to set the visibility of a single column
307+
// or multiple columns by given column number.
308+
func (ws *xlsxWorksheet) setColVisible(minVal, maxVal int, visible bool) {
302309
colData := xlsxCol{
303310
Min: minVal,
304311
Max: maxVal,
@@ -310,7 +317,7 @@ func (f *File) SetColVisible(sheet, columns string, visible bool) error {
310317
cols := xlsxCols{}
311318
cols.Col = append(cols.Col, colData)
312319
ws.Cols = &cols
313-
return nil
320+
return
314321
}
315322
ws.Cols.Col = flatCols(colData, ws.Cols.Col, func(fc, c xlsxCol) xlsxCol {
316323
fc.BestFit = c.BestFit
@@ -322,7 +329,6 @@ func (f *File) SetColVisible(sheet, columns string, visible bool) error {
322329
fc.Width = c.Width
323330
return fc
324331
})
325-
return nil
326332
}
327333

328334
// GetColOutlineLevel provides a function to get outline level of a single

crypt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

crypt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

datavalidation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 - 2025 The excelize Authors. All rights reserved. Use of
1+
// Copyright 2016 - 2026 The excelize Authors. All rights reserved. Use of
22
// this source code is governed by a BSD-style license that can be found in
33
// the LICENSE file.
44
//

0 commit comments

Comments
 (0)