Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Header and Footer images #331

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.idea
node_modules
distribution
.DS_Store
npm-debug.log
Excel.xlsx
Expand All @@ -13,4 +12,7 @@ tmp
references
coverage
.nyc_output
package-lock.json
package-lock.json
testzip
testzip/*
*.xlsx
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,46 @@ Full Worksheet options. All options are optional.

**Note:** headerFooter strings accept [Dynamic Formatting Strings](https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/extensions/XSSFHeaderFooter.html). i.e. '&L&A&C&BCompany, Inc. Confidential&B&RPage &P of &N'

### **Header and Footer Images**
To use header and footer images place the graphics dynamic string in the desired section of your header and footer &G. Then call the addHeaderFooterImage passing the image and type 'picture' and the position as one of 'LF', 'CF', 'RF', 'LH', 'CH', 'RH'. The followingg code adds four images to the worksheet in all the footers and at the center of the header. The scale factor specifies how much the images is scaled.

```
var ws = wb.addWorksheet("Sheet1", {
pageSetup: {
fitToWidth: 1,
paperSize: 'A4_PAPER',
orientation: 'landscape'
},
headerFooter: {
oddHeader: '&L&G &C&G &R&G',
oddFooter: '&L&G &C&G &R&G'
},
printOptions: { centerHorizontal: true },
sheetView: { rightToLeft: true }
});

ws.cell(1,1).string('Mohanad says hi');

ws.addHeaderFooterImage({
image: fs.readFileSync(path.resolve(__dirname, './sampleFiles/logo copy.png')),
type: 'picture'
}, 'LF')
ws.addHeaderFooterImage({
image: fs.readFileSync(path.resolve(__dirname, './sampleFiles/logo copy.png')),
type: 'picture'
}, 'CF')
ws.addHeaderFooterImage({
image: fs.readFileSync(path.resolve(__dirname, './sampleFiles/signatures2.png')),
type: 'picture',
scale: 0.05
}, 'RF')
ws.addHeaderFooterImage({
image: fs.readFileSync(path.resolve(__dirname, './sampleFiles/signatures2.png')),
type: 'picture',
scale: 0.23
}, 'CH')
```

#### Methods

##### Worksheet data validations
Expand Down
40 changes: 40 additions & 0 deletions distribution/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions distribution/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 101 additions & 0 deletions distribution/lib/cell/cell.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions distribution/lib/cell/cell.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading