-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathHOWTO
88 lines (61 loc) · 2.74 KB
/
HOWTO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Creating reports
================
Detailed guide what I would like to make in the near future. Pending its arrival
learning sample reports is the best way to understand how NCReport is working and
how to create your reports. Report XML files are also clear and readable but
NCReport-designer since last year has been being ready to make report files.
Use it!
Running reports
===============
Since 0.7.20 use the report tester form included in the project pack.
Number format rules
===================
The "numberFormat" property holds the following format code separated by two part.
The separator is ";" semicolon character. The first part is optional. It's used for
locale setting of number. The secont part holds the format of the number. The format
code ruled by QString::arg(...).
Example format code: %L1;0f2
Where:
%L1 : local number format
0f2 : 0=fieldwidth f=float 2=decimals
if decimals is empty this is automatic
Also the old format code can be used:
Example old format code: %9.2f
Where:
9=fieldwidth f=float 2=decimals
Usage of lookup feature
=======================
Lookup class is a useful feature for when needs to present a data generated by
application that uses NCReport. It's available for data fields only.
To make your private lookup class inherit NCReportLookup virtual class.
Example:
class MyLookup : public NCReportLookup
{
public:
QString lookupResult( const QVariant& value, const QSqlRecord& r )
{
return r.value(0).toString()+" "+value.toString()+" - XX";
}
};
To register class:
MyLookup *lc = new MyLookup;
lc->setName("test");
report->registerLookupClass( lc );
To use class in report XML, at <field> use these attributes:
ftype="lookup"
lookupClass="test"
Example:
<field ftype="lookup" lookupClass="test" fontSize="14" posX="90" posY="0"
width="80" fontWeight="bold" forecolor="#000000">title</field>
RichText fields
===============
NCReport now is able to render dynamic lenghted, even multi-page richtexts. (Automatic
section growing is working only for details section) These kind of text may contain any
richtext elements or tags supported by Qt in QTextDocument (or QSimpleRictext in Qt3).
You'll find examples in sample directory for dynamic richtext usage.
Most important new properties also are valid for report generator (within field and label):
dynamicHeight="true/false" richText="true/false" (loadFromFile="true/false")
When loadFromFile="true" the report engine evaluates text from the
specified file which filename stored in sql field. When you store
filename in XML file (instead of sql column name in field or insted of
text in label) NCReport use them as filename and load them.