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) and the merge source (filename) as
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 is only
58 column headers from our original <app>gnumeric</app> spreadsheet
59 and would simply waste our first label. We also unselect the second record
60 which is empty (an artifact of our original spreadsheet). We could also unselect
61 any other records that we didn't want to print a label for.</p>
63 <p>We can also view each record in more detail by clicking on the appropriate
64 expander (the little triangles) as shown. Once we are satisfied with the
65 selections in this dialog we click <gui>OK</gui> to accept the
68 <p>Now we start adding objects to our <app>glabels</app> document as shown.</p>
70 <!-- ==== Figure ==== -->
71 <media type="image" src="figures/merge-ex2-2.png" mime="image/png" style="right">
74 <!-- ==== End of Figure ==== -->
76 <p>In this example we have a single text object. This text object contains
77 all of our merge fields organized on multiple lines as a mailing address.
78 Notice that fields ${4} and ${5} (corresponding to ADDR1 and ADDR2) are each
79 located with no other text on their own lines. When
80 <app>glabels</app> encounters a field as the only text on
81 a line, it will not expand the line if the field is empty.</p>
83 <p>Now we can print our address labels by selecting the
84 <guiseq> <gui>File</gui>
85 <gui>Print</gui> </guiseq> menu item. This will display
86 print dialog as shown below.</p>
88 <!-- ==== Figure ==== -->
89 <media type="image" src="figures/merge-ex2-3.png" mime="image/png" style="right">
90 <p>Printing address labels</p>
92 <!-- ==== End of Figure ==== -->
94 <p>Just to make sure our labels are going to look okay, we select the
95 <gui>Print outlines</gui> option and click
96 <gui>Print Preview</gui>. This will display a print preview dialog
99 <!-- ==== Figure ==== -->
100 <media type="image" src="figures/merge-ex2-4.png" mime="image/png" style="right">
101 <p>Address labels preview</p>
103 <!-- ==== End of Figure ==== -->
105 <p>Everything looks good, so we can now load up our printer with
106 the appropriate label stock, print our address labels and start mailing
107 our party invitations.</p>