Table of Contents
Manage document headers and footers.
2. Subcommands
| Subcommand | Description |
|---|---|
|
List all headers and footers |
|
Add a header to the document |
|
Add a footer to the document |
|
Remove headers or footers by type |
3. Options
4. Examples
List headers and footers:
uniword headers list document.docx
uniword headers list document.docx --json
Add headers:
uniword headers add-header document.docx "Confidential" -o out.docx
uniword headers add-header document.docx "Title" --type first -o out.docx
Add footers:
uniword headers add-footer document.docx "Page 1" -o out.docx
Remove:
uniword headers remove document.docx --what headers --type default -o out.docx
uniword headers remove document.docx --what all -o out.docx
5. Ruby API
doc = Uniword.load("document.docx")
# List
headers = doc.list_headers
footers = doc.list_footers
# Add
doc.add_header("Confidential", type: "default")
.add_footer("Page 1")
.save("output.docx")
# Remove
doc.remove_headers(type: "first")
.remove_footers(type: "default")
.save("output.docx")