[reportlab-users] Processor for kugar definitions

Dick Kniep reportlab-users@reportlab.com
Mon, 19 Jan 2004 01:07:22 +0100


--Boundary-00=_6+xCA2gNfNW48un
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi Andy

On Sunday 18 January 2004 23:36, Andy Robinson schreef:
> That does sound neat!  I have not played with Kugar but we'll
> try to give it a go on - I am very interested in anything with
> a visual layout engine we could hook into.
>
> If you would like it included in the main distribution, then
> I am willing to put it under 'demos' as it's of good general
> teaching interest; but we need a couple more things to go with it:
>
> (1) you refer to a layout file in your
>     p = XMLReplab('../config/demooffertenw.kut',InMemory=False)
> We need that file in the current directory for your code to be runnable

OK here it is. Off course this is only a simple definition

> (2) A readme or HTML document explaining the 'big picture'.  I suggest
> an HTML page and screenshot of kudesigner laying out the report,
> since lots of people will not have used that.

I will do that next month.

> It should definitely have a page on our web site.

> I don't have a Linux box to play on, so perhaps you can tell
> me and the group what features Kugar offers.  Is it just
> a single level of detail, or can it do nested grouping and
> conditional subreports, like Crystal or MS Access?

Kugar is a report writer that consists of 2 parts. kudesigner, and kugar and 
is a standard part of KDE. Documentation on what it can do can be found on 
www.kde.org. With kudesigner, one can define a layout which consists of a 
report header, a page header, 9 levels of detail lines and also 9 levels of 
totals per detaillevel. Next, page footers are defined and report footers. It 
is possible to define totals, averages and some more things, that can be 
calculated on the detaillines and result in a total in the totallevels. Kugar 
supports all that, however, my current solution only supports totals (so no 
averages etc). 

Kugar also supports images. These can be added, and I plan to add them in the 
coming months. 

The coding needs some cleaning up. It is very fresh, and hasn't been tested 
much. So anyone willing to test.... You are kindly invited to do so.

Cheers,
D.Kniep

--Boundary-00=_6+xCA2gNfNW48un
Content-Type: application/x-kudesigner;
  name="demooffertenw.kut"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="demooffertenw.kut"

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE KugarTemplate SYSTEM "../config/kugartemplate.dtd">

<KugarTemplate BottomMargin="10" LeftMargin="20" PageOrientation="0" PageSize="0" RightMargin="40" TopMargin="10">
	<PageHeader PrintFrequency="1" Height="150">
		<Line Color="0,0,0" Style="1"
		   Width="1" X1="3" X2="873"
		   Y1="142" Y2="142" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="25" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="55"
		   Text="DEMO BEDRIJF CVix" VAlignment="1" Width="399"
		   WordWrap="0" X="36" Y="51" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="21"
		   Text="Markgracht 58" VAlignment="1" Width="185"
		   WordWrap="0" X="635" Y="19" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="22"
		   Text="1354 BE  ALMERE" VAlignment="1" Width="185"
		   WordWrap="0" X="635" Y="40" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="21"
		   Text="Tel:  036-5215580" VAlignment="1" Width="183"
		   WordWrap="0" X="635" Y="62" />
	</PageHeader>

	<Detail Height="370" Level="0">
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="Naam1" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[Naam1]" VAlignment="1"
		   Width="400" WordWrap="0" X="80"
		   Y="20" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="Naam2" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[Naam2]" VAlignment="1"
		   Width="400" WordWrap="0" X="80"
		   Y="60" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="Postbus" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[Postbus]" VAlignment="1"
		   Width="399" WordWrap="0" X="80"
		   Y="40" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="Adres1" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[Adres1]" VAlignment="1"
		   Width="402" WordWrap="0" X="80"
		   Y="80" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="Postcode" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[Postcode]" VAlignment="1"
		   Width="140" WordWrap="0" X="80"
		   Y="100" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="Woonplaats" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[Woonplaats]" VAlignment="1"
		   Width="320" WordWrap="0" X="231"
		   Y="100" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="20"
		   Text="Almere, " VAlignment="1" Width="60"
		   WordWrap="0" X="80" Y="180" />
		<Special BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" DateFormat="11"
		   FontFamily="Times New Roman" FontItalic="0" FontSize="12"
		   FontWeight="50" ForegroundColor="0,0,0" HAlignment="0"
		   Height="20" Text="[Date]" Type="0"
		   VAlignment="1" Width="129" WordWrap="0"
		   X="141" Y="180" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="20"
		   Text="Betreft" VAlignment="1" Width="90"
		   WordWrap="0" X="80" Y="230" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="20"
		   Text="Offertenr" VAlignment="1" Width="90"
		   WordWrap="0" X="80" Y="250" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="20"
		   Text=":" VAlignment="1" Width="15"
		   WordWrap="0" X="190" Y="230" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="20"
		   Text=":" VAlignment="1" Width="15"
		   WordWrap="0" X="190" Y="250" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="betreft" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[betreft]" VAlignment="1"
		   Width="200" WordWrap="0" X="220"
		   Y="230" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="offertenr" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[offertenr]" VAlignment="1"
		   Width="200" WordWrap="0" X="220"
		   Y="250" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="20"
		   Text="Geachte" VAlignment="1" Width="70"
		   WordWrap="0" X="80" Y="310" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="aanhefnaam" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[aanhefnaam]" VAlignment="1"
		   Width="477" WordWrap="0" X="151"
		   Y="310" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="1" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="24"
		   Text="Hierbij offreren wij u de volgende diensten voor bovengenoemde client" VAlignment="1" Width="567"
		   WordWrap="0" X="80" Y="340" />
	</Detail>

	<Detail Height="30" Level="1">
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="omschrijving" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="22" NegValueColor="0,0,0"
		   Precision="2" Text="[omschrijving]" VAlignment="1"
		   Width="500" WordWrap="0" X="80"
		   Y="8" />
	</Detail>

	<Detail Height="25" Level="2">
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="omschrijving" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="10" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="18" NegValueColor="0,0,0"
		   Precision="2" Text="[omschrijving]" VAlignment="1"
		   Width="401" WordWrap="0" X="90"
		   Y="5" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="4" DateFormat="11"
		   Field="bedrag" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="10" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="2" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[bedrag]" VAlignment="1"
		   Width="98" WordWrap="0" X="492"
		   Y="5" />
	</Detail>

	<ReportFooter PrintFrequency="0" Height="350">
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="20"
		   Text="*** Totaal bedrag" VAlignment="1" Width="400"
		   WordWrap="0" X="80" Y="13" />
		<CalculatedField BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="1" BorderWidth="1" CalculationType="1"
		   CommaSeparator="44" Currency="32" DataType="4"
		   DateFormat="11" Field="bedrag" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="2" Height="20"
		   NegValueColor="0,0,0" Precision="2" Text="[bedrag]"
		   VAlignment="1" Width="98" WordWrap="0"
		   X="492" Y="13" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="105"
		   Text="Wij verzoeken u bij honorering van de offerte, deze getekend te retourneren. Indien gewenst kunt u over de inhoud telefonisch contact opnemen met de case manager van bovengenoemde client." VAlignment="1" Width="660"
		   WordWrap="1" X="80" Y="47" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="40"
		   Text="Namens Demo bedrijf CVix" VAlignment="1" Width="288"
		   WordWrap="0" X="80" Y="160" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="namens" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[namens]" VAlignment="1"
		   Width="200" WordWrap="0" X="80"
		   Y="285" />
		<Label BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" FontFamily="Times New Roman"
		   FontItalic="0" FontSize="12" FontWeight="50"
		   ForegroundColor="0,0,0" HAlignment="0" Height="40"
		   Text="Opdrachtgever" VAlignment="1" Width="192"
		   WordWrap="0" X="600" Y="162" />
		<Field BackgroundColor="255,255,255" BorderColor="0,0,0"
		   BorderStyle="0" BorderWidth="0" CommaSeparator="44"
		   Currency="32" DataType="0" DateFormat="11"
		   Field="opdrachtgever" FontFamily="Times New Roman" FontItalic="0"
		   FontSize="12" FontWeight="50" ForegroundColor="0,0,0"
		   HAlignment="0" Height="20" NegValueColor="0,0,0"
		   Precision="2" Text="[opdrachtgever]" VAlignment="1"
		   Width="200" WordWrap="0" X="600"
		   Y="285" />
	</ReportFooter>

</KugarTemplate>

--Boundary-00=_6+xCA2gNfNW48un--