1 <?xml version="1.0" encoding="utf-8"?>
2 <page xmlns="http://projectmallard.org/1.0/" xmlns:e="http://projectmallard.org/experimental/" type="guide" id="merge-ex2" xml:lang="nl">
5 <link type="guide" xref="merge#merge-ex"/>
6 <revision pkgversion="3.0" version="0.1" date="2010-05-04" status="incomplete"/>
8 Create address labels from a CSV file.
10 <credit type="author">
11 <name>Jim Evins</name>
12 <email>evins@snaught.com</email>
14 <credit type="author">
15 <name>Mario Blättermann</name>
16 <email>mariobl@gnome.org</email>
19 <p>Creative Commons Share Alike 3.0</p>
23 <title>Example 2: Address labels</title>
25 <p>In this example we are going to throw a party and need to print mailing
26 address labels for our invitations. We have a list of our closest friends
27 that we created in <app>gnumeric</app> and exported as the
28 following CSV file. It should be noted that not everyone has a middle initial or
29 a two line address.</p>
32 LAST,FIRST,MI,ADDR1,ADDR2,CITY,STATE,ZIP
34 Critter,Ess,S,"123 Faux St.",,Alexandria,VA,22310
35 Doe,John,,"Apt 1X","451 Mystery St.",Trenton,NJ,08601
36 Summers,Joyce,,"1630 Revello Dr",,Sunnydale,CA,95037
37 McGarret,Steve,O,"404 Piikoi Street",,Honolulu,HI,96813
38 Kramer,Cosmo,,"Apt 5B","129 W. 81 St.","New York",NY,10024-7207
41 <p>In <app>glabels</app> we have created a new <app>glabels</app>
42 document using the Avery 5512 "Address Labels" template. Next we use the
43 <guiseq> <gui>Objects</gui>
44 <gui>Merge Properties</gui> </guiseq> menu item to display
45 the <gui>merge properties</gui> dialog. We use this dialog to
46 select the source type (in our case CSV with keys on line 1) and the merge
47 source (filename) as shown.</p>
49 <!-- ==== Figure ==== -->
50 <media type="image" src="figures/merge-ex2-1.png" mime="image/png" style="right">
51 <p>Merge properties dialog</p>
53 <!-- ==== End of Figure ==== -->
55 <p>Before applying the merge source, we uncheck the first record since it only
56 contains empty fields. It is an artifact of our original <app>gnumeric</app> spreadsheet
57 and would simply waste our first label. We could also unselect
58 any other records that we didn't want to print a label for.</p>
60 <p>We can also view each record in more detail by clicking on the appropriate
61 expander (the little triangles) as shown. Once we are satisfied with the
62 selections in this dialog we click <gui>OK</gui> to accept the
65 <p>Now we start adding objects to our <app>glabels</app> document as shown.</p>
67 <!-- ==== Figure ==== -->
68 <media type="image" src="figures/merge-ex2-2.png" mime="image/png" style="right">
71 <!-- ==== End of Figure ==== -->
73 <p>In this example we have a single text object. This text object contains
74 all of our merge fields organized on multiple lines as a mailing address.
75 Notice that fields ${ADDR1} and ${ADDR2} are each
76 located with no other text on their own lines. When
77 <app>glabels</app> encounters a field as the only text on
78 a line, it will not expand the line if the field is empty.</p>
80 <p>Now we can print our address labels by selecting the
81 <guiseq> <gui>File</gui>
82 <gui>Print</gui> </guiseq> menu item. This will display
83 print dialog as shown below.</p>
85 <!-- ==== Figure ==== -->
86 <media type="image" src="figures/merge-ex2-3.png" mime="image/png" style="right">
87 <p>Printing address labels</p>
89 <!-- ==== End of Figure ==== -->
91 <p>Just to make sure our labels are going to look okay, we select the
92 <gui>Print outlines</gui> option and click
93 <gui>Print Preview</gui>. This will display a print preview dialog
96 <!-- ==== Figure ==== -->
97 <media type="image" src="figures/merge-ex2-4.png" mime="image/png" style="right">
98 <p>Address labels preview</p>
100 <!-- ==== End of Figure ==== -->
102 <p>Everything looks good, so we can now load up our printer with
103 the appropriate label stock, print our address labels and start mailing
104 our party invitations.</p>