-
Notifications
You must be signed in to change notification settings - Fork 4
/
format_font.bas
49 lines (36 loc) · 1.41 KB
/
format_font.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
45
46
47
48
49
/'
* Example of writing some data with font formatting to a simple Excel
* file using libxlsxwriter.
*
* Copyright 2014-2017, John McNamara, [email protected]
*
* translated by Lee June by using https://github.com/retsyo/libxlsxwriter_freebasic
'/
#include "auto_xlsxwriter.bi"
function main() as Integer
/' Create a new workbook. '/
var workbook = workbook_new("format_font.xlsx")
/' Add a worksheet. '/
var worksheet = workbook_add_worksheet(workbook, NULL)
/' Widen the first column to make the text clearer. '/
worksheet_set_column(worksheet, 0, 0, 20, NULL)
/' Add some formats. '/
var format1 = workbook_add_format(workbook)
var format2 = workbook_add_format(workbook)
var format3 = workbook_add_format(workbook)
/' Set the bold property for format 1. '/
format_set_bold(format1)
/' Set the italic property for format 2. '/
format_set_italic(format2)
/' Set the bold and italic properties for format 3. '/
format_set_bold (format3)
format_set_italic(format3)
/' Write some formatted strings. '/
worksheet_write_string(worksheet, 0, 0, "This is bold", format1)
worksheet_write_string(worksheet, 1, 0, "This is italic", format2)
worksheet_write_string(worksheet, 2, 0, "Bold and italic", format3)
/' Close the workbook, save the file and free any memory. '/
workbook_close(workbook)
return 0
End Function
main()