Skip to content

Commit 06a12f7

Browse files
committed
Update en version docs for new AutoFitColWidth function
1 parent 61973aa commit 06a12f7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

en/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Excelize is a library written in pure Go providing a set of functions that allow
99
- go.dev: [pkg.go.dev/github.com/xuri/excelize/v2](https://pkg.go.dev/github.com/xuri/excelize/v2)
1010
- Licenses: [BSD 3-Clause](https://opensource.org/licenses/BSD-3-Clause)
1111
- Last version: [v2.10.1](https://github.com/xuri/excelize/releases/latest)
12-
- Document update time: February 25, 2026
12+
- Document update time: March 11, 2026
1313

1414
## Project mission
1515

en/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
* [Unprotect workbook](workbook.md#UnprotectWorkbook)
5454
* [Worksheet](sheet.md)
5555
* [Set column visibility](sheet.md#SetColVisible)
56+
* [Auto fit column width](sheet.md#AutoFitColWidth)
5657
* [Set column width](sheet.md#SetColWidth)
5758
* [Set row height](sheet.md#SetRowHeight)
5859
* [Set row visibility](sheet.md#SetRowVisible)

en/sheet.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ Hide the columns from `D` to `F` (included):
1818
err := f.SetColVisible("Sheet1", "D:F", false)
1919
```
2020

21+
## Auto fit column width {#AutoFitColWidth}
22+
23+
```go
24+
func (f *File) AutoFitColWidth(sheet, columns string) error
25+
```
26+
27+
AutoFitColWidth provides a function to auto fit columns width according to their text content with font format. Not that this function calculates the width of the text approximately based on the font format, currently does not support merged cells. the actual width may be different when you open the workbook in Office applications. This process can be relatively slow on large worksheets, so this should normally only be called once per column, at the end of your processing. For example, auto fit column width for column `D` on `Sheet1`:
28+
29+
```go
30+
err := f.AutoFitColWidth("Sheet1", "D")
31+
```
32+
33+
Auto fit column width for columns `D` to `F` on `Sheet1`:
34+
35+
```go
36+
err := f.AutoFitColWidth("Sheet1", "C:F")
37+
```
38+
2139
## Set column width {#SetColWidth}
2240

2341
```go

0 commit comments

Comments
 (0)