设置工作表页边距
func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error
根据给定的工作表名称和页边距参数设置工作表的页边距。页边距可选参数:
参数 | 数据类型 |
---|---|
PageMarginBotom | float64 |
PageMarginFooter | float64 |
PageMarginHeader | float64 |
PageMarginLeft | float64 |
PageMarginRight | float64 |
PageMarginTop | float64 |
- 例如,设置名为
Sheet1
的工作表页边距:
f := excelize.NewFile()
const sheet = "Sheet1"
if err := f.SetPageMargins(sheet,
excelize.PageMarginBottom(1.0),
excelize.PageMarginFooter(1.0),
excelize.PageMarginHeader(1.0),
excelize.PageMarginLeft(1.0),
excelize.PageMarginRight(1.0),
excelize.PageMarginTop(1.0),
); err != nil {
panic(err)
}