-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdemo.bas
44 lines (31 loc) · 1.15 KB
/
demo.bas
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/'
* A simple example of some of the features of the libxlsxwriter library.
*
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org
*
* translated by Lee June by using https://github.com/retsyo/libxlsxwriter_freebasic
'/
#include "auto_xlsxwriter.bi"
function main() as Integer
/' Create a new workbook and add a worksheet. '/
var workbook = workbook_new("demo.xlsx")
var worksheet = workbook_add_worksheet(workbook, NULL)
/' Add a format. '/
var format = workbook_add_format(workbook)
/' Set the bold property for the format '/
format_set_bold(format)
/' Change the column width for clarity. '/
worksheet_set_column(worksheet, 0, 0, 20, NULL)
/' Write some simple text. '/
worksheet_write_string(worksheet, 0, 0, "Hello", NULL)
/' Text with formatting. '/
worksheet_write_string(worksheet, 1, 0, "World", format)
/' Write some numbers. '/
worksheet_write_number(worksheet, 2, 0, 123, NULL)
worksheet_write_number(worksheet, 3, 0, 123.456, NULL)
/' Insert an image. '/
worksheet_insert_image(worksheet, 1, 2, "logo.png")
workbook_close(workbook)
return 0
End Function
main()