获取工作表格式属性
func (f *File) GetSheetFormatPr(sheet string, opts ...SheetFormatPrOptionsPtr) error
根据给定的工作表名称获取格式属性。
可选格式参数 | 数据类型 |
---|---|
BaseColWidth | uint8 |
DefaultColWidth | float64 |
DefaultRowHeight | float64 |
CustomHeight | bool |
ZeroHeight | bool |
ThickTop | bool |
ThickBottom | bool |
例子:
f := excelize.NewFile()
const sheet = "Sheet1"
var (
baseColWidth excelize.BaseColWidth
defaultColWidth excelize.DefaultColWidth
defaultRowHeight excelize.DefaultRowHeight
customHeight excelize.CustomHeight
zeroHeight excelize.ZeroHeight
thickTop excelize.ThickTop
thickBottom excelize.ThickBottom
)
if err := f.GetSheetFormatPr(sheet,
&baseColWidth,
&defaultColWidth,
&defaultRowHeight,
&customHeight,
&zeroHeight,
&thickTop,
&thickBottom,
); err != nil {
fmt.Println(err)
}
fmt.Println("Defaults:")
fmt.Println("- baseColWidth:", baseColWidth)
fmt.Println("- defaultColWidth:", defaultColWidth)
fmt.Println("- defaultRowHeight:", defaultRowHeight)
fmt.Println("- customHeight:", customHeight)
fmt.Println("- zeroHeight:", zeroHeight)
fmt.Println("- thickTop:", thickTop)
fmt.Println("- thickBottom:", thickBottom)
得到输出:
Defaults:
- baseColWidth: 0
- defaultColWidth: 0
- defaultRowHeight: 15
- customHeight: false
- zeroHeight: false
- thickTop: false
- thickBottom: false