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