Skip to content

Commit

Permalink
Add docs for Set/Get page margins
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri committed Oct 19, 2019
1 parent f6c0ef5 commit 30c778e
Show file tree
Hide file tree
Showing 18 changed files with 612 additions and 36 deletions.
4 changes: 2 additions & 2 deletions en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Excelize is a library written in pure Go and providing a set of functions that a
- GoDoc: [godoc.org/github.com/360EntSecGroup-Skylar/excelize](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize)
- Licenses: [BSD 3-Clause](https://opensource.org/licenses/BSD-3-Clause)
- Last version: [v2.0.2](https://github.com/360EntSecGroup-Skylar/excelize/releases/latest)
- Document update time: October 9, 2019
- Document update time: October 17, 2019

## Project mission

Expand All @@ -30,6 +30,6 @@ In some cases, we need to manipulate Excel documents through programs, such as:

## Well-known customers

<a href="https://360.net" title="360 Enterprise Security Group" target="_blank"><img width="165" src="../images/vendor/360@2x.png" alt="360 Enterprise Security Group"></a> <a href="https://www.baidu.com" title="Baidu, Inc." target="_blank"><img width="165" src="../images/vendor/baidu@2x.png" alt="Baidu, Inc."></a> [![CCi. Inc.](../images/vendor/ccint.com.png)](https://www.ccint.com) <a href="https://www.inke.cn" title="Inke, Inc." target="_blank"><img width="165" src="../images/vendor/inke@2x.png" alt="Inke, Inc."></a> <a href="https://www.meituan.com" title="Meituan-Dianping" target="_blank"><img width="165" src="../images/vendor/meituan@2x.png" alt="Meituan-Dianping"></a> <a href="https://www.163.com" title="NetEase" target="_blank"><img width="165" src="../images/vendor/netease@2x.png" alt="NetEase"></a> <a href="https://www.bilibili.com" title="Bilibili" target="_blank"><img width="165" src="../images/vendor/bilibili@2x.png" alt="Bilibili"></a> <a href="https://www.qianxin.com" title="Qi An Xin Group" target="_blank"><img width="165" src="../images/vendor/qianxin.com_en@2x.png" alt="Qi An Xin Group"></a> <a href="https://www.alibabagroup.com" title="Alibaba Group" target="_blank"><img width="165" src="../images/vendor/alibabagroup@2x.png" alt="Alibaba Group"></a> <a href="https://www.ele.me" title="ele.me" target="_blank"><img width="165" src="../images/vendor/ele.me@2x.png" alt="ele.me"></a> <a href="https://www.huifu.com" title="Huifu" target="_blank"><img width="165" src="../images/vendor/huifu.com@2x.png" alt="Huifu"></a> <a href="http://www.dodoca.com" title="Dodoca Information Technology" target="_blank"><img width="165" src="../images/vendor/dodoca.com@2x.png" alt="Dodoca Information Technology"></a> <a href="https://bytedance.com" title="ByteDance" target="_blank"><img width="165" src="../images/vendor/bytedance@2x.png" alt="ByteDance"></a> <a href="https://www.flashexpress.com" title="Flash Express" target="_blank"><img width="165" src="../images/vendor/flashexpress.com@2x.png" alt="Flash Express"></a> <a href="http://www.bigbaser.com" title="Big Baser" target="_blank"><img width="165" src="../images/vendor/bigbaser.com@2x.png" alt="Big Baser"></a>
<a href="https://www.360.cn" title="Qihoo 360" target="_blank"><img width="165" src="../images/vendor/360@2x.png" alt="Qihoo 360"></a> <a href="https://www.baidu.com" title="Baidu, Inc." target="_blank"><img width="165" src="../images/vendor/baidu@2x.png" alt="Baidu, Inc."></a> [![CCi. Inc.](../images/vendor/ccint.com.png)](https://www.ccint.com) <a href="https://www.inke.cn" title="Inke, Inc." target="_blank"><img width="165" src="../images/vendor/inke@2x.png" alt="Inke, Inc."></a> <a href="https://www.meituan.com" title="Meituan-Dianping" target="_blank"><img width="165" src="../images/vendor/meituan@2x.png" alt="Meituan-Dianping"></a> <a href="https://www.163.com" title="NetEase" target="_blank"><img width="165" src="../images/vendor/netease@2x.png" alt="NetEase"></a> <a href="https://www.bilibili.com" title="Bilibili" target="_blank"><img width="165" src="../images/vendor/bilibili@2x.png" alt="Bilibili"></a> <a href="https://www.qianxin.com" title="Qi An Xin Group" target="_blank"><img width="165" src="../images/vendor/qianxin.com_en@2x.png" alt="Qi An Xin Group"></a> <a href="https://www.alibabagroup.com" title="Alibaba Group" target="_blank"><img width="165" src="../images/vendor/alibabagroup@2x.png" alt="Alibaba Group"></a> <a href="https://www.ele.me" title="ele.me" target="_blank"><img width="165" src="../images/vendor/ele.me@2x.png" alt="ele.me"></a> <a href="https://www.huifu.com" title="Huifu" target="_blank"><img width="165" src="../images/vendor/huifu.com@2x.png" alt="Huifu"></a> <a href="http://www.dodoca.com" title="Dodoca Information Technology" target="_blank"><img width="165" src="../images/vendor/dodoca.com@2x.png" alt="Dodoca Information Technology"></a> <a href="https://bytedance.com" title="ByteDance" target="_blank"><img width="165" src="../images/vendor/bytedance@2x.png" alt="ByteDance"></a> <a href="https://www.flashexpress.com" title="Flash Express" target="_blank"><img width="165" src="../images/vendor/flashexpress.com@2x.png" alt="Flash Express"></a> <a href="http://www.bigbaser.com" title="Big Baser" target="_blank"><img width="165" src="../images/vendor/bigbaser.com@2x.png" alt="Big Baser"></a>

If your company or product is also using Excelize, welcome <a href="mailto: xuri.me@gmail.com?Subject=Please add our company in Excelize Introduction page&amp;Body=Hello%2C%20this%20is%20%3Cyour%20name%3E%20from%20%3Cyour%20company%20name%3E.%0AWe%20are%20using%20Excelize%20and%20will%20be%20proud%20to%20add%20our%20company%20name%20to%20Excelize%20Introduction%20page.%0APlease%20see%20attachment%20for%20our%20logo.%20%3CBe%20sure%20to%20include%20logo%20in%20attachment%3E%0A" title="send Logo via E-mail">send Logo</a> to us.
2 changes: 2 additions & 0 deletions en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* [Get worksheet view properties](workbook.md#GetSheetViewOptions)
* [Set worksheet page layout](workbook.md#SetPageLayout)
* [Get worksheet page layout](workbook.md#GetPageLayout)
* [Set worksheet page margins](workbook.md#SetPageMargins)
* [Get worksheet page margins](workbook.md#GetPageMargins)
* [Set header and footer](workbook.md#SetHeaderFooter)
* [Set defined name](workbook.md#SetDefinedName)
* [Get defined name](workbook.md#GetDefinedName)
Expand Down
102 changes: 98 additions & 4 deletions en/workbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,104 @@ if err := f.GetPageLayout("Sheet1", &paperSize); err != nil {
fmt.Println("Defaults:")
fmt.Printf("- orientation: %q\n", orientation)
fmt.Printf("- paper size: %d\n", paperSize)
// Output:
// Defaults:
// - orientation: "portrait"
// - paper size: 1
```
Output:
```text
Defaults:
- orientation: "portrait"
- paper size: 1
```
## Set worksheet page margins {#SetPageMargins}
SetPageMargins provides a function to set worksheet page margins. Available options:
Options|Type
---|---
PageMarginBotom|float64
PageMarginFooter|float64
PageMarginHeader|float64
PageMarginLeft|float64
PageMarginRight|float64
PageMarginTop|float64
- For example, set page margins of `Sheet1`:
```go
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)
}
```
## Get worksheet page margins {#GetPageMargins}
GetPageMargins provides a function to get worksheet page margins. Available options:
Options|Type
---|---
PageMarginBotom|float64
PageMarginFooter|float64
PageMarginHeader|float64
PageMarginLeft|float64
PageMarginRight|float64
PageMarginTop|float64
- For example, get page margins of `Sheet1`:
```go
f := excelize.NewFile()
const sheet = "Sheet1"
var (
marginBottom excelize.PageMarginBottom
marginFooter excelize.PageMarginFooter
marginHeader excelize.PageMarginHeader
marginLeft excelize.PageMarginLeft
marginRight excelize.PageMarginRight
marginTop excelize.PageMarginTop
)
if err := f.GetPageMargins(sheet,
&marginBottom,
&marginFooter,
&marginHeader,
&marginLeft,
&marginRight,
&marginTop,
); err != nil {
panic(err)
}
fmt.Println("Defaults:")
fmt.Println("- marginBottom:", marginBottom)
fmt.Println("- marginFooter:", marginFooter)
fmt.Println("- marginHeader:", marginHeader)
fmt.Println("- marginLeft:", marginLeft)
fmt.Println("- marginRight:", marginRight)
fmt.Println("- marginTop:", marginTop)
```
Output:
```text
Defaults:
- marginBottom: 0.75
- marginFooter: 0.3
- marginHeader: 0.3
- marginLeft: 0.7
- marginRight: 0.7
- marginTop: 0.75
```
## Set header and footer {#SetHeaderFooter}
Expand Down
4 changes: 2 additions & 2 deletions fr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Excelize est une bibliothèque écrite en pur Go et fournissant un ensemble de f
- GoDoc: [godoc.org/github.com/360EntSecGroup-Skylar/excelize](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize)
- Licenses: [BSD 3-Clause](https://opensource.org/licenses/BSD-3-Clause)
- Dernière version: [v2.0.2](https://github.com/360EntSecGroup-Skylar/excelize/releases/latest)
- Heure de mise à jour du document: 9 octobre 2019
- Heure de mise à jour du document: 17 octobre 2019

## Mission du projet

Expand All @@ -30,6 +30,6 @@ Dans certains cas, nous devons manipuler des documents Excel à travers des prog

## Des clients connus

<a href="https://360.net" title="360 Groupe de sécurité d'entrepriseя" target="_blank"><img width="165" src="../images/vendor/360@2x.png" alt="360 Groupe de sécurité d'entrepriseя"></a> <a href="https://www.baidu.com" title="Baidu, Inc." target="_blank"><img width="165" src="../images/vendor/baidu@2x.png" alt="Baidu, Inc."></a> [![CCi. Inc.](../images/vendor/ccint.com.png)](https://www.ccint.com) <a href="https://www.inke.cn" title="Inke, Inc." target="_blank"><img width="165" src="../images/vendor/inke@2x.png" alt="Inke, Inc."></a> <a href="https://www.meituan.com" title="Meituan-Dianping" target="_blank"><img width="165" src="../images/vendor/meituan@2x.png" alt="Meituan-Dianping"></a> <a href="https://www.163.com" title="NetEase" target="_blank"><img width="165" src="../images/vendor/netease@2x.png" alt="NetEase"></a> <a href="https://www.bilibili.com" title="Bilibili" target="_blank"><img width="165" src="../images/vendor/bilibili@2x.png" alt="Bilibili"></a> <a href="https://www.qianxin.com" title="Qi An Xin Groupe" target="_blank"><img width="165" src="../images/vendor/qianxin.com_en@2x.png" alt="Qi An Xin Groupe"></a> <a href="https://www.alibabagroup.com" title="Alibaba Group" target="_blank"><img width="165" src="../images/vendor/alibabagroup@2x.png" alt="Alibaba Group"></a> <a href="https://www.ele.me" title="ele.me" target="_blank"><img width="165" src="../images/vendor/ele.me@2x.png" alt="ele.me"></a> <a href="https://www.huifu.com" title="Huifu" target="_blank"><img width="165" src="../images/vendor/huifu.com@2x.png" alt="Huifu"></a> <a href="http://www.dodoca.com" title="Dodoca Information Technology" target="_blank"><img width="165" src="../images/vendor/dodoca.com@2x.png" alt="Dodoca Information Technology"></a> <a href="https://bytedance.com" title="ByteDance" target="_blank"><img width="165" src="../images/vendor/bytedance@2x.png" alt="ByteDance"></a> <a href="https://www.flashexpress.com" title="Flash Express" target="_blank"><img width="165" src="../images/vendor/flashexpress.com@2x.png" alt="Flash Express"></a> <a href="http://www.bigbaser.com" title="Big Baser" target="_blank"><img width="165" src="../images/vendor/bigbaser.com@2x.png" alt="Big Baser"></a>
<a href="https://www.360.cn" title="Qihoo 360" target="_blank"><img width="165" src="../images/vendor/360@2x.png" alt="Qihoo 360"></a> <a href="https://www.baidu.com" title="Baidu, Inc." target="_blank"><img width="165" src="../images/vendor/baidu@2x.png" alt="Baidu, Inc."></a> [![CCi. Inc.](../images/vendor/ccint.com.png)](https://www.ccint.com) <a href="https://www.inke.cn" title="Inke, Inc." target="_blank"><img width="165" src="../images/vendor/inke@2x.png" alt="Inke, Inc."></a> <a href="https://www.meituan.com" title="Meituan-Dianping" target="_blank"><img width="165" src="../images/vendor/meituan@2x.png" alt="Meituan-Dianping"></a> <a href="https://www.163.com" title="NetEase" target="_blank"><img width="165" src="../images/vendor/netease@2x.png" alt="NetEase"></a> <a href="https://www.bilibili.com" title="Bilibili" target="_blank"><img width="165" src="../images/vendor/bilibili@2x.png" alt="Bilibili"></a> <a href="https://www.qianxin.com" title="Qi An Xin Groupe" target="_blank"><img width="165" src="../images/vendor/qianxin.com_en@2x.png" alt="Qi An Xin Groupe"></a> <a href="https://www.alibabagroup.com" title="Alibaba Group" target="_blank"><img width="165" src="../images/vendor/alibabagroup@2x.png" alt="Alibaba Group"></a> <a href="https://www.ele.me" title="ele.me" target="_blank"><img width="165" src="../images/vendor/ele.me@2x.png" alt="ele.me"></a> <a href="https://www.huifu.com" title="Huifu" target="_blank"><img width="165" src="../images/vendor/huifu.com@2x.png" alt="Huifu"></a> <a href="http://www.dodoca.com" title="Dodoca Information Technology" target="_blank"><img width="165" src="../images/vendor/dodoca.com@2x.png" alt="Dodoca Information Technology"></a> <a href="https://bytedance.com" title="ByteDance" target="_blank"><img width="165" src="../images/vendor/bytedance@2x.png" alt="ByteDance"></a> <a href="https://www.flashexpress.com" title="Flash Express" target="_blank"><img width="165" src="../images/vendor/flashexpress.com@2x.png" alt="Flash Express"></a> <a href="http://www.bigbaser.com" title="Big Baser" target="_blank"><img width="165" src="../images/vendor/bigbaser.com@2x.png" alt="Big Baser"></a>

Si votre entreprise ou produit utilise également Excelize, bienvenue <a href="mailto: xuri.me@gmail.com?Subject=Please add our company in Excelize Introduction page&amp;Body=Hello%2C%20this%20is%20%3Cyour%20name%3E%20from%20%3Cyour%20company%20name%3E.%0AWe%20are%20using%20Excelize%20and%20will%20be%20proud%20to%20add%20our%20company%20name%20to%20Excelize%20Introduction%20page.%0APlease%20see%20attachment%20for%20our%20logo.%20%3CBe%20sure%20to%20include%20logo%20in%20attachment%3E%0A" title="envoyer Logo">envoyer Logo</a> à nous.
2 changes: 2 additions & 0 deletions fr/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* [Obtenir les propriétés d'affichage de la feuille de calcul](workbook.md#GetSheetViewOptions)
* [Définir la mise en page de feuille de calcul](workbook.md#SetPageLayout)
* [Obtenir la mise en page de feuille de calcul](workbook.md#GetPageLayout)
* [Définissez les marges de page de feuille de calcul](workbook.md#SetPageMargins)
* [Obtenir les marges des pages de la feuille de calcul](workbook.md#GetPageMargins)
* [Définir l'en-tête et le pied de page](workbook.md#SetHeaderFooter)
* [Définir le nom défini](workbook.md#SetDefinedName)
* [Obtenir le nom défini](workbook.md#GetDefinedName)
Expand Down
102 changes: 98 additions & 4 deletions fr/workbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,104 @@ if err := f.GetPageLayout("Sheet1", &paperSize); err != nil {
fmt.Println("Defaults:")
fmt.Printf("- orientation: %q\n", orientation)
fmt.Printf("- paper size: %d\n", paperSize)
// Output:
// Defaults:
// - orientation: "portrait"
// - paper size: 1
```
Résultat:
```text
Defaults:
- orientation: "portrait"
- paper size: 1
```
## Définissez les marges de page de feuille de calcul {#SetPageMargins}
SetPageMargins fournit une fonction permettant de définir les marges des pages de la feuille de calcul. Options disponibles:
Options|Type
---|---
PageMarginBotom|float64
PageMarginFooter|float64
PageMarginHeader|float64
PageMarginLeft|float64
PageMarginRight|float64
PageMarginTop|float64
- Par exemple, définissez les marges de page de `Sheet1`:
```go
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)
}
```
## Obtenir les marges des pages de la feuille de calcul {#GetPageMargins}
GetPageMargins fournit une fonction pour obtenir les marges des pages de la feuille de calcul. Options disponibles:
Options|Type
---|---
PageMarginBotom|float64
PageMarginFooter|float64
PageMarginHeader|float64
PageMarginLeft|float64
PageMarginRight|float64
PageMarginTop|float64
- Par exemple, obtenez les marges de page de `Sheet1`:
```go
f := excelize.NewFile()
const sheet = "Sheet1"
var (
marginBottom excelize.PageMarginBottom
marginFooter excelize.PageMarginFooter
marginHeader excelize.PageMarginHeader
marginLeft excelize.PageMarginLeft
marginRight excelize.PageMarginRight
marginTop excelize.PageMarginTop
)
if err := f.GetPageMargins(sheet,
&marginBottom,
&marginFooter,
&marginHeader,
&marginLeft,
&marginRight,
&marginTop,
); err != nil {
panic(err)
}
fmt.Println("Defaults:")
fmt.Println("- marginBottom:", marginBottom)
fmt.Println("- marginFooter:", marginFooter)
fmt.Println("- marginHeader:", marginHeader)
fmt.Println("- marginLeft:", marginLeft)
fmt.Println("- marginRight:", marginRight)
fmt.Println("- marginTop:", marginTop)
```
Résultat:
```text
Defaults:
- marginBottom: 0.75
- marginFooter: 0.3
- marginHeader: 0.3
- marginLeft: 0.7
- marginRight: 0.7
- marginTop: 0.75
```
## Définir l'en-tête et le pied de page {#SetHeaderFooter}
Expand Down
Loading

0 comments on commit 30c778e

Please sign in to comment.