Developer's reference PB2XLS for PowerBuilder

Reference > Examples > example07

Example07

yn_xls_workbook book
n_xls_worksheet sheet1
n_xls_format format1
n_xls_format format2
n_xls_format format3

//for Excel97:
book = create n_xls_workbook_v97

//for Excel5:
//book = create n_xls_workbook_v5

book.of_create("example07.xls")

sheet1 = book.of_add_worksheet('sheet 1')
format1 = book.of_add_format()
format1.of_set_color ( 'red' )
format1.of_set_bold ( true )
sheet1.of_write(0, 0, 'HELLO', format1)

format2 = book.of_add_format()
format2.of_set_color ( 'blue' )
format2.of_set_italic ( true )
format2.of_set_num_format ( '#,##0.00' )
sheet1.of_write(1, 0, 25456.4567, format2)

format3 = book.of_add_format()
format3.of_set_num_format ( 'dd.mm.yyyy hh:mm:ss' )
sheet1.of_write(2, 0, datetime(today(),now()), format3)

book.of_close()

Screenshot