-
-
Notifications
You must be signed in to change notification settings - Fork 383
Expand file tree
/
Copy pathwatermark.c
More file actions
26 lines (19 loc) · 814 Bytes
/
Copy pathwatermark.c
File metadata and controls
26 lines (19 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
* An example of adding a worksheet watermark image using libxlsxwriter. This
* is based on the method of putting an image in the worksheet header as
* suggested in the Microsoft documentation:
* https://support.microsoft.com/en-us/office/add-a-watermark-in-excel-a372182a-d733-484e-825c-18ddf3edf009
*
* Copyright 2014-2026, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("watermark.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
/* Set a worksheet header with the watermark image. */
lxw_header_footer_options header_options = {.image_center = "watermark.png"};
worksheet_set_header_opt(worksheet, "&C&[Picture]", &header_options);
workbook_close(workbook);
return 0;
}