Home

CuteReport User Manual

image

Contents

1. A e A Invoice 1 Cute Report 1977 Servi ools O d dE sal B Tes Database res business db File Extended Options g 5 a o Host o User o Password Driver QSQLITE Available Drivers QSQLITE select customer e from orders F1 left join customer on customer id orders customer_id g where orders id S order_id Script E a u D 6 Key to Dataset Editor features e ce S modules bar with Dataset Editor activated datasets bar create new dataset buttons delete current dataset test dataset dataset helper 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 a button corresponding to required dataset type 3 Basic distribution provides 4 datasets CSV dataset SQL dataset File System Dataset and Model dataset These modules have names Standard CSV Standard SQL Standard Filesystem Standard Model accordingly Read description for each dataset below To delete current dataset press button with trash bin icon 4 When you have set all the options for the created dataset you can press the Test it button 5 and ch
2. 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 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 to disable any expression into current Memo item 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 as begin and gt as the end but only if you don t use HTML text If you do use HTML you might use 96 as begin and gt as the end Expression detecto
3. Custom application example Now let s do some coding To add CuteReport library to your application you can do something like this Finclude reportcore h create report 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 ad
4. Subtotal S order subic order 5 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 10 alignment editor 11 border editor 12 object inspector 13 property editor 14 property description 15 workspace d TD USE Em Page Editor module is responsible for making report page template 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 the report You can use it to switch between pages mouse left click or to rename current selected page mouse left double click There are some buttons on the page 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 is 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 which are closest to the current cursor coordinates Sticking range factor can be changed in the page property with name magnetRate Page Editor has some other
5. appeared dialog will be having or not having HTML tool bar There are 2 variants For these both cases ANA Memo Extended x This is out text data name Cancel ARA Memo Extended x Formated Source This is out text data OK Cancel Use HTML controls like in any other 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 the 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 appropriate additional buttons on the top In our example we have Expression Editor installed If you press the button Expression Editor form will appear It has some tabs and represent variables functions methods that can be used to compose expression AAA Memo Extended Variables Functions v Lu System variables fe LINE fe PAGES fe PASS fe TPAGE fe TPAGES Description Syntax Example Returns current page number starting from 1 Expression PAGE OK Cancel AAA Memo Extended Variables Functions fe valueOf v Mathematical fe acos fe asin fe atan fe atan2 Description Syntax Example Math abs 7 25 Result 7 25 Expression Math abs 10 OK Cancel
6. rotation Memo borders will be aligned accordingly so you don t need to care about the borders OJUI nJasn Jau3o awos u1IM aui puo2as 0Jui njasn A awos JIM aul 3X93 15114 very useful info Second line with some other useful info 0 JUI nJasn Jau3o awos UJIM aui puo3as OJUI nJasn Alan awos UJIM aul 9X9 15114 tL o u c UE E n a A JA u LL 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 b example b br 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 a red 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 taking locale into account Now is DATE
7. Extended You can have third party suites as well with theirs own names For example standard SQL storage has name Standard SQL At the same time extended SQL storage could have name Extended SQL Page Editor module gere Invoice 1 Cute Report Report Edit Pag rvice LT RON A e PT ed a 9 Bd Reports P m erri B T U ral a T El rr E EH 3 d page Extended P gt title Title X detail Detail T memo_34 E I memo_35 E T memo_36 E p em IAEA i Datasets i F E EL prear acean oniar title 1 Title q Demo Company Phone 555 555 5555 d ERE summary Sum E 1234 Main Street E Mail companyiidemocompany com PONS jorder pa summary_1 Su jme Ashland KY 41102 Web hitp www ksoftware net Sales Rep order cales representa Bill Ta Ship To em customer firstname customer lastnama customer firstname customer lastnama customer address customer address customer city customer state customer z customer city customer state custemer z obj je e ctN m e m o 38 ena bled true Cty Price Line total ES sa stoner Se a ES id fram J ES code opacity 40 Notes at rotation 0 0 ne I na boss order note num borderPen description borderT Middle ES qty backgro Payment Details E price lorder payment_details total order id Shipping 5 orde Tax S order tax
8. Focus on managing report by using Designer application There all open reports are 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 name Author field contains report author And description as you can guess contains report description You can use these fields depending of you needs They are not used by report engine On the right side 4 as we mentioned above there is parameters table Parameters are variables with an easy access from an external application Parameter variable appears there automatically if it is mentioned somewhere in scripting expression within string property of report s objects To test this behavior switch to the 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 parameter table Now you can assign any value to the parameter You are also able to change this value directly from your application Usually you need to assign any temporary value to all variables 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
9. I Prefixes 4 Objects 4 Assigned storages business db logo png Selected storage Type Standard Resource Default storage name Key to report editor features main menu modules bar open reports tab report parameters embedded report modules de 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 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 by using this table or directly by an external application You will often use this table to set default values for report parameters on testing stage before integrating it to your external application We will review how to manage report by you program later For now we will
10. case your report template is used on some computers with different access or settings or to avoid user interaction For example you create report template for a special printer and you 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 directly into report template instead of loading it From disk every time report is rendered In this case you can add Resource storage and save your logo in there It can be helpful to distribute CuteReport templates along with all theirs resources in one file There are some 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 are responsible for adding and removing object to from report template Default object of any type means it will be used if you do not specify object name For example you can load object into your report using full URL like file home user images logo png or just using 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 which object was generated by and has representation as SuiteName ModuleName Standard module suite is Standard Commercial version has suite name
11. console application that process report templates without changing report objects you can free some resources by using false It is true by default e jinitLogSystem determines if you need or no to see CuteReport s logs It is True by default IE 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 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 Choose any way you like
12. 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 ta life in the desert where Food and water can often be scarce and the temperature changes rapidly From the scorching hot days ta 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 LII data Firstname data lastname data address data city 05072006 data zipcod And after rendering w
13. max min 1 min var g Math floor Math random max min 1 min var b Math floor Math random max min 1 min memoitem backgroundBrush new QBrush new QColor r g b You can switch to Script Editor by pressing the Script button on the module bar Script editor is pretty simple module and contains an editor with syntax 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 can contain runtime errors Usually you can see error list by pressing a 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 List of controls KnaBuwa Onucanyne Cursor arrows Change cursor position PageUp PageDown Go to Previous Next page Ctrl PageUp Got to text begin Ctrl PageDown Go to text end Home Go to line begin End Go to line end Enter Go to Next line Delete Delete char in cursor position delete selected text KAiaBHuia Onucanyne Backspace Delete char left to cursor position Ctrl A Select all text Since CuteReport uses standard javascript syntax refer to JavaScript documentation if you experience difficulties with this language Dataset Editor module Report Reports Pages Datasets d Preview
14. 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 itis set to true image will always keep original aspect ratio while scaling e Center If itis 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 a new 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 Di
15. 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 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 Ehey 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 Camel the Arabian Camel and the One Humped Camel is a large hoofed animal that is mast commonly
16. tools to change item properties such as font editor alignment editor border editor On the right side of the page widget you can see Object Inspector All items belong to page are represented there as an item tree You can switch between items using Object Inspector or by clicking item on the workspace area 12 Property Editor is the next element to review There are all editable properties that page has By pressing on property name you can see a short property description 11 The Workspace 12 shows the entire page template You can add a new band or an item to your page using drag n drop functionality dragging the selected item from the 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 the 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 might have helper Sometimes it is easier way to change object s property To open objec
17. 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 Customers pictures fhame alex temp cutereport git storage obpects 11652166213 fhame alex bemp cutereport git sborage objects 1218095387 c fhame alex bemp cutereport git srorage objects ST7 GIF fhame alex bemp cutereport git sborage objects 57 GIF fhame alex bemp cutereport git sborage objects 914813250 jpc Multi lined text display Let s proceed further and learn how to manage multi line text In the previous chapter we have learned how to make new report create dataset and connect dataset to a band So lets doit e create new empty report e addanew 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 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 data name data description Now lets look closer how to create Dataset When you h
18. 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 and 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 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 Stora
19. 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 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 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 Eo Ehe 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 cliff dwelling lifestyle the other four species are collectively known as Savanna Baboons However t
20. your report template this button will be helpful As alternate variant you can use main menu action Main Menu Service Render or just press F5 on your keyboard If your report requires some time for rendering then process dialog will appear To stop current rendering process 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 by entering percent value in percent representing widget To change current page use buttons First page Previous Page Next Page Last Page or set page number directly in the page number widget Finally you can print rendered report 7 or exportit 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 used to display any text or graphics information Basic CuteReport objects are in
21. 4 meters long Despite their enormous size though these mammals have adapted well ta life in the water and have a number of distinctive characteristics that aid Eheir 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 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 parts of Arabia Ther
22. As you can see on the pictures there are available Full description syntax description one or more examples for each function By double clicking on the function name you will add it to your text expression Pay attention to sigh in some of the added functions This means itis required to type correct value of the function parameter Formatting TODO Detailed description of formatting string see in Chapter Script Engine gt Formatting Other Memo properties e stretchMode object stretchability to Fit text e ShowStretchability do stretching not only on rendered page but on Designer s Page Editor as well 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
23. CuteReport User Manual version 1 1 Mikhalov Alexander Table of Contents NT Odu C 0 Dac oco RS EL MM 3 Nie cipe CC AS A A A DA 4 AA ER 5 REDOrEEdIEOF 2 D 010 OL ES didasteuss vaste EESE OSE EE EPES E AE EE 6 Page Editor TROGUUBa mrs eisdem ion 9 SCHDEEdICOF MOTE rait oo AR cn ete e Dos vidi cem uec A ib 12 Dataset Edil Or MOQUE coton ben A th de token de oO aa c EE C DE LESE 14 Preview Module I cpu RE TEE 16 Designer O 5 6 RETENIR T T 18 Creating Report template sain ai te tte a 19 ReDOFEODIEGES aues tovt A A MI LCD M EU uoti dr 20 Helo World reDOI C exambleisd sdosdise viser erroe o cd de pauca No Ord edes co epu REA 21 Memo OD Es UA EM A DD DM C MD du UL EADEM 22 ROCA E 22 3 A BR of 6 LR ere een Ro ST Ren ee ER 23 EX PVCS SIONS nTa n cn cent n 23 TOKE F OWN EE D dais 24 Memo Hel ASA NN A a 25 A S 27 E E acaceieles conta E SE 28 SO KO OL AR tU E OPEL eT SE oia 29 File System storage SEANAAIAL FILCSYSEOM cscccssccccsssccssscccssscccsscccsssscssssssssscesssccsssscccsssscssssscssssessscssssssssesessessess 29 GirStorage Standard ia did mire be 29 Resource storage SLANAALAI RESOUSCE cecccseccscsssscssscccssscccsssccssscccssssecsssccssscsssscsessscessssscssscecessscssssssssscssssesssssens 29 SOL Stordge Standard SOL st nn roi Pied EA ne in dO A aat 29 Data CUS RER NE Fr ron prr ER 31 Customer CIS E CX GI DUC sn odie tiita 32 Image ODE sini res
24. L 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 As a result you will have something like on the picture below Cute Report B Testit Reports File Extended Options E User Password Pages Script Driver QSQLITE lt lt Available Drivers QSQLITE select From customer Datasets Preview Object connect No such signal org freedesktop UPower DeviceRemoved QODBusObjectPath Click Test it button and table with the fetched from the database data will appear If there is an error exists you will see t in the status bar bottom frame Well done Now you have dataset completed Reports Pages Script Datasets Preview firstname Ximena Jaunita Calista Tyra Steve Vida Carolyn Tia Brady Alia Andeana Ellens Waylon Ankti lastname Garrett Johns
25. age 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 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 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 Y OK Q 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 IE can draw text in a frame and can be filled with some color The text can be displayed using any font with any size and style All the properties can be set using Property Editor or visually wi
26. al version under commercial license to provide high level support and highest priority of bug fixing and feature implementing Also commercial package provides some CuteReport extensions that open source version does not have In this documentation such features are marked as Professional version only To review commercial licenses 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 basic functions and provides API to support modules Modules are used to provide and extend any current or future designer s functionality Module can provide user interface elements GUI modules 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 one with extended functionality Lets take a look at the some of these modules Report Editor module eoe Invoice 1 Cute Report Report Edit Page Service Tools Help 1 uw el S URL File home alex temp cutereport git_storage reports invoice_1 qtrp Variables Name Name Invoice 1 order id Author Mikhalov Alexander 4 Description Options Storage Renderer Printer e By x
27. argest text but there are some disadvantages e paper wasting since we will not use entire Memo s room for small text 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 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 hag 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 Ehe River Nile by traders where the African Wild Cats che ancestors of all domesti
28. ave 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 Database git datasets animals db File Extended Options Host User Password Driver QSQLITE _ lt lt Available Drivers QSQLITE v select from animal 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 text 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 bo other South American rodents such as Chinchillas and Guinea Pigs Ehe Capybara is Ehe largest rodent in the world weighing up to 75kg and measuring nearly 1
29. c 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 ina 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 othe
30. cluded 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 of 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 Designer create new report template using Report gt Create Report go to the P
31. d month name number of day in month and full year Day and month names are printed in shortened form defined in current locale It is equial to ddd MMM d yyy e Short print short date form long print long date form e dd mm yyyy date in format 23 12 2015 e dd mmm yyyy date in format 23 Nov 2015 dd mmmm yyyy date in format 23 November 2015 e hh mm time in Format 23 12 e hh mm ss time in format 23 12 01 e dd mmmm yyyy hh mm date and time in format 23 November 2015 23 12 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 You still might want more control over report processing To make it possible almost everyone report object has signals and you can assign your custom slot to these signals For example you can assign your 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 printCreatingBefore template item emitted before item printing All property changes affects original emitted when initial data for printed item is prepared All property changes printDataBe
32. dress as longlong to the report using report parameters For example CuteReport ReportCore cuteReport new CuteReport ReportCore load report QString err CuteReport Reportinterface reportObject cuteReport gt loadReport file test gtrp amp err if error exit with message if reportObject 1 QMessageBox critical this loadReport err return making of the test model QStringList list list lt lt 11111 lt lt 2222 lt lt 1333 lt lt 44 lt lt 5 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 Preview window show preview gt show While rendering the data model will be cloned since QAbstractitemModel is not thread safe
33. e 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 Ehe 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 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 l
34. e have the following Customer list 1 Ximena Garrett 2278 Second Street Paramus 1 7843 2 Jaunita Johnson 5505 Park Boulevard T HAT IT Drummond 73124 As you can see there is a lot of wasted space on the right side therefore a lot of 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 T Carolyn 13 waylon Garrett 2278 Second Street Paramus 7843 Jaunita Johnson 5505 Park Boulevard Drummond 73124 Calista Baskin London 990 Hill Street Metaline Falls 67901 Tia Bergman 4327 Cedar Avenue Jacksonville 76320 Brady James OLLI r 14 Hardison 1078 Fourth South Harmon 66433 Ankti Vanwinkie 3956 Eighth Circle Byron 94321 13 14 2017 Seventh Street 875 Lake Circle MNAM QE Boca Raton Stockholm 94765 98347 There are 2 types of column filling Vertical and Horizontal that can be set via FfillDirection 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 rig
35. e 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 J 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 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 Itis much more pretty Isn t it One of the next chapter will be specially devoted to the text flowing functionality Memo Helper Using Property Editor to change Memo 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 propery allowHTML
36. eck 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 meee Report Ed age E Tools Help 34 Se software Demo Company 1234 Main Street Ashland KY 41102 Bill To Ximena Garrett 2278 Second Street Paramus NJ 7843 Invoice 1 Cute Report 3 14 4 O gt p Phone 555 555 5555 E Mail company democompany com Web http www ksoftware net Ship To Ximena Garrett 2278 Second Street Paramus NJ 7843 Invoice Invoice No 1056 Account C1003 Date 03 01 2015 Due By 03 15 2015 Terms None PO No PO1234 Sales Rep Mark Twain Code Title Line total 5P1001 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 4 BP Matai Type QRegExp is not implemented FilterRegExp property will be empty Key to Preview features 1 module bar with Preview activated 2 rendering start stop button 3 fit page to view button group 4 zooming button group 5 page navigation 6 export to file 7 print 8 rendered page The job of the Preview module is to display rendered report pages There are some useful button groups to help you By first there is the button to start rendering process of current report template 2 Every time you need to render or re render
37. ew variable appears in the list of reports global Now you test your report by assigning any value to this variable File Edit Page Service Tools Help temp cutereport git storage invoice 1 qtrp Variables Name Type Value Invoice 1 1 order id Integer w 1 String Boolean Integer Double Date Time DateTime Mikhalov Alexander Some variable types available for external variables parameters String Boolean Integer Double Date Time DateTime In case variable is passed from external program its type will be automatically casted to one of the specified type Renderer variables Renderer engine has its own variables and full variable list depends of renderer module itself There are some of renderer variables e LINE current dataset line number starting from 1 e LINES total lines e PAGE current page number starting from 1 e PAGES total pages requires o pass report processing e PASS current report pass number e PASSES total report passes e DATE string representing current date formatted regarding application locale settings professional version only Function QDate currentDate can be used instead of this variable TIME current time professional version only Function QTime currentTime can be used instead of this variable e DATETIME datetime object that contains current date and time and can be formatted to any representation using Formatting tag Forma
38. fore affects only current printed item and will be reset printBefore emitted after all item s data is processed but before actual printing printAfter emitted after 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 Property Editor Renderer signals Signal Name reportStart bandBefore CuteReport Bandinterface band bandAfter CuteReport Bandinterface band bandGemetryAfter CuteReport Bandinterface band itemBefore CuteReport Baselteminterface item itemAfter CuteReport Baselteminterface item temGeometryAfter CuteReport Baselteminterface item datasetBefore CuteReport DatasetInterface dataset datasetAfter CuteReport Datasetinterface dataset datasetiteration CuteReport Datasetinterface dataset pageBefore CuteReport Pagelnterface page pageAfter CuteReport Pagelnterface page 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 Signal Name Description formBefore CuteReport Forminterface dataset emitted before form is sho
39. g 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 L 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 module 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 ca
40. g script user can control almost every rending step and design really complex 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 isa 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 objects All report objects are accessible from script by unique object name For example if you have Memo object with name memo_1 and you want to change its color you can doit by the next way memo 1 backgroundBrush new QBrush new QColor 665544 memo 1 color new QColor Qt red All object properties you see in Propery Editor can be manahed via script Some objects may have two or more propertyes with the same name like propery stretchMode of Memo element There are 2 types enum and string You can use any of them like memo 1 stretchMode DownStretch memo 2 stretchMode Memo ActualHeight Script variables Any object or value is stored in script as variable You can create your own custom variable on the start of report processing and then change its value
41. gan Pano Cancer 5 2 1 13 15 1 17 Just the way you are Ne me quitte pas Richard Clayderman tracks 19 max 754 avg 502 68 Total length 9543 ns a a r I in 254 Crash Boom Bang 234 EN it Must Have Been Love 533 6 Almighty 7 Mix 245 EE E Almighty Alternate 12 439 32 Opportunity Nox 659 Dressed Far Success 432 11 The Look music collection age 20f0 Multi page report IE 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 A 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 Usin
42. ges 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 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 file 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 s
43. here 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 For this example we have set textFlag property to AlignJusify It is not necessary 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 ActualHeight First two items do no need to stretch so theirs property is set to DontStretch Press F5 to render and voil The Ca
44. ht 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 2 Jaunita 3 Calista Garrett Johnson Baskin 2278 Second Street 5505 Park Boulevard 2017 Seventh Street maia Paramus Drummond Boca Raton 7843 T3124 94765 Steve Vida Neeley 793 Main Street Tyra Marcatte Brock 6745 Fifth Circle 395 Sixth Circle Springboro Edward Wrightsboro 54322 16348 69372 Carolyn B Tia Brady London 990 Hill Street Bergman James 4327 Cedar Avenue 675 Lake Circle Metaline Falls Jacksonville Stockholm 67901 T6320 98347 sn Alia 114 As dass 33 Ellas 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 Sarah You Take My Breath Am 633 Sarah You Take My Sreath au 342 4 line To Be Needed Duet wi Chris Norman tracks 12 in 243 max 633 avg 399 00 Total length 4794 3 5 7 11 EF Lu Chiquitita Ji ELM 683 EA Elvira Madigan Piano Concert NES E 56 643 96 33 2g 3 Monnaie Etre Madi
45. n see here data firstname MEN id P firstname lastname address city state zipcode TEE ET CEU TE TE UGE T 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 2278 Second Street 5505 Park Boulevard Drummond 2017 Seventh Street Boca Raton 94765 6745 Fifth Circle BOT Metaline Falls Stockholm 1006 Eighth Boulevard Des Moines 10345 Vanmeter 403 Elm Circle 1078 Fourth Boulevard 3956 Eighth Circle IF you don t have such result you can load report CustomerList qtrp from the CuteReport package and figure out what you 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
46. on Baskin Marcotte Neeley Brock London Bergman James Bohannon Pratt Vanmeter Hardison Vanwinkie Cute Report address 2278 Secon 5505 Park 2017 Seven 6745 Fifth 793 Main St 395 Sixth Ci 990 Hill str 4327 Cedar 875 Lake Ci 5306 maple 1096 Eight 403 Elm Cir 1078 Fourt 3956 Eight city Paramus Drummond Boca Raton Springboro Edward Wrightsboro Metaline Falls Jacksonville Stockholm Seiling Des Moines Orchard Harmon Byron NJ OK FL PA NC TX WA NC WI OK IA CO CA state Object connect No such signal org Freedesktop UPower DeviceRemoved QDBusObjectPath zipcode 1843 3124 94765 54322 76348 89372 67901 76320 98347 F5349 10345 80632 86432 94321 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 item to the center of the band 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 fla
47. osed 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 scripting engine and can be used by any report object To get data from dataset where it s allowed you can use datasetname fieldname lineNumber or datasetname getValue fieldname lineNumber expression First form is just shortening of the second one Every short form replaced by full form internally before script execution automatically Line number can be skipped in any form In this case current dataset line will be used For more detailed information regarding each dataset refer to 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 SQ
48. pybara is a large semi aquatic rodent CT can 7 that is found inhabiting the water logged E regions of Central and South America E 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 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 Abyssinian JP 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
49. r number of decimal digits additional char Formatting option Any component in numeric formatting can be skipped Flag has anly one effective value and it directs to print positive sign for positive values besides negative sign with negative values Number of integer digits shows minimal number of digits in integer part of value All missing digits will be filled by zero Decimal separator shows which symbol will be used as decimal separator The most u nn tl y often used symbol is dot and comma To print standard separator for current application locale settings use sign Any other non numeric symbols can be used as well for example u n Number of decimal digits determines minimal number of decimal digits after the decimal dot If this number contains is less number if digits then missed digits will be filled by zero Additional char formatting option can be followed e f fixed number of decimal digits Any extra digits will be discarded e n like above but with adding thousand group separator e m money formatting used for current application locale settins Examples 12345 6 n 7 gt 0012345 6 12345 6 Hn 7 gt 0012345 6 12345 6 Hn 4 2 gt 12345 60 12345 6 n 4 2 gt 12345 60 12345 6 Hn m gt 12345 60 rpH 12345 6032 n 4 2F 2 12345 60 12345 6032 n 4 2n gt 12 345 60 Date and time formatting options e text includes day an
50. r 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 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 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 de
51. r works 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 M 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 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 FE AE AE Escort an vases anh a Beard da anon rana am S b kL There is noticeable empty space below the image It would be good to fill this spac
52. ractltemModel Various types of storage to keep report templates and report objects such as 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 Pie 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 External 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 CuteReportis 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 provided under GPLv3 and it can not be compiled in to proprietary products Read GPL LGPLv2 license description for more information Profession
53. rectories 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 a result 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 sourceType 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 FileSystem storage in the Storage tab We have images path as absolute path so clean
54. s 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 the basic CuteReport edition SQL Dataset CSV Dataset FileSystem Dataset Model Dataset Al 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 exp
55. sign 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 i The Capybara is a large semi aquatic rodent that is Found inhabiting a the waterlogged 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 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
56. t 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 text or expression Some other editors can be available too if appropriate modules are installed Commercial version has some additional modules that are not provided for community version Control Keys Key Action Description Ctrl N Report gt New Report Create new report template Ctrl O Report gt Open Report Open report template Ctrl S Report Save Report Save current report template Report Save Report As Save current report template with another file name Ctrl W Report 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 A e e Scripting Cute Report Report Edit Page Service Tools Help j 3 3 EE _ 1 memoitem printDataBefore connect memo te B print Start function memo test 4 memoitem text data getValue name var max 255 var min 0 var r Math floor Math random
57. t to you your application add to your pro file something like that linclude path to cutereport include directory CuteReport pri 1 error Cannot find 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
58. tes IA id 35 ljeDOFDWIED BIOS ne ni Da henri ide up LE oe boletas 36 Mullr ned texE UlsDIay ssim A A A EIEEE 38 Txt WIG Of OD eE EA ia 41 COMPL EXW OPPN G AR A D SNL Un dei 42 ODA SI LARG 45 M lEEDIOO FE DO Eta A NS en adidas and als Re tl 48 SCFIDEEnglhie siano AA NA A AA AA 49 SP OD Caio it 50 LT 61 1 AVG LATE LOTS EE TE TR UE cid 51 EOCO Aa Tap CNET TOT 51 GIODOCVORIODIOS aste stus co Dado M A A AS A EE Moos ege eC 51 Renderer Variables ioina E ne sae tede enu tete ED tele e e D I FEE UE 52 FOMO CUNO A Pun HTC Tr RCM pP 53 SCHD SION CERERI T Se ule te dd oi ni 55 Using in CUSCOM APplUCA ION RE ta 57 PROJOEES CEI UDI A A dina 58 ED CGO CH lo ea A T A EA AAA A OG A 58 standalone AMO WO da 58 SIMPE CAMPOS ata 60 CUstoni GOD UCALION CXC Dia AN ie as 62 DataSet nadia 63 MOTA Belga o RF TEE 64 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 system 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 QAbst
59. th the help of the tool bar editors Here you can see some samples Memo Memo Memo Memo Memo Memo Memo Wewo Li 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 First text line with some very useful info very useful info very useful info Second line with some 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 First text line with some Second line with some Second line with some very useful info other useful info other 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 property
60. torage 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 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 login password credentials to access git repository 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 i
61. tting professional version only Any expression calculated by Script Engine can be formatted for better appearance To do that followed Format is used expression tag where expression is scripting expression and tag is formatting tag Tag should be located after the expression and it is separated from the expression by space followed by sign No other symbol after the tag is acceptable Formatting tag contains of two parts separated by percent sign 96 expression type and Formatting options Expression types and theirs codes can be e text s e numeric n e date d e boolean b Formatting options depend of the type Formatting options for text type e empty no formatting required e low case all text should be printed using low case letters Example original text Text formatted text text e u upper case all text should be printed using upper case letters Example original text Text gt formatted text TEXT e fu print first letter of any sentence in upper case Example original teext just a text gt formatted text Just a text e s print text using sentence formatting i e First letter is in upper case and period sign at the end Example original text just a text Additional text formatted text Just a text Additional text Formatting options for numeric type in general look like Flag number of integer digits decimal separato
62. while report processing Script Engine may have its own internal variables that user can access to Local variables Variables can be declared and used in script locally Once variable declared it can acquire any arbitrary value Here is an example var myVar Hello World When you have declared variable you can use it in any report s object for example Mome typing myVar in property text For more detailed information regarding JavaScript variables refer to JavaScript documentation Global variables Any global variables declared in report can be accessible from script expression Other name of global variables is parameters Variable name should be declared as S my variable without spaces in variable name within brackets It is recommended to use two variants of variable naming if the name contains some words like my super duper variable First variant is to replace spaces with underscore sign like my super duper variable Second variant is to remove spaces and use first capital letter on any word after the first one like mySuperDuperVariable Internally Script Engine uses special representation of the global variables So using in the begin of variable name highly not recommended Once variable declared it will be automatically added to the list of global variables Let us demonstrate it Open new report go to Script tab and type S test in there Now switch to the Reports tab You will see n
63. wn FormAfter CuteReport Forminterface dataset emitted after form is closed reportDone emitted after report rendering is done Using in custom application 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 And add above headers 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 CuteRepor

Download Pdf Manuals

image

Related Search

Related Contents

ガス警報器/住宅用火災警報器  MicroBlender bas débit et MicroBlender haut débit  EN-Abzüge - Wesemann GmbH  Pinça Amperimétrica de Potência Simples ou Trifásica Real RMS  Operating instructions      NP731 User Guide    Fujitsu ESPRIMO P3521  

Copyright © All rights reserved.
Failed to retrieve file