-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhide_row_col.bas
46 lines (35 loc) · 1.41 KB
/
hide_row_col.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
/'
* An example of how to hide rows and columns using the libxlsxwriter
* library.
*
* In order to hide rows without setting each one, (of approximately 1 million
* rows), Excel uses an optimization to hide all rows that don't have data.
*
* 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 and add a worksheet. '/
var workbook = workbook_new("hide_row_col.xlsx")
var worksheet = workbook_add_worksheet(workbook, NULL)
Dim As lxw_row_t row
/' Write some data. '/
worksheet_write_string(worksheet, 0, 3, "Some hidden columns.", NULL)
worksheet_write_string(worksheet, 7, 0, "Some hidden rows.", NULL)
/' Hide all rows without data. '/
worksheet_set_default_row(worksheet, 15, LXW_TRUE)
/' Set the height of empty rows that we do want to display even if it is '/
/' the default height. '/
for row = 1 to 5
worksheet_set_row(worksheet, row, 15, NULL)
next
/' Columns can be hidden explicitly. This doesn't increase the file size. '/
Dim As lxw_row_col_options options
options.hidden = 1
worksheet_set_column_opt(worksheet, COLS("G:XFD"), 8.43, NULL, @options)
workbook_close(workbook)
return 0
End Function
main()