Importing a long list with formatting into Scribus: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 4: Line 4:


(You will need OpenOffice to achieve this)
(You will need OpenOffice to achieve this)
'''** This is a DRAFT - it will be tidied up when I test it to make sure its written correctly **'''


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.
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.
Line 30: Line 28:
Clearly these lists are short enough to import as a normal table (via SVG etc) but imagine they run to several pages!
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
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?
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. Select the table and choose... [remove table]
5. Re-open the HTML file in Open Office - this time it will open in writer. Select the table and choose <b>Table / Convert Table to Text</b> and use Tabs to delimit the information. The example file above contains html like this:
<br/>
<nowiki>
<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 &pound;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>
</nowiki>
<br/>
6. Resave the file this time as an ODT format file! (Use <b>File / Export</b>


6. Resave the HTML
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]


7. Now import the HTML into a Scribus Text Frame
8. Edit the style for the imported paragraph to set the tabs in the correct place


8. Edit the style for the imported paragraph to set the tabs in the correct place
Good Luck!

Revision as of 21:57, 8 November 2006

This article is part of the Tips & Tricks series.
Installation Usage PDF issues Other
 Requirements
Operating system:    Any
Scribus version:    1.3.x
DTP skills:    Noob
OS skills:    Noob

(You will 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:

CodeProductDescriptionPriceOn Sale
Prod001Product1: This is the best product you can buy £100 Yes
Prod002Product2: This is a cheap copy of Prod 1 £75
Prod003Product2: Multipack of 5 of Product 2. £350
Prod004Product2: Buy Two Multipack Product 2s get £100 off £600 Yes
Prod005Product3: Another Product Description £100
Prod006Product3: 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:

Table.JPG

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

Good Luck!