home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / ventura / vpapp_7.arc / VPAPP_7.TXT < prev    next >
Text File  |  1989-10-16  |  33KB  |  780 lines

  1. @BANNER = Ventura Publisher<M^><190><D>
  2.  
  3. @APP NOTE = Application Note #7
  4.  
  5. @NAME = Subjects:    Database Publishing<R>
  6.     Lotus 1-2-3<R>
  7.     dBase III
  8.  
  9. Database publishing is the process of extracting information from 
  10. a database or spreadsheet and automatically formatting it into a typeset 
  11. document. Database publishing represents the largest single category 
  12. of typeset documents. These documents include:<R>
  13.  
  14.  
  15. @BULLET 1 = Directory listings (e.g., phone books, membership directories, 
  16. etc.)
  17.  
  18. @BULLET 1 = Tables (e.g., census, almanac, government statistics, 
  19. etc.)
  20.  
  21. @BULLET 1 = Catalogs
  22.  
  23. @BULLET 1 = Parts lists
  24.  
  25. @BULLET 1 = Financial statements<R>
  26.  
  27.  
  28. All of these documents are typeset, and all currently require extensive 
  29. labor to produce because of the number of steps involved and lack 
  30. of automation in the page layout process.
  31.  
  32. One of Ventura Publisher's greatest strengths is that decisions on 
  33. where text and pictures should be placed is made by the software rather 
  34. than by the operator. Features like widow and orphan control, keep 
  35. this paragraph with the next paragraph, break controls, shift text 
  36. in from left/right margins, and in/out alignment, anchored frames, 
  37. automatic headers & footers, ruling lines attached to text <197> to 
  38. name a few <197> automatically place the text and pictures in the 
  39. correct locations without the operator needing to create the document 
  40. by hand. The document in many cases can be completely formatted through 
  41. codes placed in the text. When using a database or spreadsheet, these 
  42. codes can be generated directly by the database program or spreadsheet 
  43. macro. The purpose of this application note is to describe techniques 
  44. that you can use to produce the kinds of documents mentioned above 
  45. when using dBase III Plus <197> the most common database <197> and 
  46. Lotus 1-2-3, the leading spreadsheet.
  47.  
  48. @HEAD 1 = Steps<197><R>
  49. Summary
  50.  
  51. Most database publishing consists of the following steps:<R>
  52.  
  53.  
  54. @BULLET 1 = Enter information into a database or spreadsheet.
  55.  
  56. @BULLET 1 = Create a Ventura Publisher style sheet which translates 
  57. the tags into both format and placement information.
  58.  
  59. @BULLET 1 = Create a Ventura Publisher chapter to act as a template 
  60. for the database text.
  61.  
  62. @BULLET 1 = Write a database program, spreadsheet macro, or custom 
  63. code to extract the desired records, add Ventura Publisher tags and 
  64. formatting codes, create an ASCII text file, and place this text file 
  65. into a Ventura Publisher chapter file.<R>
  66.  
  67.  
  68. Once these steps have been performed you can publish the database 
  69. automatically at any time. Simply run the database program or spreadsheet 
  70. macro, run Ventura Publisher, and print the document. You don't need 
  71. to do anything within Ventura Publisher once this is set up.
  72.  
  73. @HEAD 2 = Style sheet:<R>
  74. The key to it all
  75.  
  76. The key to making database publishing simple is to create a style 
  77. sheet which contains tags that will format the text automatically. 
  78. If these tags are created correctly, you need to write very little 
  79. database or spreadsheet code in order to completely automate the creation 
  80. of your documents. The most important options in Ventura Publisher 
  81. which make this automation possible are:<R>
  82.  
  83.  
  84. @BULLET 1 = Paragraph Alignment
  85.  
  86. @BULLET 1 = Paragraph Spacing
  87.  
  88. @BULLET 1 = Paragraph Breaks
  89.  
  90. @BULLET 1 = Paragraph Tab Settings<R>
  91.  
  92.  
  93. As you design each tag, you use the Alignment, Spacing, and Breaks 
  94. options to place text vertically and horizontally with respect to 
  95. the surrounding paragraphs and margins. Use the Tab Settings option 
  96. to add leaders to the text, even when tab characters have not been 
  97. inserted. With simple database publishing, once the style sheet is 
  98. designed, most of the work has been done.
  99.  
  100. @HEAD 2 = Three style sheet strategies
  101.  
  102. The way in which you design the style sheet depends on what strategy 
  103. you plan to use to format the database or spreadsheet information. 
  104. While you can probably think of lots of ways to use Ventura Publisher's 
  105. capabilities to automatically format text, this application note covers 
  106. three general strategies:
  107.  
  108. 1.<~>Put each field in a separate paragraph and then use the Paragraph 
  109. menu's <B>Break<D>, <B>Spacing<D>, and <B>Alignment<D> options to 
  110. position each paragraph horizontally and vertically on the page.
  111.  
  112. 2.<~>Put all fields in one paragraph, but separate them with tab characters.
  113.  
  114. 3.<~>Separate each field with a comma followed by a space in order 
  115. to automatically generate a table which can be read by Ventura Publisher's 
  116. Professional Extension.
  117.  
  118. The first technique has the following advantages:
  119.  
  120. @BULLET 1 = Lets you easily change the design of your document without 
  121. changing your database program.
  122.  
  123. @BULLET 1 = Lets you create fields which are more than one line long.
  124.  
  125. @BULLET 1 = Lets you automatically extract fields into a header or 
  126. footer (useful for directory headings).
  127.  
  128. @BULLET 1 = Lets you insert footnote information, which Ventura Publisher 
  129. will then extract and place on the correct page.
  130.  
  131. @BULLET 1 = Lets you automatically generate numbers and special effects 
  132. such as bullets or first big character.
  133.  
  134. The disadvantages to this technique are:
  135.  
  136. @BULLET 1 = It results in a lot of paragraphs. This slows the loading 
  137. of each chapter since Ventura Publisher takes a fixed amount of time 
  138. to load each paragraph, even if it is only one character long. Also, 
  139. Ventura Publisher can only handle a maximum of 64,000 paragraphs per 
  140. chapter, even with the Professional Extension.
  141.  
  142. @BULLET 1 = The text is not easily understood or used by another program. 
  143. By contrast, when you use the second strategy (tabs between fields), 
  144. the text is easily read and edited with any word processor.
  145.  
  146. The second technique has the following advantages:
  147.  
  148. @BULLET 1 = It is easy to understand because it is exactly the way 
  149. you would extract text for use in a word processor.
  150.  
  151. @BULLET 1 = It results in fewer paragraphs, especially if you put 
  152. line breaks between most records instead of a carriage<196>return<197>line<196>feed 
  153. combination (i.e., a new paragraph). This in turn lets you create 
  154. truly monstrous chapters.
  155.  
  156. The disadvantages of this strategy include:
  157.  
  158. @BULLET 1 = Without the Professional Extension, you can easily exceed 
  159. the number of <B>line elements<D> per frame (see Appendix J in your 
  160. Reference Guide for an explanation), because each tab consumes two 
  161. line elements.
  162.  
  163. @BULLET 1 = Each record must be only one line.
  164.  
  165. The final approach provides by far the most flexibility and is the 
  166. best general approach if you own the Professional Extension. With 
  167. the tables feature you get almost all the advantages of either of 
  168. the first two approaches plus:
  169.  
  170. @BULLET 1 = You can easily put pictures into a cell in the table.
  171.  
  172. @BULLET 1 = You can easily rotate text within a cell.
  173.  
  174. @BULLET 1 = The table ruling lines can easily be controlled
  175.  
  176. @BULLET 1 = Tints can be easily placed within any cell in the table.
  177.  
  178. Although the Professional Extension tables provides the best all around 
  179. approach, it does suffer from a few disadvantages:
  180.  
  181. @BULLET 1 = You must convert comma spaces within fields to comma comma 
  182. space. Otherwise a comma followed by a space <MI>within<D> the field 
  183. of the database will cause Ventura Publisher to recognize the information 
  184. following the comma space as a new field.
  185.  
  186. @BULLET 1 = Cannot extract headers or insert footnotes into a table.
  187.  
  188. @BULLET 1 = Requires custom code and in general more work to set up 
  189. than the first two approaches.
  190.  
  191. @HEAD 1 = Chapter template
  192.  
  193. The examples which follow illustrate how to generate a single document 
  194. from your database. However, suppose you want to generate another 
  195. identical document, but with different data? For instance, each month 
  196. you might need to create a revised membership directory. Once you 
  197. have created a chapter which contains appropriate formatting information, 
  198. page number, headers, footers, etc., you don't want to spend time 
  199. in Ventura Publisher each month recreating this information. Fortunately, 
  200. with any of the approaches outlined in the application note, you never 
  201. need to recreate a chapter. All you do is to let your database or 
  202. spreadsheet program write this month's text <MI>to the same file name 
  203. as you used for last month's issue.<D> When you open the old chapter, 
  204. it still points to the same text file name, but this file now contains 
  205. <MI>this month's<D> information. Since Ventura Publisher generates 
  206. headers, footers, page number, section numbering, etc. at the time 
  207. that it loads the chapter, rather than saving it with the chapter 
  208. file, all of these things are automatically updated to reflect the 
  209. new database information. The number of pages will be increased or 
  210. decreased as necessary to fit the latest version.
  211.  
  212. To create and use a chapter template, follow these steps:<R>
  213.  
  214.  
  215. @BULLET 1 = Create a text file using one of the techniques described 
  216. in this application note.
  217.  
  218. @BULLET 1 = Load this text file using the <B>Load Text/Picture<D> 
  219. option (file menu). Place the text onto the page (rather than into 
  220. a frame that you draw).
  221.  
  222. @BULLET 1 = Use all the features in Ventura Publisher to create your 
  223. document.
  224.  
  225. @BULLET 1 = Save the chapter using the <B>Save As<D> option in the 
  226. File menu.
  227.  
  228. @BULLET 1 = Quit from Ventura Publisher.
  229.  
  230. @BULLET 1 = At some later time when you want to create a new chapter 
  231. using the updated information in your database, simply run your database 
  232. program or spreadsheet macro again and save the resulting text <MI>into 
  233. the same file name as before.<D>
  234.  
  235. @BULLET 1 = Run Ventura Publisher and Open the chapter that you saved 
  236. before.
  237.  
  238. @HEAD 1 = dBase III Examples
  239.  
  240. Rather than describe the three strategies and the chapter template 
  241. concept any further, this application note will provide a series of 
  242. examples from which you can learn the necessary techniques. Each example 
  243. is available on the diskette which accompanies this application note. 
  244. For the database examples, simply copy all the files in the dBase 
  245. directory on the diskette to the dBase subdirectory on your computer, 
  246. run dBase, and then type <B>DO EXAMP?<D> where <B>?<D> is replaced 
  247. by the example number. Then quit from dBase, run Ventura Publisher, 
  248. and load the corresponding chapter. For example, if you type <B>DO 
  249. EXAMP2<D> within dBase, then you would open the chapter called <B>EXAMP2.CHP<D>.
  250.  
  251. @HEAD 2 = Directory List
  252.  
  253. Probably the simplest type of publishing is the directory list. This 
  254. list usually includes at least three fields from the database or spreadsheet:
  255.  
  256. @BULLET 1 = Last name
  257.  
  258. @BULLET 1 = First name
  259.  
  260. @BULLET 1 = Phone number
  261.  
  262. It may also include address and other information. By using a database's 
  263. report generator, you can extract the information you want and simultaneously 
  264. add Ventura Publisher tags. Ventura Publisher then takes this tagged 
  265. text and automatically creates the phone list. Using the first strategy, 
  266. each last name field is tagged as a separate paragraph, each first 
  267. name field as another paragraph, and the phone number as a third paragraph. 
  268. Each field is tagged with its own unique tag. The illustrations show 
  269. the steps, along with how to accomplish the same thing with strategy 
  270. two (tabs between fields.
  271.  
  272. The following is a listing of the important information for each tag 
  273. for strategy one. The important tag settings are highlighted.
  274.  
  275. @Z_TBL_BEG = COLUMNS(3), DIMENSION(IN), COLWIDTHS(1.10,3.71,E1), ABOVE(.167), 
  276. BELOW(.167), VJTOP(.167), VJBOT(.167), HGUTTER(.083), VGUTTER(.083), 
  277. BOX(Z_DOUBLE), HGRID(Z_SINGLE), VGRID(Z_SINGLE), KEEP(OFF)
  278.  
  279. @Z_TBL_HEAD = TABLE 2, TABLE 2, TABLE 2
  280.  
  281. <B>Command<D><$!B11>, <B>Use<D><$!B11>, <B>Example<D><$!B11>
  282.  
  283. @Z_TBL_BODY = TABLE 2, TABLE 2, TABLE 2
  284.  
  285. @@Z_TBL_BEG = , Place at the beginning of a table,  @Z_TBL_BEG = 
  286.  
  287. COLUMNS( ), Defines the number of columns in the table, COLUMNS(4)
  288.  
  289. DIMENSION( ),  Defines the dimensions used for the parameters which 
  290. follow. <B>IN specifies inches; PT specifies points; CM<D> specifies 
  291. centimeters;<B> PI<D> specifies picas. You can locally override the 
  292. global setting by placing these parameters directly after the parameter, 
  293. DIMENSION(IN)
  294.  
  295. COLWIDTHS(W1,, W2,, ... WN), Defines the width of each cell within 
  296. the table. <B>E specifies variable width., COLWIDTHS(.67,2.97,E1),<D>
  297.  
  298. WIDTH( ), Optional parameter. Width of column if <B>Custom is specified., 
  299. WIDTH(5.00)<D>
  300.  
  301. INDENT( ), Optional parameter. Indent from left column if custom width 
  302. is less than current column width., INDENT(1.00)
  303.  
  304. ABOVE( ), Optional parameter. Space above the table., ABOVE(.049)
  305.  
  306. BELOW( ), Optional parameter. Space below the table., BELOW(.017)
  307.  
  308. VJTOP( ), Optional parameter. Vertical justification above the table., 
  309. VJTOP(.015)
  310.  
  311. VJBOT( ), Optional parameter. Vertical justification below the table., 
  312. VJBOT(.031)
  313.  
  314. HGUTTER( ), Optional parameter. Space between columns., HGUTTER(.032)
  315.  
  316. VGUTTER( ), Optional parameter. Space between rows., VGUTTER(.059)
  317.  
  318. BOX( ), Optional parameter. Tag to be used for ruling lines around., 
  319. BOX( Z_DOUBLE)
  320.  
  321. HGRID( ), Optional parameter. Tag to be used for ruling lines between 
  322. rows., HGRID(Z_SINGLE)
  323.  
  324. VGRID( ), Optional parameter. Tag to be used for ruling lines between 
  325. columns., VGRID(Z_SINGLE)
  326.  
  327. KEEP( ), Breaks are allowed (OFF) or not allowed (ON)., KEEP(OFF)
  328.  
  329. RULE(Tag Name,, Cell Range), Optional parameter(s). Defines ruling 
  330. line override for any range in the cell. List all ruling line overrides 
  331. at the beginning of table in one paragraph separated by commas., RULE(Z_HIDDEN,R9C2..R9C3)
  332.  
  333. @@Z_TBL_HEAD = tag1,, tag2,,  ...,,  tagn, Defines the tags for each 
  334. column in the header row,  @Z_TBL_HEAD = TABLE TEXT,, TABLE 2,, TABLE 
  335. 3,, TABLE 4
  336.  
  337. @@Z_TBL_BODY = tag1,,  tag2,,  ...,,  tagn, Defines the tags for each 
  338. column in a row. Use before first non-header row and before any row 
  339. whose tags are different from preceding row. A tag for each column 
  340. must be specified,  @Z_TBL_BODY = TABLE TEXT,, TABLE TEXT,, TABLE 
  341. TEXT,, TABLE TEXT
  342.  
  343. C1,, C2,, C3,, C4, Data for each column in a row. Use a ^ character 
  344. before the comma to indicate this cell is joined with the one above; 
  345. + to indicate this cell is joined with cell to the right.,  1,, 2,, 
  346. 3,, 4<R>
  347. 5,, 6,, ^,,  8<R>
  348. 9,, 10,, 11,, +,, +
  349.  
  350.   <<$!Bnm>>, Set tint for cell. Tint appears at end of cell entry. <B>n<D> 
  351. is color,, <B>m<D> is pattern., 1b,, 2b,, 3b,, 4b<<$!B26>>
  352.  
  353. @@Z_TBL_END = , Indicates the end of the table.,  @Z_TBL_END = 
  354.  
  355. @Z_TBL_END = 
  356.  
  357. The beauty of Ventura Publisher's table feature is that from your 
  358. database program or spreadsheet macro you can specify the number of 
  359. columns using the COLUMNS parameter, and the width of each column 
  360. using the COLWIDTHS parameter, and Ventura Publisher will do the rest, 
  361. automatically adjusting the height of each row to accommodate the 
  362. tallest cell. If you specify the @Z_TBL_HEAD tag followed by one or 
  363. more rows of text, this text will be repeated at the top of each page 
  364. onto which the table continues. For instance, if you wanted the headings 
  365. <B>NAME<D>, <B>AGE<D>, and <B>RANK<D> to appear at the top of every 
  366. page in a three column table, then the immediately following the KEEP 
  367. or RULE parameter you would have two lines that look like this:<R>
  368.  
  369.  
  370. @TAB 1 = <F2P8M> @Z_TBL_HEAD = tag1, tag2, tag3<F255P255D>
  371.  
  372. @TAB 1 = <F2P8M> NAME, AGE, RANK<F255P255D><R>
  373. <R>
  374. These two lines are then followed by:<R>
  375. <R>
  376. <F2P8M> @Z_TBL_BODY = tag1, tag2, tag3<F255P255D><R>
  377. <R>
  378. which is then followed by the actual data in the table.
  379.  
  380. @HEAD 2 = Separating fields
  381.  
  382. The only real problem in extracting information from databases is 
  383. that many of them provide very limited export facilities and most 
  384. provide no search and replace capabilities. This latter feature is 
  385. important because each field in a Ventura Publisher table is separated 
  386. by a comma followed by a space. However, if data <MI>within<D> a field 
  387. contains a comma space, Ventura Publisher will interpret this as the 
  388. end of one field and the beginning of another field. Obviously this 
  389. won't work. Fortunately, if you place two commas followed by a space 
  390. within a field, Ventura Publisher will interpret this as a single 
  391. comma followed by a space, but no new field. If your database program 
  392. allows search and replace, you can simply copy the database to a temporary 
  393. database, search for every occurrence of comma-space and replace it 
  394. with comma-comma-space, and export the resulting database.
  395.  
  396. Unfortunately, dBase III Plus doesn't come very close to providing 
  397. these capabilities and therefore some programming may be required. 
  398. However, if your database contains no <MI>comma-spaces<D> within any 
  399. field, then you can simply extract fields using the label generator. 
  400. You then create the file using the LABEL FORM command as in the previous 
  401. example. Of course this doesn't put the table heading into the file. 
  402. The simple way to do this is to create the table header in a separate 
  403. file and the table end statement in another file and merely use the 
  404. DOS<B> COPY<D> command to combine them altogether. Take a look at 
  405. the example at the bottom of the page. This example also shows how 
  406. to put frames within tables, which brings us to the next section <193>
  407.  
  408. @HEAD 2 = Frames within tables
  409.  
  410. Another frequent request is the ability to create documents which 
  411. contain illustrations. Ideally these should be automatically placed 
  412. at the correct location within your document. One way to do this is 
  413. to have your database program place <MI>automatic<D> frame anchors 
  414. within a table. If these anchors are placed by themselves in a cell 
  415. in the table, then any pictures which already exist within the chapter 
  416. template and which have been previously assigned anchor names which 
  417. match those placed into the text will automatically move to the correct 
  418. location in the table. One way to easily generate lots of frame anchor 
  419. names is to use the record number as part of the anchor name. For 
  420. instance, dBase label code shown at the bottom of the page generates 
  421. a series of anchor names starting with FR1, FR2, FR3 <193> etc.
  422.  
  423. Of course to make this work, you must have frames in a chapter template 
  424. which have matching anchor names, and which contain the pictures which 
  425. you want to appear. How do you create the frames in the chapter template? 
  426. The most straightforward way, although rather tedious, is to:
  427.  
  428. @BULLET 1 = Start with a blank chapter
  429.  
  430. @BULLET 1 = Immediately add a new page after the current page.
  431.  
  432. @BULLET 1 = Go to this inserted page (i.e., page 2) and draw one frame
  433.  
  434. @BULLET 1 = Copy this frame to the clipboard.
  435.  
  436. @BULLET 1 = Repeatedly paste a copy of this frame by pressing the 
  437. <B>INS<D> key.
  438.  
  439. The frames can be all piled up on top of each other on the same page 
  440. and Ventura Publisher will sort them all out when a text file containing 
  441. the corresponding frame anchors is loaded.
  442.  
  443. To add anchor names to the pasted frames, select the <B>Anchors and 
  444. Captions<D> option in the Frame menu after each frame is pasted, and 
  445. then assign an anchor name. (You can use the Ctrl X shortcut to immediately 
  446. recall the Anchors and Captions dialog box.)
  447.  
  448. @HEAD 2 = Edit chapter file
  449.  
  450. You can also edit the chapter file to create the additional frames 
  451. and automatically insert frame anchor names. This is a little tricky, 
  452. but if you want to create a chapter which has hundreds or thousands 
  453. of frames, you really don't have much choice. By the way, before you 
  454. begin, keep in mind that a chapter file can be no bigger than 64K, 
  455. and the limit of the number of files in a chapter is 128.
  456.  
  457. Follow these steps to create a chapter which contains a large number 
  458. of frames, each containing its own unique frame anchor name:
  459.  
  460. @BULLET 1 = Run Ventura Publisher.
  461.  
  462. @BULLET 1 = Insert a new page after the current page.
  463.  
  464. @BULLET 1 = Draw a frame which is the desired size.
  465.  
  466. @BULLET 1 = Load a file into the frame.
  467.  
  468. @BULLET 1 = Apply all appropriate frame attributes (i.e., all the 
  469. options in the Frame menu), including an anchor name.
  470.  
  471. @BULLET 1 = Save the chapter.
  472.  
  473. @BULLET 1 = Copy the frame to the clipboard.
  474.  
  475. @BULLET 1 = Paste a copy of the frame back to the page.
  476.  
  477. @BULLET 1 = Load a different file into this new frame.
  478.  
  479. @BULLET 1 = Immediately select the <B>Anchors & Captions<D> option 
  480. and assign an anchor name.
  481.  
  482. @BULLET 1 = Save the chapter under a new name using the <B>Save As<D> 
  483. option in the File menu.
  484.  
  485. You now have two chapters which differ only by the addition of one 
  486. frame. If you compare the two in your word processor, you will find 
  487. that the only three differences are:
  488.  
  489. @BULLET 1 = The file counter has been incremented (see the figure 
  490. below).
  491.  
  492. @BULLET 1 = The frame counter has been incremented.
  493.  
  494. @BULLET 1 = Several lines have been added to the end of the chapter 
  495. file. This added information describes the new frame.
  496.  
  497. You can then load the second chapter file into your word processor 
  498. (<MI>make sure you import and export it as an ASCII file).<D> You 
  499. then write a macro which duplicates the added portion as many times 
  500. as necessary in order to create the number of frames in your chapter 
  501. (or simply use the cut/copy/paste facilities in your word processor). 
  502. You can then also write a macro to update the file frame anchor names 
  503. so that each new frame has its own unique file and anchor names. Finally, 
  504. when you are finished, update the frame and file counters so that 
  505. they describe the total number of files and frames in this template 
  506. chapter (the counter operates in HEX).
  507.  
  508. To summarize: If you create text using the codes shown at the bottom 
  509. of the previous page, and then load this text into the chapter template 
  510. created using the method described above, you will end up with something 
  511. that looks like this:<R>
  512. <$&Anchor examp[-]>
  513.  
  514. @HEAD 1 = Subtotal publishing
  515.  
  516. So far you've seen how to use the three strategies (i.e., each field 
  517. in a separate paragraph, each field separated by tabs, and each field 
  518. in a different cell in a table) to create fairly simple documents. 
  519. The main vehicle for extracting information from dBase III has been 
  520. its label generator. You can also use the report generator to create 
  521. documents which contain subtotals. This section shows how. Armed with 
  522. this information, you should begin to see how you could publish a 
  523. more complex document such as a catalog.
  524.  
  525. Unfortunately the dBase report generator places a lot of extraneous 
  526. heading information, carriage returns, and other characters into the 
  527. output file. While you can write custom code to create any file you 
  528. want, this takes time and doesn't execute as fast as a dBase program. 
  529. However, if you use a search and replace utility, you can eliminate 
  530. all of the extraneous information in the file after you have created 
  531. it. For example, a utility called <B>SNR<D> is a shareware utility 
  532. from Thomas A. Lundin, Graphics Unlimited Inc., 3000 2nd St. N., Minneapolis, 
  533. MN 55411, (612) 588-7571. It lets you construct a search and replace 
  534. table in which you can specify several search and replace strings 
  535. so that several items can be altered or removed during one single 
  536. pass through the file. A typical search table looks like this:<R>
  537. <$&snr[-]>
  538.  
  539. Thus, if you want to publish a database using the dBase report code 
  540. described above, you could write a little dBase PRG file that looks 
  541. like this:
  542.  
  543. @TABLE 2 = <F1M>use examp3<F255D>
  544.  
  545. @TABLE 2 = <F1M>report form examp3 to examp3<F255D>
  546.  
  547. @TABLE 2 = <F1M>!snr examp3.txt xxx snr.snr<F255D>
  548.  
  549. @TABLE 2 = <F1M>!del examp3.txt<F255D>
  550.  
  551. @TABLE 2 = <F1M>!rename examp3.xxx examp3.txt<F255D>
  552.  
  553. The file <F2M>SNR.SNR<F255D> contains the search table shown in the previous 
  554. column.
  555.  
  556. @HEAD 1 = Custom dBase code
  557.  
  558. If you are willing to write custom dBase code, you can create just 
  559. about any text file you wish. You could even create your own chapter 
  560. files! However, this is beyond most people's abilities.
  561.  
  562. To give you some idea of what is possible with custom dBase code, 
  563. a modest dBase program is included with this application note (example 
  564. 4). This program allows you to specify any valid dBase database file 
  565. and then lets you specify which fields you wish to extract and in 
  566. which order. You can also optionally apply a different tag to each 
  567. field. The program then extracts the information into a Ventura Publisher 
  568. Professional Extension table. The width of each column is set to the 
  569. width of the field in the database. Unlike many dBase programs, this 
  570. one will extract memo fields.
  571.  
  572. You will find this program quite useful, with one caveat: It is slow. 
  573. dBase code just doesn't execute very fast. However, if you own Foxbase, 
  574. Clipper, or similar dBase compilers, you should be able to compile 
  575. this code and notice a marked improvement. The program is heavily 
  576. commented to help you if you should choose to modify it.
  577.  
  578. @HEAD 2 = Catalog publishing
  579.  
  580. Example 5 on the distribution disk provides a good example of catalog 
  581. publishing. The techniques used are the same as already discussed.
  582.  
  583. @HEAD 1 = Spreadsheet publishing
  584.  
  585. All of the examples so far have concentrated on how to extract information 
  586. from a database (using dBase III as the example). The same three strategies 
  587. also apply to a spreadsheet. This section describes several methods 
  588. for exporting information from Lotus <->1-2-3 into Ventura Publisher.
  589.  
  590. @HEAD 2 = PRN to Table
  591.  
  592. If you own the Professional Extension, you can print a spreadsheet 
  593. to a file using the <B>/PF<D> command. You then specify the file name 
  594. and the range you wish to export, and 1-2-3 does the rest. When you 
  595. then run Ventura Publisher, you select the <B>Load Text/Picture<D> 
  596. option, choose <B>PRN-to-table<D>, and then select the file you created 
  597. in 1-2-3. This feature works very well, except for the fact that you 
  598. must first make sure that you have at least two spaces between each 
  599. column. This means you may need to use the <B>/WCS<D> or <B>/WGC<D> 
  600. commands to increase the width of some or all of the columns. Since 
  601. extra spaces between columns are deleted by the PRN-to-table converter, 
  602. you should err on the side of making the columns too wide.
  603.  
  604. If you don't own the Professional Extension, then you can still export 
  605. the text to a PRN file using the /PF command in 1-2-3, and then load 
  606. it as a <B>Wordstar 3<D> file (the Wordstar 3 converter treats each 
  607. line of text as a separate paragraph, whereas the ASCII converter 
  608. requires a blank line between each line). The result is a line of 
  609. text for each row in the spreadsheet.
  610.  
  611. However, <MI>you must use the Courier (mono-spaced) font<D>, or else 
  612. columns will no longer align. This is due to the fact that Ventura 
  613. Publisher uses proportionally spaced fonts. Thus, if the first column 
  614. in a row contains many narrow characters (such as <B>i<D>) and the 
  615. row below contains lots of wide characters (such as <B>w<D>), the 
  616. second column in the first row will start further to the left than 
  617. the second column in the second row.
  618.  
  619. You can purchase one of several utilities (listed at the end of this 
  620. note) which remove multiple space characters between columns and replace 
  621. them with tab characters. You then use the <B>Tab Settings<D> option 
  622. (Paragraph menu) to set the tab stops in Ventura Publisher's style 
  623. sheet to make the columns line up. This works extremely well for many 
  624. spreadsheets because Ventura Publisher includes a <B>decimal tab<D> 
  625. which forces numbers to line up at the decimal point. 
  626.  
  627. @HEAD 2 = Lotus 1-2-3 simple macro
  628.  
  629. The reason why you need to use an external utility is that 1-2-3 does 
  630. not let you place a tab character within a cell of the spreadsheet. 
  631. (When you press the tab key, or ALT 9, the screen moves.) If you <MI>could<D> 
  632. place a tab character within a cell, you could then insert one-character-wide 
  633. columns between each existing column, copy the tab character into 
  634. each column, and then print the spreadsheet. You would then have a 
  635. spreadsheet file which contains tabs between text.
  636.  
  637. Well, with a little work, you <MI>can<D> place a tab character within 
  638. a cell. The key is to use a simple 1-2-3 macro. For instance, type 
  639. the following into any six cells in your spreadsheet:
  640.  
  641. @TABLE 2 = <MU>    <BU>Col1    Col2<D>
  642.  
  643. @TABLE 2 = Row1    \m          {LET Tab,@CHAR(9)}~
  644.  
  645. @TABLE 2 = Row2        
  646.  
  647. @TABLE 2 = Row3    Tab
  648.  
  649. Then place the cursor in the cell which contains <B>\m<D>, type <F1B>/RNLR<F255D> 
  650. and the press the down arrow twice so that both <B>\m<D> and the word 
  651. <B>Tab<D> are covered. Then press the enter key. If you then press 
  652. <F1B>ALT M<F255D>, the tab character will be placed in Row3, Column2.
  653.  
  654. Once you have run this macro, you can then copy the tab character 
  655. to any other range by typing:
  656.  
  657. <F1B>/Ctab<F255D><R>
  658. <R>
  659. followed by the destination range.
  660.  
  661. @HEAD 2 = Lotus 1-2-3 advanced macro
  662.  
  663. If you really know 1-2-3 macro programming, you can almost completely 
  664. automate the file tagging and export process. Included with this application 
  665. note is a very sophisticated macro contained in a file called <B>123TOVP.WK1<D>. 
  666. This macro is designed to be combined with any existing spreadsheet. 
  667. Once combined, you simply:
  668.  
  669. @BULLET 1 = Select the range to export.
  670.  
  671. @BULLET 1 = Decide which of the three strategies you wish to use (tags 
  672. between columns, tabs between columns, or Professional Extension table 
  673. export).
  674.  
  675. @BULLET 1 = Specify a file and export the text to that file.<R>
  676. <R>
  677. <B>To use this macro:<D>
  678.  
  679. @BULLET 1 = Copy the file <F1B>123TOVP.WK1<F255D> to your Lotus 1-2-3 default 
  680. directory.
  681.  
  682. @BULLET 1 = Run 1-2-3.
  683.  
  684. @BULLET 1 = Use the 1-2-3 <F1B>/FR<F255D> command to retrieve your spreadsheet 
  685. file.
  686.  
  687. @BULLET 1 = Press the <B>END<D> then <B>HOME<D> key followed by the 
  688. down arrow and right arrow keys to go to the end of your spreadsheet.
  689.  
  690. @BULLET 1 = Type <F1B>/FCCE123TOVP.WK1<F255D> followed by the Enter key.
  691.  
  692. @BULLET 1 = Immediately type <F1B>/RNLR<F255D> followed by <B>Enter<D>.
  693.  
  694. @BULLET 1 = Press <F1B>ALT V<F255D> to start the Ventura Publisher macro.
  695.  
  696. @BULLET 1 = Follow the instructions given on screen.
  697.  
  698. After you are finished, use the <F1B>/WEY<F255D> command to erase the spreadsheet.
  699.  
  700. This macro is provided <MI>as is<D> for your own use and is not for 
  701. sale and is not supported. If you want to modify the macro to try 
  702. to speed it up, go right ahead.
  703.  
  704. @HEAD 1 = External products
  705.  
  706. The following is a list of programs designed to aid in the export 
  707. of database and spreadsheet information into Ventura Publisher.
  708.  
  709. @HEAD 2 = Advanced Systems, Ltd.
  710.  
  711. @TAB 1 = 803 West Main Street, Suite 112<R>
  712. League City, TX 77573<R>
  713. (713) 333-9717
  714.  
  715. @TAB 1 = <B>1-2-3 to Professional Extension tables<D>. All formatting 
  716. (e.g., join cells, tints, tagging) done in 1-2-3. Assures that table 
  717. format is not lost when spreadsheet changes.
  718.  
  719. @HEAD 2 = Corel Systems Corporation
  720.  
  721. @TAB 1 = Corel Building<R>
  722. 1600 Carling Avenue<R>
  723. Ottawa, Ontario, Canada K1Z 7M4<R>
  724. (613) 728-8200
  725.  
  726. @TAB 1 = <B>Tabin<D>. Inserts tabs into spreadsheet printouts for 
  727. proportional spaced printouts of tables.
  728.  
  729. @HEAD 2 = The Desktop Publishing Group
  730.  
  731. @TAB 1 = 978 Douglas Avenue<R>
  732. Altamonte Springs, FL 32714<R>
  733. (800) 257-8087<R>
  734. (305) 862-7755
  735.  
  736. @TAB 1 = <B>Table Manners<D>. Transfers Lotus 123 files to Ventura 
  737. Publisher.
  738.  
  739. @HEAD 2 = Digital Presentation Services
  740.  
  741. @TAB 1 = 220 W. 24th St.<R>
  742. New York, NY 10011<R>
  743. (212) 924-7661
  744.  
  745. @TAB 1 = <B>VP Utility Pak I<D>. Table creation and text creation 
  746. utilities for preparing documents and spreadsheets for importation 
  747. into Ventura Publisher.
  748.  
  749. @HEAD 2 = The Laser Edge
  750.  
  751. @TAB 1 = 360 17th Street<R>
  752. Suite 203<R>
  753. Oakland, CA 94612<R>
  754. (415) 835-1581
  755.  
  756. @TAB 1 = <B>XVP/BASE<D>. dBase III to Ventura Publisher translator.
  757.  
  758. @TAB 1 = <B>XVP/Tabs<D>. Inserts tabs into spreadsheet printouts for 
  759. perfect proportional spaced printouts of tables.
  760.  
  761. @HEAD 2 = Original Software Concepts
  762.  
  763. @TAB 1 = Kent Lodge, 38 Castle Hill<R>
  764. Maidenhead, Berkshire, SL6 4JJ<R>
  765. England<R>
  766. FAX (011 44) 628 770658
  767.  
  768. @TAB 1 = <B>Database Publisher<D>. GEM-based database extraction and 
  769. automatic tagging program.
  770.  
  771. @HEAD 2 = Publishing Solutions
  772.  
  773. @TAB 1 = 205 E. 78th St. Ste. 17-T<R>
  774. New York, NY 10021<R>
  775. (212) 288-2470
  776.  
  777. @TAB 1 = <B>dataTAG<D>. Incorporate database information into Ventura 
  778. Publisher.
  779.  
  780.