Home

CuteReport User Manual - The UK Mirror Service

image

Contents

1. 6745 Fifth Circle Springboro 54322 Carolyn London 990 Hill Street Metaline Falls 67901 2 Jaunita Johnson 5505 Park Boulevard Drummond 73124 Steve Neeley 793 Main Street Edward 76348 Tia Bergman 4327 Cedar Avenue Jacksonville 76320 3 Calista Baskin 2017 Seventh Street Boca Raton 94765 Vida Brock 395 Sixth Circle Wrightsboro 89372 Brady James 875 Lake Circle Stockholm 98347 an Alia 11 Andaana 19 Cllane You can set any type depending of your needs Not all bands respect column setting Some ignore it like PageHeader PageFooter Some other have special property to adjust this behavior like DetailHeader or DetailFooter Using this option you can design complex columned reports One of the samples of columned report with grouping you can see below My Music Collection 3 Soroh You ate My Breath An 342 4 iwant To Be Needed Duet wi 633 5 _ RneverMake myAngelGy sas 6 MntersofTenigne 345 7 ascoodastces 532 8 ReyutteTing 2 3 Rector Screamingtove 382 10 Stilintoveweh You 28 243 max 633 avg 399 00 Total length 4794 L 1 Jomnecmmecmmer 356 2 mewimertotesial 489 Teto eos frenando 3887 s ramman 96 6 Pano oncenonoThn Brat 453 _ 7 etre modigan Pano oncer 533 6 corn trapos 522 o Lebesa reves mou 754 10 laPothetiue Dar 13 7 254 14 aladepourAdeine 456 is rosario soa 16 jew 7 stthewaryouare 335 18 a
2. 11 The Workspace 12 shows the entire page template You can add a new band or item to your page using drag n drop Functionality dragging a selected item from a drop down list 4 5 to the page on the workspace Almost all items can be placed only on a band and bands can be placed only on a page directly Press Delete button to delete the band or the item with all their children items It is possible to select some items and do group operations To select some items click First item and then hold CTRL and click on other item You can click direct on item on the page or click item name in the Object Inspector To perform Further group operation use editors on the tool bar The changes you make will be applied to all selected items if item allow it On the application status bar you can see current mouse position and geometry of the current selected object Some item can have helper Sometimes it is easier way to change object s property To open object s helper double click on the object For example if you click on Memo object you will be able to use text editor to enter Memo s text or expression Some other editors can be available too if appropriate modules are installed Commercial has some additional modules that is not provided for community version Control Keys Key Action Description Ctrl N Report New Report Create new report template Ctrl O Report gt Open Report Open report template Ctrl S Report
3. As a result you will have something like on the picture below Cute Report Add Standard SQL v B Test it rts 8 Database file datasets business db File Extended Options 3 Host User Password Driver QSQLITE lt lt Available Drivers QSQLITE v select from customer Object connect No such signal org freedesktop UPower DeviceRemoved QDBusObjectPath Click Test it button and table with the Fetched from the database data will appear If there is an error exists you will see it in the status bar bottom Frame Well done Now you have dataset completed 2017 Seven Boca Raton 6745 Fifth 793 Main St 395 Sixth Ci 990 Hill Str Metaline Falls 4327 Cedar Jacksonville 875 Lake Ci Stockholm 5306 maple Seiling 1096 Eight Des Moines 403 Elm Cir Orchard 1078 Fourt Harmon 3956 Eight Byron 4 Object connect No such signal org freedesktop UPower DeviceRemoved QDBusObjectPath Go to the tab Page and create new page if it not exists There are some possible types of page For now We will use Standard Page or Extended page for commercial version Click on the combobox select appropriate page type and then click on the button Add new page Add Title band to the page and set correct size by mouse dragging on a blue handle or by setting a correct size in the Property Editor Now place Memo tem to the center of the ban
4. Reportinterface reportObject cuteReport gt loadReport file test gtrp amp err if error exit with message if IreportObject QMessageBox critical this loadReport err return making of the test model QStringList list list lt lt 171111 lt lt 2222 lt lt 333 lt lt 44 lt lt Ha model new QStringListModel model gt setStringList list Warning Link to model passed as longlong Set model name the same you have set in the ModelDataset before reportObject gt setVariableValue modell qlonglong model making report preview window CuteReport ReportPreview preview new CuteReport ReportPreview cuteReport if reportObject set core and set preloaded report preview gt setReportCore cuteReport preview gt connectReport reportObject report processing preview gt run Demi kilna lis Drama nin CRANN li P review WINQOW SNOW preview gt show While rendering the data model will be cloned since QAbstractitemModel is not thread safe
5. The variable name should be written in such way my_variable without spaces between rounding signs and within variable name There are 2 recommended way to go if you want to give your variable some complex name like my super duper variable First way is to replace spaces with sign And second way is to remove spaces and use capital letter on the begin of every word within variable name Internally script engine use special named object to represent global variables So using _ in begin of your variable name is highly not recommended Once you declared you global variable in the script it will be automatically added to the report variable list if it is not still exist there Lets try it Open new empty report go to the Script tab and enter Stest Now switch to the Reports tab You will see your variable in the variable list and could test your script by assigning any test value for the variable aA O O Invoice 1 Cute Report H o y URL it reports invoice_1_test qtrp Variables Name Value Name Invoice 1 test Author Author Description Options Storage Renderer Printer Renderer variables Renderer engine has its own variables and the full list of variables depends of the renderer itself There is a list of some variables e LINE current dataset line starting from 1 PAGE current page number starting from 1 PAGES total pages require report double pass PASSES report pass number TPAGE c
6. Title E Demo Company Phone 555 555 5555 E OS summary Sum ae 1234 Main Street E Mail companyi democompany com PONS order per summary_1 Su an Ashland KY 41102 Web http www ksoftware net Sales Rep forder sales_representa Bill Ta Ship To Sa a customer hirstname customer lasiname custornar fhirstiname customer lasinamea customer address customer address customer city customer state customer z customer ciby customer state customer z ty l y 1 objectN memo 38 ena bled true Cty Price Line total try 71 5 0 0 pem q Sliem pri e geome OAOE bits ee frame 0 i opacity 1 0 ii Not code E Sha z rotation oo rder note IC ni order note e r borderP en on a ars borderT Middle E qty backgro l Payment Details EH price jorder payment details S total E order 5 d order id kd Shipping kk Tax S order tax Subtotal S order subte pos 201 00 92 50 rect 171 46 0 00 8 00 23 54 Key to Page Editor Features module bar with Page Editor activated page bar page tool bar drop down list of bands drop down list of items zooming buttons magnets enabling disabling rise lower item Font editor alignment editor border editor Object inspector property editor property description Workspace i Se ee A PPP RPP EP UM Bb UNP O Page E
7. and wool The Camel is one the most unique mammals on the planet Dog Dogs are thought to have been First domesticated in East Asia thousands of years ago People primarily used dogs for guarding the hunters and areas of land Todays domestic dog is actually a subspecies of the gray wolf a type of dog that is feared by most humans Many people today in all countries around the world keep dogs as household pets and many even regard their dog as a family member Doesn t look good right Some of the descriptions were cut off Sure we can simply change the description Memo s height to Fit largest text but there are some disadvantages e paper wasting since we will not use entire Memo s room for small text e you newer know how long text will be or it can be changed in future e itjust doesn t look pretty Go ahead and fix it set Memo property stretchMode to ActualHeight set Detail property stretchable to true and generate report again Capybara The Capybara is a large semi aquatic rodent that is found inhabiting the water logged regions of Central and South America Closely related to other South American rodents such as Chinchillas and Guinea Pigs the Capybara is the largest rodent in the world weighing up to 75kg and measuring nearly 1 4 meters long Despite their enormous size though these mammals have adapted well to life in the water and have a number of distinctive characteristics that aid their amphibious lifes
8. core instance CuteReport ReportCore reportCore new CuteReport ReportCore 0 0 false create report preview widget CuteReport ReportPreview preview new CuteReport ReportPreview parentWidget assign report core to our preview preview gt setReportCore reportCore loading report template from file and creating of report object CuteReport Reportinterface reportObject reportCore gt loadReport git report qtrp connect created report object to the preview preview gt connectReport reportObject show preview widget preview gt show start report rendering preview gt run Usually you need only one ReportCore instance in your application Any number of Preview widget can be assigned to the core Datasets Model Dataset Model Dataset is designed to print model s data inherited from QAbstractitemModel From an application For printing data some steps are necessary e Create Model Dataset in your report e Inthe field Model name type in any name for your model IF there are some they should be different e For the report testing you can fill test model with the data using any number of columns and rows All set For printing your report you have to pass your model address as longlong to the report using report parameters For example CuteReport ReportCore cuteReport new CuteReport ReportCore load report QString err CuteReport
9. gt Save Report Save current report template Report gt Save Report As Save current report template with another file name Ctrl EW Report gt Close Report Close current report template Del Delete current item Mouse controls Operation Description Left button Select object paste new object move or resize selected object Right button Select object paste new object move or resize selected object with assigning new parent item at the mouse button leave position Left double click Open object s helper Mouse wheel Scroll report page Ctrl left button Add remove object from selection group Script Editor module 000 Scripting Cute Report Report Edit Page Service Tools Help print Start function memo test 4 memoitem text data getValue name Var max 255 xk F Datasets var min 8 i var r Math floor Math random max min 1 min q var g Math floor Math random max min 1 min l var b Math floor Math random max min4 1 4min memoitem backgroundBrush new QBrush new QColor r g b Vou can switch to the Script Editor bv pressing the Script button on the module bar Script editor is a prettv simple module and contains an editor with svntax highlighting and Validate button Validation checks only the syntax correctness of your script and does not actually run the script So even if your script passed validation it still ca
10. is one of only two species of Penguin found on the Antarctic mainland the other being the much larger Emperor Penguin The Adelie Penguin was named in 1840 by French explorer Jules Dumont d Urville who named the Penguin for his wife Adelie Adelie Penguins have adapted well to life in the Antarctic as these migratory Birds winter in the northern pack ice before returning south to the Antarctic coast for the warmer summer months Baboon The Baboon is a medium to large sized species of Old World Monkey that is found in a variety of different habitats throughout Africa and in parts of Arabia There are five different species of Baboon which are the Olive Baboon the Guinea Baboon the Chacma Baboon the Yellow Baboon and the Hamadryas Baboon which differs most from the others wide it s bright red face and diff dwelling lifestyle the other Four species are collectively known as Savanna Baboons However there is some debate over the classification of the different species Camel The Camel also known as the Dromedary Camel the Arabian Camel and the One Humped Camel is a large hoofed animal that is most commonly found in the hot deserts of Northern Africa and the Middle East Thought to have been first domesticated by native people more than 5 000 years ago these hardy animals have proved vital to the survival of humans in these areas as they are not just used for transporting both people and goods but also provide a good source of milk meat
11. is the most commonly used storage It has only few options root folder and ask for rewrite Root folder is the upper directory accessible to user Ask For rewrite option is used to detect if it is needed to show dialog for overwrite file GIT storage Standard GIT This type of storage can be used to keep all reports and theirs objects in local or remote GIT version control system It has such options e remote url git repository url e login password credentials to access git repository e local path local directory where git repository will be cloned to e git binary git console binary CuteReport uses external git binary to operate git repository so it has to be defined e sync now button button for cloning or pulling data from a remote repository Resource storage Standard Resource All objects stored in this storage will be included to report s template file SQL Storage Standard SQL This storage is designed to help you easy save and load report templates and report objects from SQL databases without writing any code in your application Just provide info about the database and correct data table and Field where the reports or object are stored Datasets As it was mentioned before Dataset is an object that contains structured data organized into rows lines with one or more columns fields Dataset can Fetch data from any source and it provides common interface to the data There are some datasets provided in
12. swimming Interestingly enough the common name of the Capybara is thought to mean Master of the Grasses whilst it s scientific name comes from the Greek word for water hog by traders where the African Wild Cats the ancestors of all domestic Cats lived in their native habitats Abyssinian Cats are most easily identified by their ticked fur which gives their coat a mottled appearance Adelie Penguin The Adelie Penguin is the smallest and most widely distributed species of Penguin in the Southern Ocean and is one of only two species of Penquin found on the Antarctic mainland the other being the much larger Emperor Penguin The Adelie Penguin was named in 1840 by French explorer Jules Dumont d Urville who named the Penguin for his wife Adelie Adelie Penguins have adapted well to life in the Antarctic as these migratorv Birds winter in the northern pack ice before returning south to the Antarctic coast for the warmer summer months Baboon The Baboon is a medium to large sized species of Old World Monkev Vellow Baboon and the Hamadrvas Baboon which differs most from the others wide it s bright red face and cliff dwelling lifestvle the other four species are collectivelv known as Savanna Baboons However there is some debate over the classification of the different species due to the fact that some have been known to interbreed indicating that thev could be sub species instead Baboons are incrediblv sociable and intellige
13. system with different settings Like one GIT server with read only access and one GIT server with full access In this case you can create 2 storage objects of type GIT and set appropriate parameters to each of them All storages in the CuteReport have theirs own unique name based on a storage schema So 2 created objects with type GIT will have names git_1 and git_2 Any name can be changed to any desired string but it still should be unique CuteReport core will not allow you to assign already used name To get access to the object on the storage you will use path in URL style like file 1 file path image file jpg where File_1 is the storage name and jfile path image file jpg path to the file located on the storage It is possible to assign default storage in the Designer Option dialog using Tools gt Options gt Storage so any file name with unspecified storage name will pass to the default storage There are 2 kind of storage with different priorities global storages and report s internal storages When CuteReport engine meets storage url by first it checks internal report storages then global storages and then default storage So if you have well specified storage destination and options for your report add it to report internally in the module tab Reports Your report will always use this storage not regarding of the global storage settings File System storage Standard Filesystem FileSystem
14. the basic CuteReport edition SQL Dataset CSV Dataset FileSystem Dataset Model Dataset All of them Fetch data from different sources Datasets e SQL Dataset Standard SQL It provides an interface to Fetch data from an SQL database It can work with any database supported by Qt itself ie that has Qt database driver There are some settings to connect to a remote database like mysql postgresql or to use embedded database file like sqlite e CSV Dataset Standard CSV It provides an interface to a data stored in a file and separated by comma or other predefined symbol It can load data from an external file every time when populated or load and cache the data internally e Filesystem Dataset Standard Filesystem It provides an interface to Fetch information from a File system and show disks Files and directories information as a row structured data There are some options Filtering recursion level max number of exposed records This dataset can be used to make goods list photo catalogs etc e ModelDataset Standard Model It is used to export prepared data from a custom application to a report object IF you have widget like QTableView or QTableWidget or your custom filtered sorted model you can easily print data stored in there using this dataset Try to play with each of the dataset to understand how they work You can fetch data and see it in table by pressing Test it button Data from all dataset is exposed to scriptin
15. CuteReport User Manual version 1 0 Table of Contents INEFO GUCCI OM a i iia es 3 LICENSING onite A RA 4 DD CSI GIN CD sissa ORANE IEA sea na AE E SA ta aa SI tu a nezlin LT 5 Report EGICOF NOUS o sata ta ta mbeddaascesausbeagvodentacasscoseiateessasanet snes 6 Page EQILOF MODA a i 8 SEDE EIC IO GUC site SAS A As 11 Datos e Edil Or TMOG IC a A Ba ta aa cdta 12 Preview IMO QUO as 13 Desig emOP ct 6 i is i a ee eee ee 14 Creating Report template nia 15 ROP OPE ODESSA A A AS A E 16 Helo World Feporbexamplen dw sidi bi b ii ova 17 Memo OD Es A aa TA DD ta EC ta adu ii nin at ta OED 18 ROLOUN ereas ias 18 He A Bly ef OS A EE EE E tit e a 19 EX DIOS 5 OFS cco i A a ali 19 TOKE F OWN es a l Tg A 20 Memo TAC DCL AN a 21 O 23 5109 30 a AA tw 24 File System storage SEANAAIA FILCSYSEOM ccccccsscccsssccsssccssssccssscccsssscssssssssccesssccssscssssscessssscssssecssssessesssssssoceesees 24 GEStOrage Standard aii A ar eludes ENA 24 Resource storage Standard Resource id 24 SOE Storagerstandara SO laa O AA tits 24 DUES CES da AAA AAA AD AAA AAA AAA AA uaaneetantaons 26 CUStOoMerList examples ant ala 27 a 9 A ENE A EAA ENOO EEA 30 ReDo WIH NGOS Mu A ada dao 31 MUEFUNCa text CISD OY ra iaa dife ida 33 TOUW aD OF ODE rats SA A ASA A a 35 COMPLE WIAD PI A A A cad 35 Capa b p a A 37 MUIEIEDGQONEOPON U sia e A l t at ta A A AT id i e ka ta a 39 SErIpEENQIN iia a tA a a OER 40 SG PE Or A AAA AAA a a ke 41
16. Designer create new report template using Report gt Create Report go to the Page editor using left tab panel and create new page Since any item can be placed only on carrier band we must place any band first Click on the button Bands LB and select any simple band for example Page Header Click somewhere on the page to place this band Then click on the button with the title Items or icon lt gt and select Memo T There is also Extended Memo item exists in the professional version that extends functionality of the basic Memo Use any of them if you have both After selecting Memo item click somewhere inside Page Header to place selected Memo The object will be placed at the mouse position Depending of your local settings Memo Helper dialog will appear immediately or you can double click on the Memo to show this dialog Type Hello World and then click Ok button AAA Memo Extended Text x Hello World W OK Cancel Now Report template is completed To generate actual report select in main menu Service gt Run or press F5 on your keyboard Designer will be switched to the Preview tab and rendered report page with Hello World will appear Rendered report can be printed or exported to one of the supported export formats Memo object The Memo object has many great features to draw text It can draw text in a frame and can be filled with some color The text can be displayed using any Font with any si
17. HTML tool bar There are 2 variants For these cases A A A Memo Extended yx x This is out text data name Formated Source R Y This is out text data OK Cancel OK Cancel Use HTML controls like in any HTML editor Also use can use direct HTML tags to compose required HTML code in the tab Source All changes made there will be immediately reflected in the Formatted tab You can mix HTML code with expressions without any limitation except limitation to use correct expression delimiters that do not interfere with HTML tags IF your installation has installed additional modules that provide additional Functionality you will see buttons on the top In our example we have Expression Editor installed IF you press the button ix Expression Editor form will appear It has some tabs and represent variables Functions methods that can be used to compose expression qee Variables Functions w 7 System variables E fe LINE fe PAGES fe PASS fe TPAGE fe TPAGES Description Syntax Example Returns current page number starting from 1 Expression PAGE WI Cancel Other Memo properties qe os Variables Functions fe valueOf w Mathematical abs fe acos fe asin fe atan fe atan2 Math abs 7 25 Result 7 25 Expression Math abs 10 stretchMode object stretchability to Fit text e showStretchability do stretching not only on rendered pa
18. It would be good to fill this space with a text To do this we will add new Memo item under the current description Memo disable stretching for First Memo Instead we set property flowTo for our second Memo object memo 2 to memo_1 It should look like there data name data description Our rendered result Capybara The Capybara is a large semi aquatic rodent that is found LS inhabiting the water logged regions of Central and South y America Closely related to other South American rodents such f as Chinchillas and Guinea Pigs the Capybara is the largest rodent in the world weighing up to 75kg and measuring nearly 1 4 meters long Despite their enormous size though these i mammals have adapted well to life in the water and have a number of distinctive characteristics that aid their amphibious lifestyle including the webbed skin between their toes which is particularly helpful when swimming Interestingly enough the common name of the Capybara is thought to mean Master of the Grasses whilst it s scientific name comes from the Greek word for water hog It is much more pretty Isn t it Memo Helper Using Property Editor to change Memo s text or expression is not the only way You can use Memo helper It is useful to enter large text or compose expression or HTML formatting To show Memo helper double click on your Memo item Depending of Memo s allowHTML dialog will be having or not having
19. SSC OCS O EA A kt a a Ni 42 SCHIDE VOLIQDICS si a a a a E T A ES 43 Local S FIPEVARI AD ES izid tivi e a ai t ao 43 Globalreport S VARADOS AA AA AAA B o B 43 Renderer VARI DS ais 43 SON 5 e 6 ALS a a d RFE TE 45 USING in ustom GDDUICQUION iii i eb i a 47 Project SEEN UP sisien pe e iia 48 Enmibedded UDC assi A l Ma A A E ava 48 Standalone Tame WOT ki eks ad ta st so i d a IA A a 48 SIMPE DN A 49 Custom appu atlof exa Dl dd di 50 DAA CES SAA A SA A 51 MOTE DIAS e NS to Ti 52 Introduction CuteReport is a report solution based on Qt4 Framework and it can be easily used with any Qt application In general CuteReport consists of two parts core library and template designer Both are totally modular and theirs Functionality can be easily extended by writing additional modules It s totally abstract of used data and can use as storage file system database version control systems etc The project s goal is to provide powerful but yet simple to use for inexperienced users and report designers report solution Key Features A number of data sources SQL database Text File System external data model QAbstractitemModel Various tvpes of storages to keep report templates and report objects like picture database template File System GIT SQL database embedded storage Plain text or HTML support Variety of drawing elements to construct great looking reports Memo Image Barcode Arc Chart Chord Ellipse Line P
20. amiliar with this language Script Objects All report objects is accessible From a script by theirs name For example if you have Memo object named memo_1 and want to set its color you can do it by such way memo 1 backgroundBrush new QBrush new QColor 665544 memo 1 color new QColor Qt red All object properties that you can see in the Property Editor can be managed through a script Some objects support several types of property like stretchMode in Memo object There are 2 types enum and string Use whatever you like memo 1 stretchMode DownStretch memo 2 stretchMode Memo ActualHeight Script variables Every object or value stored in a script as variable You can create your own variables on report start and change their values while report is rendering Scripting engine can have some internal variable that can be accessible For user Local script variables Variables can be declared and used locally within a script Once declared script variable can have value assigned to it Here you can see an example var myVar Hello World When you have variable created you can use it in any report object for example in Memo by writing myVar in the text property For more detailed information about script variables read documentation for JavaScript language Global report s variables Any global variable that is defined in a report could be accessed from a script
21. contains report description You can use these fields depends of you needs they are not used by report engine On the left side 4 as we mentioned above there is variable table Variables name appears there automatically if they are mentioned somewhere in report objects To test this behavior switch to Script tab and type there S test without brackets We will review Script module later For now we can switch back to the Report Editor module and see how new variable test appears in the variable table Now you can assign any value to the variable You also able to change this value direct from your application Usually you need to assign any temporary value to all variable to be able to test report template separately from your application Next is Options This frame shows all embedded objects of storage printer or renderer type along with theirs parameters You might want to use embedded objects in case your report template is used on some computers with different access or settings or to avoid user interaction For example you are creating report template for special printer and do not want to show printing dialog and provide ability to user to change printer settings Use embedded printer object with all predefined parameters Or you might want to integrate company logo direct to report template instead of loading it from disk every time report is rendered You can add Resource storage and save your logo in there It can be helpfu
22. d and set a correct geometry as well Now double click on the Memo and type Customer List and then press Ok To make this text centered click on the Memo s TextFlags property in the Property Editor and enable AlignHCenter flag Next step is adding Detail band to the page and joining it to our customer dataset To do that activate the Band by clicking on it and type data in the band s property dataset Entered text data is the name of our dataset You can change the name of any dataset by double clicking on the dataset tab in the Dataset Editor Now it s time to add some Memo items to the band number first name second name address city zip code To make item arrangement more easy you can enable magnets by pressing magnet buttons on the top of the Page Editor If you want to change name of the object and make it more understandable in the Object Inspector go to Property Editor and change objectName to something like memoFirstName memoLastName memoAddress and go on We do not use these names in this example but it can be useful for you later Next is adding instruction to our Memos what to display Go to the First one double click on it and type LINE in the Helper s editor As it was explained before means expression borders and the LINE text is an internal variable that keeps current dataset row number Press F5 and you will see how it works Now return back to the Page Editor by clicking on Pages on modu
23. d theirs short description e PageHeader displays all nested items on the top of the page e PageFooter displays all nested items on the bottom of the page e Title displays all nested items on the report begin e Summary displays all nested items on the report end e Detail must be joined to a dataset and it displays all nested items on every dataset iteration e DetailHeader must be joined to a dataset and can be shown on every dataset iteration or when condition property calculated as true It can be used to show header for group of lines e DetailFooter must be joined to a dataset and can be shown on every dataset iteration or when condition property calculated as true It can be used by the same way as detailHeader but at the bottom of the group e Overlay can be located anywhere on a page without respecting any layouts Can be used as carrier band for Foreground background watermarks Storages Now we review another class of report elements Storage is a structure that keeps all data used in a report such as images templates databases etc CuteReport provides some standard types of storage File System GIT resource Database Certainly you are familiar with some or all of them Further we will review each storage detailed but for now lets review common aspects of storage class In the CuteReport you can create any number of instances of each type It is useful if you have some remote systems that stores reports or one
24. ditor module is responsible for making of report page templates It provides tools For managing page bands and items To activate Page Editor press the Pages tab on the modules bar 1 Page bar 2 shows all pages in a report You can use it to switch between pages mouse left click or to rename the current selected page mouse left double click There are some buttons on the page s tool bar 3 to provide some basic actions for a page create new page delete current page and clone current page Next go 2 buttons with drop down lists First one is for band selection and the second one for item selection After that you can see some buttons for zoom operations and the next 4 buttons for enabling disabling page magnets If magnets are enabled the mouse pointer will stick to the other item s borders with the coordinates that are close to the cursor s coordinates Sticking range factor can be changed in the page s property magnetRate Page Editor has some other tools to change item s properties such as font editor alignment editor border editor On the right side of the page widget you can see Object Inspector All items that page contains are represented there as an item tree You can switch between items using Object Inspector or by clicking an item on a workspace area 12 Property Editor is the next element to review There are all editable properties that a page has By pressing a property name you can see a Short property description
25. e changes rapidly from the scorching hot days to the cooler nights However although they would have once been found freely roaming the Arabian deserts they are today extinct from the wild but the domestic population is widespread and numerous As you can see stretchMode do the work There are all options e DontStretch do not stretch the object e ActualHeight stretch the height of the object to Fit all assigned text e MaxHeight stretch the height of the object to reach bottom of the band Text wrap of objects commercial version only Sometimes you might want to develop report design that requires text wrapping around other objects It can be Image or table This is simple challenge with CuteReport Simply add one new Memos where text should flow to For the second Memo set property flowTo with the name of the first Memo where is text begin For example if First Memo has name memo_1 set second Memo property flowTo to memo 1 Property StretchMode for the First Memo should be set to DontStretch and for the second one to ActualHeight That s it data name data description text continue here Now lets render this template and see how it looks Capybara The Capybara is a large semi aquatic rodent that is found inhabiting the water and have a number of distinctive characteristics that aid their amphibious lifestyle including the webbed skin between their toes which is particularly helpful when
26. er item is printed on a page Also any item can have its own signals You can see full signal list along with signal description in a Propertv Editor Renderer signals Signal Name reportStart bandBefore CuteReport Bandinterface band bandAfter CuteReport BandInterface band bandGemetryAfter CuteReport BandInterface band itemBefore CuteReport BaseltemInterface item temAfter CuteReport Baselteminterface item temGeometryAfter CuteReport Baselteminterface item datasetBefore CuteReport Datasetinterface dataset datasetAfter CuteReport Datasetinterface dataset datasetlteration CuteReport Datasetinterface dataset pageBefore CuteReport Pagelnterface page pageAfter CuteReport Pagelnterface page FormBefore CuteReport Forminterface dataset Description emitted after report started emitted before band rendering emitted after band is rendered emitted when band s geometry is managed emitted before item rendering emitted after item is rendered emitted after item s geometry managed emitted before dataset processing emitted after dataset processed emitted on every dataset iteration emitted before template page processing emitted after template page processing emitted before form is shown Signal Name Description FormAfter CuteReport Forminterface dataset emitted after Form is closed reportDone emitted after report rendering is done Using in custom appl
27. f wasted paper To optimize the space we will set a number of columns that will Fit all our labels It can be done using columns page property Set it to 3 in the Property Editor on the right side of the screen Then press F5 to generate report Customer list 1 Ximena 7 Carolyn 13 Waylon Garrett London Hardison 2278 Second Street 990 Hill Street 1078 Fourth South ILLI ILL Paramus Metaline Falls Harmon 7843 67901 86432 Jaunita B Tia 14 Ankti Johnson Bergman Vanwinkie 5505 Park Boulevard 4327 Cedar Avenue 3956 Eighth Circle Drummond Jacksonville 8 14 Bvron 73124 76320 94321 Calista Bradv Baskin James 2017 Seventh Street 875 Lake Circle 1 a Boca Raton Stockholm 94765 98347 There are 2 types of column filling Vertical and Horizontal that can be set via fillDirection Page property On the picture above you can see Vertical type that means any next label will be printer under the previous one and so on while there is empty space exist in the column When there is no space report will create a new column and start from the top Horizontal type means every next label will be printed on the right of the previous one while there is enough space on the right side of the page If there is no space report will print next label on the next row as you can see below Customer list 1 Ximena Garrett 2278 Second Street Paramus 7843 Tyra Marcotte
28. g engine and can be used by any report object To get data from dataset where it s allowed you can use datasetname fieldname or datasetname getValue Fieldname expression First form is just shortening of the second one Every short form replaced by Full form internally before script execution For detailed information about each dataset see chapter Datasets Further we will see how to connect dataset to a band and how to use dataset s data Customer List example Now we will create our second report and will learn how to use datasets For that we will use test sqlite database named business db By first create new empty report by pressing main menu gt Report gt New Report Then go to the Datasets tab click on the dataset names combobox and select SQL Now you have one SQL dataset in your report Lets set correct parameters for the dataset Click File When Open database file dialog appears make sure you have correct storage name selected in the Storage combobox locate database File named business db and choose it Now you should have field Database Filled with something like File dataset db Since we have no host user and password for this database we will skip these fields Choose SQLITE driver in the Available Drivers list and press lt lt to copy driver name to the field Driver Now we can connect to out test database Lets write a simple SQL query to test it select from customer
29. ge but on Designer s Page Editor as well Description Syntax Example OK Cancel e expressionDelimiter two strings separated by comma which means the begin and the end of scripting block e stretchFont set automatic font size to fit Memo text within Memo width Bands Bands are designed for dynamic or static positioning of items on a page Each band has its own position and Functionality CuteReport has some special bands designer to represent data from a dataset Dataset contains structured data organized into rows lines which have one or more columns fields To print data from datasets CuteReport uses these special bands named Detail To make it work add one or more such bands to the page connect them to the dataset and place Memo items on them Once band is connected to the dataset Memo will have button on its right side with the drop down list of dataset s Field names commercial version only At the rendering time these bands will be printed on the rendered page Detail band usually will be printed once per dataset row DetailHeader and DetailFooter will be printed accordingly to theirs condition property IF there is no Free space to print new band on the current page new rendered page will be automatically created to continue New page will print all page headers and footers before continue to print Detail bands This process is called rendering There are some bands included into the standard package an
30. ication In this chapter you will learn how to use CuteReport in your custom application Project setting up There are 2 possible ways to use CuteReport with your custom application as a standalone framework or as an embedded framework Let s look close to the both ways Embedded library There are some important steps to use CuteReport as embedded library in the custom application e add all necessary data to your project file pro e add header files of CuteReport to your cpp file e create and init report core Add next lines to your pro File INCLUDEPATH path to CuteReport headers DEPENDPATH INCLUDEPATH LIBS Lpath_to cutereport shared files ICuteReport ICuteReportWidgets add CuteReport header files to your code include reportcore h include reportinterface h Standalone framework To use CuteReport as standalone framework you can simply install CuteReport using installer provided There are some advantages using it in this way e if you have some application installed that use CuteReport you should not update it for every application Update CuteReport and all application will use new version e you can use official CuteReport repositories and keep CuteReport up to date automatically for Linux distributions To connect CuteReport to you your application add to your pro file something like that linclude path to cutereport include directory CuteReport pri 4 error Cannot find
31. icenses visit project s web site http cute report com en article licenses Designer CuteReport solution comes with a standalone designer which helps to manage CuteReport templates CuteReport Designer itself has only few Functions and provides API to support modules Modules are used to provide and extend any current or Further designer s Functionality Module can provide GUI modules or do not provide non GUI modules user interface elements Some of the basic GUI modules are Report Editor Page Editor Script Editor Dataset Editor and Preview Each module provides its own Functionality and can be dependent of the other module s Also any module can be replaced by another with extended Functionality Lets take a look at the some of these modules Report Editor module A A A Invoice 1 Cute Report Report Edit Page Service Tools Help 1 gt i el Reports URL File home alex temp cutereport git_storage reports invoice_1 qtrp Variables Name i Li E E Name Invoice 1 order_id Pages x_____ _ oo e o F T Author Mikhalov Alexander J 4 script aa pr Description Datasets E Preview Options Storage Renderer Printer 8 e B y x Prefixes 4 Objects dk MI Assigned storages business db jiksi Selected storage Tvpe Standard Resource Default storage name III Kev to report editor features main menu modules bar open
32. ie Rectangle Picture sources static dataset storage Unlimited number of detail bands within one report Report Title and Summary Page Header and Footer Element grouping Aggregate Functions count min max avg sum Plugin system to support extending of any Functionality Application side parameters Entire application Full Featured scripting engine to manage any aspect of report rendering Measure units Millimeters Inches Pixels Standalone WYSIWYG template designer with ability to extend of any Functionality by using custom plugin Some pre installed Designer plugins Report Property editor Page editor Script editor Dataset editor Preview Multi platform Licensing CuteReport is distributed in 2 version Community version under GNU GPLv3 license to help open source developers to add reporting Functionality to theirs open source projects Core Library is provided under LGPLv2 and can be dynamically linked to proprietary products CuteReport Designer is under GPLv3 thought and can not be compiled in to proprietary products Read GPL LGPLv2 license description for more information Professional version under commercial license to provide high level support and high level bug Fixing and feature implementing priority Also commercial package provides some CuteReport extensions that open source version doesn t have In this documentation such features marked as Professional version only To review commercial l
33. ilesvstem Standard Model accordingly Read description for each dataset below To delete the current dataset press button 3 When you have set all the options for the created dataset you can press the Test it button 5 and check if everything correct All datasets have a common interface and provide data as a table Each dataset has its own configuration widget 6 Preview module 400 Invoice 1 Cute Report Report Ed age sD Tools Help o ot bi ree Sid a ine be y jim Invoice A softwa re Invoice No 1056 11 Account C1003 Date 03 01 2015 Demo Company Phone 555 555 5555 Due By 03 15 2015 Terms Mone 1234 Main Street E Mail company democompany com PO No PO1234 Ashland KY 41102 Web http www ksoftware net Sales Rep Mark Twain Bill To Ship To Ximena Garrett Ximena Garrett 2278 Second Street 2278 Second Street Paramus NJ 7843 Paramus NJ 7843 Code Title Line total SP1001 super Product 1 Compact Disk 100 SP1002 super Product 2 Compact Disk 99 Notes An invoice note can go here Multiline notes are supported like you may see in this example iJ fee Poymeant Natal Type QRegExp is not implemented filterRegExp property will be empty Key to Preview features module bar with Preview activated rendering start stop button Fit page to view button group zooming button group page navigation export to File print rendered page TA ee The job of the Pre
34. it is set to true image will always keep original aspect ratio while scaling e Center IF it is set to true image will always be centered in its frame Report with Images In this chapter we will learn how to use an Image object and a File System storage Let s create anew report add a new page add Title and Detail band Next is creating File System dataset Go to Datasets tab choose Standard FileSystem and click it Choose any directory that contains some pictures by pressing Select dir button Set maxNumber to 6 This is maximum records that dataset will Fetch Disable Flags Directories All Directories Add Filter jpg png or any other graphic formats you want Set Path appearance to AbsolutePath so we will be able to load picture using its absolute path Now press Test it As aresult you should see the list contains 6 files or less with the File Format you have set in your Filter Now go to the Page Editor Add Memo object to the Title band type there Customer s pictures and make text centered For the better appearance change backgroundBrush for the Title Set backgroundBrush style to SolidPattern and backgroundBrush color to 688482 Now change text color Click on the Memo and change property textColor to white Well done Now we are starting to create image frame Set height of the Detail to 30mm Add Image object to the right side of the Detail and change its size to fit to the detail Set so
35. ks before text rendering so any of your expression delimiters will be cut off from your text Do not use the Same symbol set as the begin and the end sign Text Flowing Text flow feature available in the professional CuteReport version It allows you to wrap text of objects Let s make a simple example to demonstrate this Feature Here is our template to show a list of animals along with its descriptions memo 1 data name data description When we render our example we will have such result Capybara The Capybara is a large semi aquatic rodent that is found 7 q Sey inhabiting the water logged regions of Central and South A America Closely related to other South American rodents such 574 as Chinchillas and Guinea Pigs the Capybara is the largest AN rodent in the world weighing up to 75kg and measuring nearly 1 4 meters long Despite their enormous size though these HE mammals have adapted well to life in the water and have a number of distinctive characteristics that aid their amphibious lifestyle including the webbed skin between their toes which is particularly helpful when swimming Interestingly enough the common name of the Capybara is thought to mean Master of the Grasses whilst it s scientific name comes from the Greek word for water hog Abyssinian Th Albiianiniaza Cab in bho mb ben LQ ana AE BRA n2lodannb hen nae AF A VA There is noticeable emptv space below the image
36. l to distribute CuteReport templates common with all theirs resources in one file There are 5 buttons for each list type add object remove object set object as default clear defaults rename selected object As you can guess add and remove responsible for adding and removing object to from report template Default object of any type means it is will be used if you do not specify object name For example you can load object in your report using Full URL File home user images logo png or just home user images logo png if you have set default storage Bear in mind that you will have an error if you do not specify object name and do not have created default object Should be mentioned that object type specified by module name and has representation as SetName ModuleName Standard module set is Standard Commercial version has set name Extended You can have third party sets as well with theirs own names For example standard SQL storage has name Standard SQL At the same time extended SQL storage will have name Extended SQL Page Editor module neee m _ Invoice 1 Cute Report Report Edit Page rvice e a gt Y AA 4 ARA PIT el 20 are Reports i aco E ja fi U se E Goa tell tall Fa El E all a sl fa 13 14 19 20 1 T page Extended P h title Title detail Detail 1 memo 34 E T memo 35 E T memo 36 E p i ee i Datasets i F E semi KESE iii title 1
37. le tab bar and Fill the memo with the customer s first name Add text data Firstname to this Memo Users of the CuteReport commercial version can simply click on the gray button that appears on the right side of the Memo as you can see here data firstname lil ISi d firstname lastname address city state zipcode This drop down list contains all the Fields in the dataset Memo related to It works only For Memos located on bands that have property dataset filled and the Filled dataset exists and properly initiated Do the same for all other items and set correct dataset Field to draw Press F5 and you should see something like this Customer list x lt 3 3 tu Garrett 2278 Second Street Paramus 7843 Jaunita n 5505 Park Boulevard Drummond 73124 Calista Baskin 2017 Seventh Street Boca Raton 94765 6745 Fifth Cirde Steve Neeley 793 Main Street Edward 76348 Vida Brock 395 Sixth Cirde Wrightsboro 89372 Carolyn London 990 Hill Street Metaline Falls 67901 Tia Bergman 4327 Cedar Avenue Jacksonville 76320 Brady James 875 Lake Circle Stockholm 98347 ia Bohanno 10 Al n Oo ern a in Aa tu ra 1 Andeana Pratt 1096 Eighth Boulevard Des Moines 10345 12 Ellens Vanmeter 403 Elm Cirde Orchard 80632 1 13 Waylon Hardison 1078 Fourth Boulevard Harmon 3956 Eighth Circle IF you don t have such result you can load report CustomerList gtrp from the CuteReport package and figure out what yo
38. lti line text In the previous chapter we have learned how to make new report create dataset and connect dataset to a band So lets do it e create new empty report e add a new SQL dataset and use test sqlite dataset animals db which you can find along with the CuteReport distribution or take it there https github com AlFox CuteReport_examples tree master datasets e add Detail band e put 2 Memos on the band first is the animal name second one is the animal description e put Image item to the right side of the band Now lets look closer how to create Dataset When you have added SQLdataset point it to your animals db file set Driver SQLITE and add the sql query select from animal Press Test it and check if all Fine Below you can see how it should finally look 3 Database git datasets animals db File Extended Options Host User Password Driver QSQLITE lt lt Available Drivers QSQLITE v select from animall When this part is completed go back to the Page Editor and set correct Fields to display For the Memo s The First topmost Memo is an animal name So double click it and type data name Users of the commercial version can simply click on the appeared button on the right side of the Memo and choose field from the drop down list If it doesn t appear check if your band is connected to the correct dataset i e dataset under the Memo has Filled field dataset Set Bold te
39. n contain runtime errors Usually you can see errors list by pressing the green button in the status bar on the bottom of the Designer window If there are errors exist in the script the button becomes red Script Editor uses javascript as a scripting language Dataset Editor module qane Invoice 1 Cute Report Report a jk Servi ools O TA tal J W Tes Database res business db File Extended Options Host l User o Password Driver QSQLITE Available Drivers QSQLITE select customer 6 from orders left join customer on customer id orders customer_id where orders id order_id T Preview T 6 Key to Dataset Editor features modules bar with Dataset Editor activated datasets bar create new dataset buttons delete current dataset test dataset dataset helper A a eS You can switch to Dataset Editor by pressing the Dataset button on the module bar 1 All created datasets of the current report are shown on the dataset bar 2 Using this bar you can switch between datasets mouse click or rename the current dataset mouse double click For creating a new dataset press combobox 3 and choose a dataset type you want Basic distribution provides 4 datasets CSV dataset SQL dataset File System Dataset and Model dataset These modules have names Standard CSV Standard SQL Standard F
40. nt animals that are known to form close bonds with other members of the troop that often last for life Thev are also incrediblv adaptable animals but their population numbers are declining throughout their natural range primarily due to hunting and habitat loss For this example we have set textFlag propertv to AlignJusifv It is not necessarv to set text Flags to all Memos so set them only for the first one Every subsequent Memo inherits this setting Complex wrapping Making complex wrapping is not really much complicated Take a look at the next example data description data name As you may notice there are 3 Memo objects that used to Fit text First in the middle top contains text data description Second one is laying under the Title memo and covers left and central part Third one is located on the bottom under all other objects Its height is set to minimal since for some short texts it will not be used So we do not need space wasting Every next Memo joined to the previous one by setting property flowTo The property stretchMode of the last item is set to ActualHeightb First two items do no need to stretch so theirs property is set to DontStretch Press F5 to render and voila The Capybara is a large semi aquatic rodent Capybara that is found inhabiting the water logged regions of Central and South America Closely related to other South American rodents such as Chinchillas and Guinea Pigs the Ca
41. nter in the northern pack ice before returning south to the Antarctic coast for the warmer summer months The Baboon is a medium to large sized species of Old World Monkey that is found in a variety of different habitats throughout Africa and in parts of Arabia There are five different species of Baboon which are the Olive Baboon the Guinea Baboon the Chacma Baboon the Yellow Baboon and the Hamadryas Baboon which differs most from the others wide it s bright red face and cliff dwelling lifestyle the other four species are collectively known as Savanna Baboons However there is some debate over the classification of the different species due to the fact that some have been known to interbreed indicating that they could be sub species instead Baboons are incredibly sociable and intelligent animals that are known to form close bonds with other members of the troop that often last for life They are also incredibly adaptable animals but their population numbers are declining throughout their natural range primarily due to hunting and habitat loss The Camel also known as the Dromedary Camel the Arabian Camel and the One Humped Camel is a large hoofed animal that is most commonly found in the hot deserts of Northern Africa and the Middle East Thought to have been first domesticated by native people more than 5 000 years ago these hardy animals have proved vital to the survival of humans in these areas as they are not just used for transp
42. orting both people and goods but also provide a good source of milk meat and wool The Camel is one the most unique mammals on the planet and has adapted perfectly to life in the desert where food and water can often be scarce and the temperature changes rapidly from the scorching hot days to the cooler nights However although they would have once been found freely roaming the Arabian deserts they are today extinct from the wild but the domestic population is widespread and numerous You do not have to care about object insertion order you can add Memo objects to report page in arbitrary order Once you set correct flowTo name all is done CuteReport is smart enough to understand what do you want and it hides all routine work from your sight Enjoy Label printing commercial version only In this chapter we will see how to create report with columns using CuteReport That can be useful to print labels or so Let s create a simple report containing customer labels to print out on customer case folders Below you can see this example Customer list Lil data Firstname data lastname data address data city 05072006 data zipcod And after rendering we have the following Customer list 1 Ximena Garrett 2278 Second Street Paramus 7843 Jaunita Johnson 5505 Park Boulevard Drummond 73124 Calista Baskin As you can see there is a lot of wasted space on the right side therefore a lot o
43. pybara is the largest rodent in the world weighing up to 75kg and measuring nearly 1 4 meters long Despite their enormous size though these mammals have adapted well to life in the water and have a number of distinctive characteristics that aid their amphibious lifestyle including the webbed skin between their toes which is particularly helpful when swimming Interestingly enough the common name of the Capybara is thought to mean Master of the Grasses whilst it s scientific name comes from the Greek word for water hog The Abyssinian Cat is thought to be one of the oldest breeds of domestic Cat in the world as the first domestication of the Abyssinian Cat occurred in Ancient Egyptian times It is thought that Abyssinian Cats were bought and sold on the banks of the River Nile by traders where the African Wild Cats the ancestors of all domestic Cats lived in their native habitats Abyssinian Cats are most easily identified by their ticked fur which gives their coat a mottled appearance The Adelie Penguin is the smallest and most Adelie Penguin widely distributed species of Penguin in the Southern Ocean and is one of only two species of Penguin found on the Antarctic mainland the other being the much larger Emperor Penguin The Adelie Penguin was named in 1840 by French explorer Jules Dumont d Urville who named the Penguin for his wife Adelie Adelie Penguins have adapted well to life in the Antarctic as these migratory Birds wi
44. reports There is main script in a report that control everything from report starting till it s rendered Some items like Memo or Barcode are supporting script in their text properties Usually scripting expression have to be framed by so the scripting engine will know that this is a script and not regular text But to some fields where only script expressions is allowed it can be written without Some items can reimplement to use something else and provide additional field to define script expression borders like expDelimiter in a Memo object Script Editor CuteReport Designer has a module named Script Editor to work with script You can find Script Editor by pressing Script tab in the module panel O 31mvoid DBusMenuExporterPrivate addAction QAction int O Om Already tracking action under id 17 List of the shortcut keys which can be used in the Script Editor Key Description Cursor arrows move cursor position PageUp PageDown go to previous next page Ctrl PageUp go to beginning of the text Ctrl PageDown go to end of the text Home go to beginning of the line End go to end of the line Enter go to next line Delete delete symbol at cursor position delete selected text Backspace delete symbol to the left of the cursor Ctrl A select whole text CuteReport uses standard JavaScript syntax so please read JavaScript documentation if you are not F
45. reports tab report variables embedded report modules PA SIN Report Editor is the first module on the designer tab bar It is responsible for managing report objects and providing such report operations as load save create delete etc These operations are presented by controls on the Report Editor widget and also they are exported to the application s main menu This module can support a number of open reports at the same time and switch between them Also Report Editor manages embedded report modules like storage renderer and printer If there is no any embedded object of storage renderer or printer then the global one will be used IF you need special options for storage renderer or printer you should add object of required type to the report object and set desired object s options Report Editor has a table with global report variables and their values These values are used in rendering report process and can be set manually using this table or direct by an external application We will review how to manage report by you program later For now we will Focus on managing report using Designer There is all open report shown on the left bar 3 Use it to switch between report templates Main module view contains some fields URL name author description URL is set automatically and shows path where report is stored Name field contains report s name Author field contains report author And description as you can guess
46. s of Arabia There are five different species of Baboon which are the Olive Baboon the Guinea Baboon the Chacma Baboon the Yellow Baboon and the Hamadryas Baboon which differs most from the others wide it s bright red face and cliff dwelling lifestyle the other four species are collectively known as Savanna Baboons However there is some debate over the classification of the different species due to the fact that some have been known to interbreed indicating that they could be sub species instead Baboons are incredibly sociable and intelligent animals that are known to form close bonds with other members of the troop that often last for life They are also incredibly adaptable animals but their population numbers are declining throughout their natural range primarily due to hunting and habitat loss Camel The Camel also known as the Dromedary Camel the Arabian Camel and the One Humped Camel is a large hoofed animal that is most commonly found in the hot deserts of Northern Africa and the Middle East Thought to have been first domesticated by native people more than 5 000 years ago these hardy animals have proved vital to the survival of humans in these areas as they are not just used for transporting both people and goods but also provide a good source of milk meat and wool The Camel is one the most unique mammals on the planet and has adapted perfectly to life in the desert where food and water can often be scarce and the temperatur
47. stthewayyouere L Ti neme quttenos e Richard Clayderman tracks 19 254 max 754 avg 502 68 Total length 9543 A onora 234 4 emustHove Been ve 1 sendrom rime 342 2 oes Boom son Cs mson 268 6 amon A X Treme Extended Mix Es Opportunity Nox a pomes 2 a Tide 22 7 Aman 12 Defntve ix 269 8 Amiry atemat 839 Multi page report It is possible to create several design pages in CuteReport This feature is useful if report should contain different pages with different sizes orientations etc In this case report engine will Fully render First page and then second and so on Total number of template pages is not limited Let us look at the simple example with 2 pages where the first one is title page and the second one is report itself We will use our previous example Customer List To add new page click on the button on the Page Editor s toolbar If there are some types of page you will see drop down menu Then choose page type you want by clicking it New page will be added to icine we will add Overlay band to the middle of the page Now add Memo item to the band and enter text Customer Report in there Render report and now it should look like Customer report Script Engine In this chapter we will learn how to work with CuteReport script engine Scripting Feature brings an extremely high level of Flexibility Using script user can control almost every rending step and design really complex
48. taking locale into account Now is DATE and render report by pressing F5 on your keyboard You ll see result of the rendering something like that Now is Fri Jul 18 2014 00 44 22 GMT 0700 PDT or for DATE variable 18 07 2014 or 07 18 2014 depending of your locale Why is that so CuteReport s renderer recognizes every expression instance calculates it and replaces expression with its result Memo text can contain a number of expressions Expression can use complex arithmetic constants variables objects and theirs properties But there are some possible issues may occur if our normal text contains square brackets that do not mean to be an expression For example we want to draw array 0 Banana Entry 0 will be recognized as an expression calculated with result 0 and will placed to our text As result we will see arrayO Banana which is definitely not that we supposed to see There are 2 solutions e set allowExpressions property to false e change default square brackets to any symbols or symbol set you want in the expressionDelimiter property In the First case entire text will be recognized as a regular text without expressions In the second case expressions will be recognized using another begin sign and end sign You can use lt as begin and gt as the end but only if you don t use HTML text IF you do use HTML you might use lt as begin and gt as the end Expression detector wor
49. the CuteReport pri file Path to CuteReport pri is dependent of your distribution There is default path for most installation Linux usr include cutereport CuteReport pri Windows c Program Files CuteReport dev include CuteReport pri Second step is to include header file to your C file include lt CuteReport gt Simple example Next is creating CuteReport ReportCore instance and initing it CuteReport ReportCore reportCore new CuteReport ReportCore There are some parameters you can pass to the constructor e parent sets parent object to the CuteReport instance If it is set you should not care about CuteReport instance deletion e settings pointer to a QSettings object You can use your project s settings to allow CuteReport to save its settings and states to the file using CuteReport group The settings in this file can provide some initial info to configure CuteReport Instead of writing a lot of code to add instances like storage objects renderer objects printer objects to the report you can use custom settings We will review these settings later If QSettings pointer is not specified CuteReport will create its own ini file e interactive used to specify if report objects are static or can be changed If you develop some console application that process report templates without changing report objects you can free some resources by using false It is true by default e initLogS
50. tyle including the webbed skin between their toes which is particularly helpful when swimming Interestingly enough the common name of the Capybara is thought to mean Master of the Grasses whilst it s scientific name comes from the Greek word for water hog Abyssinian The Abyssinian Cat is thought to be one of the oldest breeds of domestic Cat in the world as the first domestication of the Abyssinian Cat occurred in Ancient Egyptian times it is thought that Abyssinian Cats were bought and sold on the banks of the River Nile by traders where the African Wild Cats the ancestors of all domestic Cats lived in their native habitats Abyssinian Cats are most easily identified by their ticked fur which gives their coat a mottled appearance Adelie Pengui The Adelie Penguin is the smallest and most widely distributed species of Penguin in the Southern Ocean and is one of only two species of Penguin found on the Antarctic mainland the other being the much larger Emperor Penguin The Adelie Penguin was named in 1840 by French explorer Jules Dumont d Urville who named the Penguin for his wife Adelie Adelie Penguins have adapted well to life in the Antarctic as these migratory Birds winter in the northern pack ice before returning south to the Antarctic coast for the warmer summer months Baboon The Baboon is a medium to large sized species of Old World Monkey that is found in a variety of different habitats throughout Africa and in part
51. u did wrong Image object Image object is designed to represent any images in the supported graphical formats Currently supported Formats BMP Windows Bitmap GIF Graphic Interchange Format JPG Joint Photographic Experts Group JPEG Joint Photographic Experts Group PNG Portable Network Graphics PBM Portable Bitmap PGM Portable Graymap PPM Portable Pixmap XBM X11 Bitmap XPM X11 Pixmap Lets look closer at this object Create a new report add a new page add an Image item There are some data sources for the Image available Static Storage Dataset Type of source is defined in sourceType property Let s review each option e Static allows you to load Image from a file and keep loaded data inside the object File must be loaded manually by pressing image property in the Property Editor e Storage allows you to load file in runtime Image property source must contain the path to the required file IF path does not contain storage name default storage will be used Property source can contain expressions For example if source is defined as File data Filename then report engine it will try to take File name from the database data and then will try to load this file from the storage with name file e Dataset allows you to load file from a dataset blob Image property source must be defined in the same way as for Storage A list of some other important properties e keepAspectRatio If
52. urceTvpe as Dataset and source as file data name As you remember everything inside the square brackets will be identified as an expression and will be replaced by the expression result So our expression Finally will be looking like file picture path picture jpg Well there is another very important thing if report loads any data in runtime it MUST have storage assigned This is done For security In some cases you may not allow user to use any storage CuteReport has So go to the Reports tab and add Standard FileSvstem storage in the Storage tab We have images path as absolute path so clean up Root folder for this storage And the last step is creating Memo item that contains file s path Add a new Memo to the left side of the Detail band and type there data Name Users of the Commercial version can simply press the button that appears when you hover mouse over the Memo Finally you report template should look like this Customer s pictures data Name Now it s time to press F5 and enjoy result Customer s pictures home alex temp cutereport git_storage objects 116521662132 home alex temp cutereport git_storage objects 1218095387_c jhomejalex temp cutereport git storage objects 57 GIF jhomejalex temp cutereport git storage objects 67 GIF home alex temp cutereport git_storage objects 914813250_jpc Multi lined text display Let s proceed further and learn how to manage mu
53. urrent page of template means number of page in designer TPAGES total pages of template means number of pages in designer starting from 1 DATE the date when report generating was started commercial version only QDate currentDate can be used instead TIME the time when report generator was started commercial version only QTime currentTime can be used instead Script Signals When you write a script it means you write main Function which is processed on the report generator s start In this Function user can create some variables initialize them or do some other preparations Vou still might want more control over report processing To make it possible almost evervone report object has signals and vou can assign vour custom slot to these signals For example vou can assign vour custom filter to Detail band and hide some bands while pass another Lets review some signals and later will see how we can use them Common item signals Signal Name Description printinit emitted when all items are preparing to be printed printReset emitted when all items are cleaned up after printing printBefore emitted before item printing All propertv changes affects original template item emitted when initial data for printed item is prepared All propertv changes affects printDataBefore only current printed item and will be reset printDataAfter emitted after all item s data is processed but before actual priniting printAfter emitted aft
54. used to display any text or graphics information Basic CuteReport objects are included to Community CuteReport edition package Some extended objects are included to Commercial package Let us Bands review object set PageHeader band located on the top of page PageFooter band located on the bottom of page Detail band that connected to dataset and processed with each dataset iteration DetailHeader band that located on top of details group DetailFooter band that located on bottom details group Title band that located before detail band s Summary band that located after detail band s Overlay band with the free accommodation can be places anywhere on page without layouts Arc item that draws arc Barcode item represents barcode Chart item that draws any kind of charts Chord items that draws chord Ellipse item that draws ellipse Image item that draws dynamic or static image in PNG JPG BMP and other Formats Line item that draws horizontal vertical or diagonal line Memo item that represents any text information plain text and HTML formats are supported Pie item that draws pie Rectangle item that draws rectangle The basic objects most commonly used are the Detail band and Memo item You will learn about their capabilities in detail later in this chapter Hello World report example This simple report example contains just one piece of information Hello World text Open CuteReport
55. view module is to display rendered reports There are some button groups to help you First is the button for rendering current report template 2 Every time you need to render or re render your report template this button will be helpful Or you can use Main Menu gt Service gt Render or just press F5 IF your report needs some time for rendering process dialog will appear To stop current rendering press this button again or press F5 When report is rendered you can change zoom by using buttons fit to page fit width zoom in zoom out 3 4 or you can set any zoom you want in percent widget To switch current page use buttons First page Previous Page Next Page Last Page or set page number direct in page number widget Finally you can print rendered report 7 or export it to a File 6 Designer Options TODO Creating Report template In this chapter we will review some general aspects of report designing We will look close on some important items and theirs properties and will make some report examples Make sure you have CuteReport installed and try to make these examples by yourself using pre installed test databases Since CuteReport is in active developing some parts of this documentation can differ from your CuteReport installation Report objects schem CuteReport Designer s Page Editor module is designed to represent report as a set of atic pages All objects are placed somewhere on a report page and they are
56. vstem determines if you need or no to see CuteReport s logs It is True by default It should be mentioned that log destinations and log levels can be configured Separately Additionally you can connect some signals to detect report exporting and rendering connect reportCore SIGNAL exportDone QString bool this SLOT slotExportDone QString bool connect reportCore SIGNAL printingDone QString bool this SLOT slotPrintDone QString bool Now When We have core created we can load a report template CuteReport Reportinterface report reportCore gt loadReport file path myreport qtrp In most cases you might want to see report preview so lets create preview widget CuteReport ReportPreview preview new CuteReport ReportPreview reportCore preview gt connectReport report By passing report pointer to the preview widget you specify what report object preview should be represented Now we can start report rendering There are some ways to do this First way is pressing button Run in the preview widget Second way is to invoke CuteReport Core method render report reportCore gt render report Third way is to invoke Preview method run You can choose any way preview gt run Custom application example Now let s do some coding To add CuteReport library to your application you can do something like this include reportcore h create report
57. xt for the animal name by clicking on the Font property in the Property Editor or by using Font editor in the tool bar Now go to the second Memo It is animal description So type or select there data description Simple huh Lets look the result and render our report press F5 Capybara The Capybara is a large semi aquatic rodent that is found inhabiting the water logged regions of Central and South America Closely related to other South American rodents such as Chinchillas and Guinea Pigs the Capybara is the largest rodent in the world weighing up to 75kg and measuring nearly 1 4 meters long Despite their enormous size though these mammals have adapted well to life in the water and have a number of distinctive characteristics that aid their amphibious lifestyle including the webbed skin between their toes which is Abyssinian The Abyssinian Cat is thought to be one of the oldest breeds of domestic Cat in the world as the first domestication of the Abyssinian Cat occurred in Ancient Egyptian times It is thought that Abyssinian Cats were bought and sold on the banks of the River Nile by traders where the African Wild Cats the ancestors of all domestic Cats lived in their native habitats Abyssinian Cats are most easily identified by their ticked fur which gives their coat a mottled appearance Adelie Pengui The Adelie Penquin is the smallest and most widely distributed species of Penguin in the Southern Ocean and
58. y rotation Memo borders will be aligned accordingly so you don t need to care about the borders OJUI NJasN 33470 IWOS UJIM 3UI PUOJIS OJUI JNJASN A IWOS UJIM dU XII 35314 OJUI JNJASN 19470 IWOS UJIM 3UI PUOJ3S Ojul JNJASN Kuan w 56 Lax co amp 23 221 ow wv 3 3 ta D0 DEE gt On uo u Mal First text line with some Mi mu Mm rr er m x FT 5 m FT EP uw o 3 m HTML tags Memo object allow most of HTML tags Tags can be placed within Memo text Tags are disabled by default For HTML tags detection set property allowHTML to true There are some examples below lt i gt Memo lt i gt lt b gt example lt b gt lt br gt E mc lt sup gt 2 lt sup gt lt br gt A lt sub gt 1 lt sub gt B lt sup gt 2 lt sup gt lt br gt this is a usual text lt font color red gt and this is a red one lt font gt lt br gt this is a usual text lt font color FF8030 gt and this is an orange one lt font gt Memo example E mc A B this is a usual text and this is ared one this is a usual text and this is an orange one Expressions Expression is one of the most important feature of Memo object It allows to display not only static text but runtime expression result as well Expressions can be mixed with a static text To learn how it works enter the text above to the Memo object Now is ODateTime currentDateTime or simplified variant with
59. ze and style All the properties can be set using Property Editor or visually with the help of the tool bar editors Here you can see some samples Shas Memo Memo Memo Memo We will make a simple example of Memo with two lines of text First text line with some very useful info Second line with some other useful info Enable Memo borders from Property Editor and resize item up to 90x30 mm using mouse or Property Editor As you can see now Memo can display not only a single line but several lines of text as well Try to reduce Memo width to 50 mm Obviously lines can not fit to the object s border and will be wrapped This is controlled by TextFlags TextWordWrap object property If itis disabled any long line will be cut short Lets play with other TextFlags and see what we can obtain First text line with some First text line with some very useful info very useful info Second line with some Second line with some other useful info other useful info other useful info First text line with some First text line with some very useful info very useful info Second line with some Second line with some other useful info other useful info First text line with some very useful info Second line with some other useful info Rotating Lets take a look at the other feature rotation Any object including Memo can be rotated to any angle in degree range 0 360 Set required angle in the Property Editor by changing propert

Download Pdf Manuals

image

Related Search

Related Contents

SEVEN STARS  DELL C3760dn  ASUS Z10PA-D8 C9113 User's Manual  NRS 1-40 - Flowserve Corporation  Philips Cable ties SWV2490H  TroublePix User Guide  Samsung DVD-V5500 User Manual  FE-4000/X-925/X-920 - Olympus  TR 125 User manual  ELISA PLATE WASHER - DIAsource Immunoassays  

Copyright © All rights reserved.
DMCA: DMCA_mwitty#outlook.com.