How do you import a multi-line address into a single cell of an Excel spreadsheet from a Natural program?
If you want to use a CSV-file:
define data local
01 #line1 (A10) init <'text1'>
01 #line2 (A10) init <'text2'>
01 #line3 (A10) init <'text3'>
end-define
*
define work file 1 'c:\tmp\Sheet01.csv' type 'ascii'
*
write work file 1
H'22' /* double quotes = Start of Cell
#line1
H'0A' /* Linebreak within a Cell
#line2
H'0A' /* Linebreak within a Cell
#line3
H'22' /* double quotes = End of Cell
';' /* Cell delimiter
'nextcell' /* content of Next Cell
*
close work file 1
*
end
- More flexible with NAT 6.2:
DEFINE DATA LOCAL
1 CELL_1 (A) DYNAMIC
1 CELL_2 (A) DYNAMIC
1 CELL_3 (A) DYNAMIC
END-DEFINE
*
DEFINE WORK FILE 1 'c:\my_62.csv' TYPE 'CSV' ATTRIBUTES 'NOAPPEND'
*
COMPRESS 'one line' INTO CELL_1
COMPRESS 'two lines:' '2nd one' INTO CELL_2 WITH DELIMITER H'0A'
COMPRESS 'three lines:' '2nd one' '3rd one' INTO CELL_3 WITH DELIMITER H'0A'
WRITE WORK 1 VARIABLE CELL_1 CELL_2 CELL_3
CLOSE WORK 1
*
END