Importing a long list with formatting into Scribus
|Installation • Usage • PDF issues • Other|
(You will also need OpenOffice to achieve this)
From time to time you may want to import a long list of data such as a catalogue, where the list of items will wrap over multiple text frames. Lists such as this will often require formatting - eg to highlight special offer items.
It is possible to achieve this in Scribus (tested in 1.3.x) - without having to do the formatting by hand. The steps in the process are relatively simple, although there are several steps to the process. (This seems to work more by accident rather than design!)
1. You need the list you want to import in some form of table - either from a database or a OO calc spreadsheet. If you are exporting from a SQL database the easiest way (especially if you do it often) would be to write some PHP to create a formatted HTML table. The detial of how to do that is beyond the scope of this article.
2. Do any of the formatting, text work now on the table. In other words if your list looks like this:
|Prod001||Product1:||This is the best product you can buy||£100||Yes|
|Prod002||Product2:||This is a cheap copy of Prod 1||£75|
|Prod003||Product2:||Multipack of 5 of Product 2.||£350|
|Prod004||Product2:||Buy Two Multipack Product 2s get £100 off||£600||Yes|
|Prod005||Product3:||Another Product Description||£100|
|Prod006||Product3:||Buy 2 get 1 Free||£200||Yes|
You might want to use some conditional formatting in Open Office to create something that looks like this:
Clearly these lists are short enough to import as a normal table (via SVG etc) but imagine they run to several pages!
3. In OpenOffice.Calc save the file as an HTML file. (I tested this with Save As rather than Export)
4. Now Close OpenOffice COMPLETELY - I have no idea why but until you close OpenOffice Completely it seems to know that the file is a Calc file and re-opens it in calc?
5. Re-open the HTML file in Open Office - this time it will open in writer. Select the table and choose Table / Convert Table to Text and use Tabs to delimit the information. The example file above contains html like this:
<BODY LANG="en-GB" TEXT="#000000" DIR="LTR"> <P>Code Product Description Price On Sale</P> <P><FONT COLOR="#800000"><B>Prod001 Product1: This is the best product you can buy 100 Yes</B></FONT></P> <P>Prod002 Product2: This is a cheap copy of Prod 1 75 </P> <P>Prod003 Product2: Multipack of 5 of Product 2. 350 </P> <P><FONT COLOR="#800000"><B>Prod004 Product2: Buy Two Multipack Product 2s get £100 off 600 Yes</B></FONT></P> <P>Prod005 Product3: Another Product Description 100 </P> <P><FONT COLOR="#800000"><B>Prod006 Product3: Buy 2 get 1 Free 200 Yes</B></FONT></P>
6. Resave the file this time as an ODT format file! (Use File / Export
7. Now import the ODT into a Scribus Text Frame, using Get Text. Colours and Bold and Italics all appear to import in fine - either as full lines or part lines (i.e. Characters), complete with the tabs to seperate the 'fields'. [I get some date string at the very end being imported - live with it! It just needs deleted]
8. Edit the style for the imported paragraph to set the tabs in the correct place here's my finsihged example (I switched off the bold on the last line for everything but the price to prove it imports character format as well as lines)