Home » Personal collection » Acorn hard disk » apps » !Style » !MailMerge/CSVFormat
!MailMerge/CSVFormat
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn hard disk » apps » !Style |
Filename: | !MailMerge/CSVFormat |
Read OK: | ✔ |
File size: | 04B8 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
CSV mail merge ============== Tokens : \n forces a new line inside the document if this appears in a field , separates fields such as a,b,c but not if inside quotes eg. "a,b",c,d is taken as 3 fields " used as a delimiter for literals. eg, "The mews, Croydon" is taken as a single string Spaces are coped with in the heading names eg... Title,Author,Publiser,ISBN Number are all valid single field names. They are also coped with in field names eg... Sorting and Searching\n,Dr D. Knuth,Addison Wesley which is valid Each record begins on a new line. Data := <Record> <CR> [<Data>] Record := <Field#> [,<Record>] Field# := "[<String>][,][<String>]" | <String> <String> := {<Char>} <Char> := ASCII 32..127 <CR> := ASCII 10 | ASCII 13 The number of fields on a line depend on the number of headings. If there are n headings then the first n fields will be taken as heading matches. eg the CSV file of - Title,Author,Publisher ,,,,,, Sorting and Searching,,Addison Wesley would put nothing in the first record and miss out the author from the second. Once all headings have been filled with strings or nulls, the rest of the line will be ignored.
00000000 43 53 56 20 6d 61 69 6c 20 6d 65 72 67 65 0a 3d |CSV mail merge.=| 00000010 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 54 |=============..T| 00000020 6f 6b 65 6e 73 20 3a 0a 0a 5c 6e 20 20 20 20 20 |okens :..\n | 00000030 66 6f 72 63 65 73 20 61 20 6e 65 77 20 6c 69 6e |forces a new lin| 00000040 65 20 69 6e 73 69 64 65 20 74 68 65 20 64 6f 63 |e inside the doc| 00000050 75 6d 65 6e 74 20 69 66 20 74 68 69 73 20 61 70 |ument if this ap| 00000060 70 65 61 72 73 20 69 6e 20 61 20 66 69 65 6c 64 |pears in a field| 00000070 0a 2c 20 20 20 20 20 20 73 65 70 61 72 61 74 65 |., separate| 00000080 73 20 66 69 65 6c 64 73 20 73 75 63 68 20 61 73 |s fields such as| 00000090 20 61 2c 62 2c 63 20 62 75 74 20 6e 6f 74 20 69 | a,b,c but not i| 000000a0 66 20 69 6e 73 69 64 65 20 71 75 6f 74 65 73 0a |f inside quotes.| 000000b0 20 20 20 20 20 20 20 65 67 2e 20 22 61 2c 62 22 | eg. "a,b"| 000000c0 2c 63 2c 64 20 69 73 20 74 61 6b 65 6e 20 61 73 |,c,d is taken as| 000000d0 20 33 20 66 69 65 6c 64 73 0a 22 20 20 20 20 20 | 3 fields." | 000000e0 20 75 73 65 64 20 61 73 20 61 20 64 65 6c 69 6d | used as a delim| 000000f0 69 74 65 72 20 66 6f 72 20 6c 69 74 65 72 61 6c |iter for literal| 00000100 73 2e 20 65 67 2c 20 22 54 68 65 20 6d 65 77 73 |s. eg, "The mews| 00000110 2c 20 43 72 6f 79 64 6f 6e 22 20 69 73 20 74 61 |, Croydon" is ta| 00000120 6b 65 6e 20 61 73 0a 20 20 20 20 20 20 20 61 20 |ken as. a | 00000130 73 69 6e 67 6c 65 20 73 74 72 69 6e 67 0a 0a 53 |single string..S| 00000140 70 61 63 65 73 20 61 72 65 20 63 6f 70 65 64 20 |paces are coped | 00000150 77 69 74 68 20 69 6e 20 74 68 65 20 68 65 61 64 |with in the head| 00000160 69 6e 67 20 6e 61 6d 65 73 20 65 67 2e 2e 2e 0a |ing names eg....| 00000170 0a 20 54 69 74 6c 65 2c 41 75 74 68 6f 72 2c 50 |. Title,Author,P| 00000180 75 62 6c 69 73 65 72 2c 49 53 42 4e 20 4e 75 6d |ubliser,ISBN Num| 00000190 62 65 72 0a 0a 61 72 65 20 61 6c 6c 20 76 61 6c |ber..are all val| 000001a0 69 64 20 73 69 6e 67 6c 65 20 66 69 65 6c 64 20 |id single field | 000001b0 6e 61 6d 65 73 2e 0a 54 68 65 79 20 61 72 65 20 |names..They are | 000001c0 61 6c 73 6f 20 63 6f 70 65 64 20 77 69 74 68 20 |also coped with | 000001d0 69 6e 20 66 69 65 6c 64 20 6e 61 6d 65 73 20 65 |in field names e| 000001e0 67 2e 2e 2e 0a 0a 20 53 6f 72 74 69 6e 67 20 61 |g..... Sorting a| 000001f0 6e 64 20 53 65 61 72 63 68 69 6e 67 5c 6e 2c 44 |nd Searching\n,D| 00000200 72 20 44 2e 20 4b 6e 75 74 68 2c 41 64 64 69 73 |r D. Knuth,Addis| 00000210 6f 6e 20 57 65 73 6c 65 79 0a 0a 77 68 69 63 68 |on Wesley..which| 00000220 20 69 73 20 76 61 6c 69 64 0a 45 61 63 68 20 72 | is valid.Each r| 00000230 65 63 6f 72 64 20 62 65 67 69 6e 73 20 6f 6e 20 |ecord begins on | 00000240 61 20 6e 65 77 20 6c 69 6e 65 2e 0a 0a 20 44 61 |a new line... Da| 00000250 74 61 20 20 20 20 20 3a 3d 20 3c 52 65 63 6f 72 |ta := <Recor| 00000260 64 3e 20 3c 43 52 3e 20 5b 3c 44 61 74 61 3e 5d |d> <CR> [<Data>]| 00000270 0a 20 52 65 63 6f 72 64 20 20 20 3a 3d 20 3c 46 |. Record := <F| 00000280 69 65 6c 64 23 3e 20 5b 2c 3c 52 65 63 6f 72 64 |ield#> [,<Record| 00000290 3e 5d 0a 20 46 69 65 6c 64 23 20 20 20 3a 3d 20 |>]. Field# := | 000002a0 22 5b 3c 53 74 72 69 6e 67 3e 5d 5b 2c 5d 5b 3c |"[<String>][,][<| 000002b0 53 74 72 69 6e 67 3e 5d 22 20 7c 20 3c 53 74 72 |String>]" | <Str| 000002c0 69 6e 67 3e 0a 20 3c 53 74 72 69 6e 67 3e 20 3a |ing>. <String> :| 000002d0 3d 20 7b 3c 43 68 61 72 3e 7d 0a 20 3c 43 68 61 |= {<Char>}. <Cha| 000002e0 72 3e 20 20 20 3a 3d 20 41 53 43 49 49 20 33 32 |r> := ASCII 32| 000002f0 2e 2e 31 32 37 0a 20 3c 43 52 3e 20 20 20 20 20 |..127. <CR> | 00000300 3a 3d 20 41 53 43 49 49 20 31 30 20 7c 20 41 53 |:= ASCII 10 | AS| 00000310 43 49 49 20 31 33 0a 0a 54 68 65 20 6e 75 6d 62 |CII 13..The numb| 00000320 65 72 20 6f 66 20 66 69 65 6c 64 73 20 6f 6e 20 |er of fields on | 00000330 61 20 6c 69 6e 65 20 64 65 70 65 6e 64 20 6f 6e |a line depend on| 00000340 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 68 | the number of h| 00000350 65 61 64 69 6e 67 73 2e 20 49 66 20 74 68 65 72 |eadings. If ther| 00000360 65 20 61 72 65 0a 6e 20 68 65 61 64 69 6e 67 73 |e are.n headings| 00000370 20 74 68 65 6e 20 74 68 65 20 66 69 72 73 74 20 | then the first | 00000380 6e 20 66 69 65 6c 64 73 20 77 69 6c 6c 20 62 65 |n fields will be| 00000390 20 74 61 6b 65 6e 20 61 73 20 68 65 61 64 69 6e | taken as headin| 000003a0 67 20 6d 61 74 63 68 65 73 2e 20 65 67 20 74 68 |g matches. eg th| 000003b0 65 0a 43 53 56 20 66 69 6c 65 20 6f 66 20 2d 0a |e.CSV file of -.| 000003c0 0a 54 69 74 6c 65 2c 41 75 74 68 6f 72 2c 50 75 |.Title,Author,Pu| 000003d0 62 6c 69 73 68 65 72 0a 2c 2c 2c 2c 2c 2c 0a 53 |blisher.,,,,,,.S| 000003e0 6f 72 74 69 6e 67 20 61 6e 64 20 53 65 61 72 63 |orting and Searc| 000003f0 68 69 6e 67 2c 2c 41 64 64 69 73 6f 6e 20 57 65 |hing,,Addison We| 00000400 73 6c 65 79 0a 0a 77 6f 75 6c 64 20 70 75 74 20 |sley..would put | 00000410 6e 6f 74 68 69 6e 67 20 69 6e 20 74 68 65 20 66 |nothing in the f| 00000420 69 72 73 74 20 72 65 63 6f 72 64 20 61 6e 64 20 |irst record and | 00000430 6d 69 73 73 20 6f 75 74 20 74 68 65 20 61 75 74 |miss out the aut| 00000440 68 6f 72 20 66 72 6f 6d 20 74 68 65 20 73 65 63 |hor from the sec| 00000450 6f 6e 64 2e 0a 4f 6e 63 65 20 61 6c 6c 20 68 65 |ond..Once all he| 00000460 61 64 69 6e 67 73 20 68 61 76 65 20 62 65 65 6e |adings have been| 00000470 20 66 69 6c 6c 65 64 20 77 69 74 68 20 73 74 72 | filled with str| 00000480 69 6e 67 73 20 6f 72 20 6e 75 6c 6c 73 2c 20 74 |ings or nulls, t| 00000490 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 6c |he rest of the l| 000004a0 69 6e 65 0a 77 69 6c 6c 20 62 65 20 69 67 6e 6f |ine.will be igno| 000004b0 72 65 64 2e 0a 0a 0a 0a |red.....| 000004b8