C1Report Class - To Parent Directory
Transcription
C1Report Class - To Parent Directory
Copyright © 1987-2006 ComponentOne LLC. All rights reserved. Corporate Headquarters ComponentOne LLC 201 South Highland Avenue 3rd Floor Pittsburgh, PA 15206 USA Internet: [email protected] Web site: http://www.componentone.com Sales E-mail: [email protected] Telephone: 1.800.858.2739 or 1.412.681.4343 (Pittsburgh, PA USA Office) Technical Support See Technical Support in this manual for information on obtaining technical support. Trademarks ComponentOne Reports for .NET and the ComponentOne Reports for .NET logo are trademarks, and ComponentOne is a registered trademark of ComponentOne LLC. All other trademarks used herein are the properties of their respective owners. Warranty ComponentOne warrants that the original CD (or diskettes) are free from defects in material and workmanship, assuming normal use, for a period of 90 days from the date of purchase. If a defect occurs during this time, you may return the defective CD (or disk) to ComponentOne, along with a dated proof of purchase, and ComponentOne will replace it at no charge. After 90 days, you can obtain a replacement for a defective CD (or disk) by sending it and a check for $25 (to cover postage and handling) to ComponentOne. Except for the express warranty of the original CD (or disks) set forth here, ComponentOne makes no other warranties, express or implied. Every attempt has been made to ensure that the information contained in this manual is correct as of the time it was written. We are not responsible for any errors or omissions. ComponentOne’s liability is limited to the amount you paid for the product. ComponentOne is not liable for any special, consequential, or other damages for any reason. Copying and Distribution While you are welcome to make backup copies of the software for your own use and protection, you are not permitted to make copies for the use of anyone else. We put a lot of time and effort into creating this product, and we appreciate your support in seeing that it is used by licensed users only. Please read License Agreement and Licensing sections in this manual before copying and redistributing any ComponentOne Reports for .NET files. · iii Table of Contents Welcome to ComponentOne Reports for .NET............................................................................ 1 What's New in ComponentOne Reports for .NET ..................................................................................1 Installing Reports for .NET ....................................................................................................................3 END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE..................................4 Licensing FAQs...................................................................................................................................10 Technical Support................................................................................................................................13 Redistributable Files ............................................................................................................................14 Upgrading from VSReport 8.0..............................................................................................................15 Namespaces ........................................................................................................................................15 Creating a .NET Project.......................................................................................................................17 Adding the C1Report Component to the Toolbox .................................................................................18 Migrating a C1Report Project to Visual Studio 2005 .............................................................................19 Overview...........................................................................................................................25 The C1Report Component ...................................................................................................................25 The C1Report Designer .......................................................................................................................25 The overall picture ...............................................................................................................................26 C1Report Samples ...............................................................................................................29 Visual Basic Samples ...........................................................................................................................29 C# Samples .........................................................................................................................................29 Using Reports for .NET ........................................................................................................31 Creating a Report Definition Using Code .............................................................................................31 Add Grouping and Sorting Using Code ................................................................................................38 Adding Charts to C1Reports ................................................................................................................41 Typical Usage Scenarios ......................................................................................................................46 VBScript Expressions...........................................................................................................................61 Advanced Topics .................................................................................................................................72 Using the C1Report Designer .................................................................................................83 Creating a basic report definition ..........................................................................................................84 Modifying the report layout..................................................................................................................90 Selecting, Moving, and Copying Fields.................................................................................................92 Changing Field, Section, and Report properties ....................................................................................93 Changing the data source .....................................................................................................................93 Adding fields to the report....................................................................................................................93 Linking subreports to the main report ...................................................................................................95 Grouping and sorting data ...................................................................................................................95 Previewing and printing your report .....................................................................................................97 Exporting and publishing your report ...................................................................................................97 Saving your report definition ................................................................................................................98 Managing your report definition files....................................................................................................98 Importing Microsoft Access reports ......................................................................................................98 Importing Crystal reports ................................................................................................................... 103 C1Report Task-Based Help .................................................................................................. 105 Load report definitions....................................................................................................................... 105 Load report data ................................................................................................................................ 107 Render reports (preview, print, export) ............................................................................................... 109 Display a Progress Indicator while the report renders .......................................................................... 112 Create a report with Alternating Background Color ('Greenbar') .......................................................... 112 Create a report with a Custom Paper Size ........................................................................................... 113 iv · Create a report with Unbound Images ................................................................................................ 113 Create a report with Bound Images..................................................................................................... 113 Create a report with a Watermark ...................................................................................................... 114 Create a report with CanGrow/CanShrink fields ................................................................................ 114 Control Page Breaks in a report .......................................................................................................... 115 Define and use Global Constants in a report ....................................................................................... 115 Change Page Headers dynamically..................................................................................................... 116 Create a report with a Gutter margin .................................................................................................. 116 Create reports with Charts.................................................................................................................. 116 Create reports with Custom Fields...................................................................................................... 117 Add Subtotals and other aggregates to reports ..................................................................................... 117 Add Page Headers to Subreports ........................................................................................................ 118 Retrieve Values from Subreports......................................................................................................... 118 Add Conditional Formatting to reports............................................................................................... 118 Add Running Sums to reports ............................................................................................................ 118 Add a "Continued" label to headers on page breaks............................................................................. 119 Sort report Data................................................................................................................................. 119 Create Cross-tab reports ..................................................................................................................... 120 Suppress or Force the display of Zeros ................................................................................................ 121 C1.Win.C1Report.2 Assembly.............................................................................................. 123 C1.Win.C1Report Namespace .............................................................................................. 125 C1.Win.C1Report Hierarchy.............................................................................................................. 127 AddOutlineEntryHandler Delegate .................................................................................................... 129 AnchorEnum Enumeration................................................................................................................ 129 BackStyleEnum Enumeration ............................................................................................................ 130 BarCodeEnum Enumeration .............................................................................................................. 131 BorderStyleEnum Enumeration.......................................................................................................... 132 C1Report Class.................................................................................................................................. 132 CheckBoxEnum Enumeration............................................................................................................ 187 ColumnLayoutEnum Enumeration .................................................................................................... 188 DataAccessException Class ............................................................................................................... 189 DataSource Class............................................................................................................................... 192 DialogEventArgs Class ...................................................................................................................... 204 DialogEventHandler Delegate............................................................................................................ 205 ExportFilter Class .............................................................................................................................. 206 Field Class......................................................................................................................................... 214 FieldAlignEnum Enumeration ........................................................................................................... 249 FieldCollection Class ......................................................................................................................... 250 FileFormatEnum Enumeration .......................................................................................................... 261 ForcePageBreakEnum Enumeration................................................................................................... 263 Group Class ...................................................................................................................................... 263 GroupCollection Class....................................................................................................................... 270 GrowShrinkModeEnum Enumeration................................................................................................ 278 HdrFtrEnum Enumeration................................................................................................................. 279 HtmlFilter Class ................................................................................................................................ 279 IC1ReportRecordset Interface ............................................................................................................ 291 KeepTogetherEnum Enumeration...................................................................................................... 298 Layout Class...................................................................................................................................... 298 LineSlantEnum Enumeration............................................................................................................. 310 OrientationEnum Enumeration.......................................................................................................... 311 PdfFilter Class ................................................................................................................................... 312 PictureAlignEnum Enumeration ........................................................................................................ 317 PictureScaleEnum Enumeration......................................................................................................... 318 PictureShowEnum Enumeration ........................................................................................................ 319 ReportEventArgs Class ...................................................................................................................... 320 ·v ReportEventHandler Delegate............................................................................................................ 323 ReportInfo Class................................................................................................................................ 323 RtfFilter Class.................................................................................................................................... 327 RtfLabelFilter Class ........................................................................................................................... 337 RtfTargetEnum Enumeration............................................................................................................. 341 RunningSumEnum Enumeration ....................................................................................................... 342 Section Class ..................................................................................................................................... 342 SectionCollection Class...................................................................................................................... 353 SectionTypeEnum Enumeration ........................................................................................................ 360 SortEnum Enumeration ..................................................................................................................... 361 TextDirectionEnum Enumeration ...................................................................................................... 361 TextFilter Class ................................................................................................................................. 362 TiffFilter Class................................................................................................................................... 369 XlsFilter Class ................................................................................................................................... 374 Index .............................................................................................................................. 381 What's New in ComponentOne Reports for .NET · 1 Welcome to ComponentOne Reports for .NET Reports for .NET enables you to visualize the data in your applications in the form of rich, presentationquality reports that can be previewed on your computer or published on the Web. Reports for .NET includes two main elements: the C1Report component and the C1Report Designer application. The C1Report component generates Access-style, data-based banded reports that can be rendered directly to a printer, exported to various portable formats (including HTML, PDF, and text), or rendered into preview controls such as the Microsoft PrintPreview control or the ComponentOne C1PrintPreview control. The C1Report Designer allows you to create and edit reports, or to import existing Microsoft Access reports. The Designer has a user interface that is similar to the one in Microsoft Access, so if you currently use VSView or Access, you will feel right at home with Reports for .NET. ComponentOne has a user-friendly distribution policy. We want every programmer to obtain a copy of Reports for .NET to try for as long as they wish. Those who like the product and find it useful may buy a license for a reasonable price. The only restriction is that unlicensed copies of Reports for .NET will display a ComponentOne banner every time they are loaded to remind developers to license the product. We are confident that you'll like ComponentOne Reports for .NET. If you have any suggestions or ideas for new features that you'd like to see included in a future version, or ideas about new components, please call us or write: Corporate Headquarters ComponentOne LLC 201 South Highland Avenue 3rd Floor Pittsburgh, PA 15206 • USA 412.681.4343 412.681.4384 (Fax) http://www.componentone.com What's New in ComponentOne Reports for .NET This documentation was last revised for 2006 v1 on December 13, 2005. Overview of What's New in ComponentOne Reports for .NET New properties and features have been added to Reports for .NET that allows the user more flexibility, such as improved support for images in RTF export and improved thead safety. Feature Overview Recently, there have been enhancements to Reports for .NET that allow the user more flexibility: • Document loading has been optimized to load reports faster, especially in .NET 2.0. • The Report Designer application now has added script syntax for checking and coloring scripts. 2 · Welcome to ComponentOne Reports for .NET • The CountDistinct(<x>) aggregate function has been added. Count(<x>) returns the number of non-null <x>. CountDistinct(<x>) returns the number of distinct non-null <x>. • • Support for two new parameter types in queries have been added. 1. List type. PARAMETERS EmployeeList list "1,2,3"; select * from employees where employeeid in EmployeeList; 2. Time type. PARAMETERS StartTime time "09:45"; select * from employees where shiftStart > StartTime; IListSource implementation has been added to the internal recordset class. When a DataTable or DataView is assigned to C1Report, it automatically creates a wrapper class that implements the IC1ReportRecordset interface. This wrapper class is internal and only exposes the IC1ReportRecordset interface, so there was no way to get the underlying data object back. The IListSource allows that. See the Recordset property for an example. • Reports for .NET provides better data-related error messages. When an OleDbException is thrown, the component shows the actual ConnectionString and RecordSource values used. These may be different from the original property contents because of changes made by script code or parameter replacement. • Improvements to HTML, RTF, and Text export filters. Other Recent Features Reports for .NET now has improved support for images in RTF export, which no longer relies on Clipboard and runs under ASP.NET . Reports for .NET also has improved thead safety and honors the TextDirection property in Barcode fields. Additionally, ICustomTypeDescriptor support was added to custom field editors. Class Members Below are the most recent class, properties, and methods added to the C1Report component: Member Description ReportInfo Property (C1Report class) Gets or sets a ReportInfo object containing report metadata. ParseExpression Method (C1Report class) Parses a VBScript expression in the current report context. ParseStatement Method (C1Report class) Parses a VBScript statement in the current report context. ReportInfo Class that contains report metadata. Author Property (ReportInfo class) Gets or sets the name of the person that created the report. Creator Property (ReportInfo class) Gets or sets the name of the application that created the report. Keywords Property (ReportInfo class) Gets or sets keywords associated with the report. Subject Property (ReportInfo class) Gets or sets the subject of the report. Title Property (ReportInfo class) Gets or sets the title of the report. Installing Reports for .NET · 3 Member Description Clear Method (ReportInfo class) Clears the ReportInfo object. Clone Method (ReportInfo class) Returns a copy of this ReportInfo object. ToString Method (ReportInfo class) Overriden. Returns a string that represents the current ReportInfo object. RtfTarget Property (RtfFilter class) Gets or sets the format used to export images. Below are other recent properties and settings added to the C1Report component: Member Description GrowShrinkMode Property (C1Report class) Returns or sets the logic for handling CanGrow/CanShrink fields. PictureScale Property (Field class) Returns or sets the picture scaling (see also the Picture and PictureAlign properties). PictureScale Property (Layout class) Returns or sets how the background picture is scaled. MultiFile Property (HtmlFilter class) Gets or sets whether the built-in HTML filter should break paged reports into multiple HTML files (one per page). Ean8 Enumeration Setting (BarCodeEnum Enumeration) EAN-8 barcode. EAN-8 encodes 7-digit article codes (plus one check digit created by the control). Ean13 Enumeration Setting (BarCodeEnum Enumeration) EAN-13 barcode. EAN-13 encodes 12-digit article codes (plus one check digit created by the control). RtfLabels Enumeration Setting (FileFormatEnum Enumeration) Creates RTF reports with absolutely-positioned fields. This format renders reports more accurately than the plain RTF format, and is recommended for creating label-style reports. However, note that the RtfLabels format is harder to edit than the plan RTF format and can only be previewed/printed by MS Word (it doesn't work with WordPad). Installing Reports for .NET This section describes the setup files and system requirements for Reports for .NET. It also explains how to install demonstration versions of ComponentOne products and uninstall Reports for .NET. Reports for .NET Setup Files The installation program will create the directory C:\Program Files\ComponentOne Studio.NET, which contains the following subdirectories: bin Contains copies of all binaries (DLLs, EXEs) in the ComponentOne Visual Studio.NET package. Common Contains support and data files that are used by many of the demo programs. Help Contains online documentation for all Studio components. C1Report Contains samples and tutorials for the C1Report component. 4 · Welcome to ComponentOne Reports for .NET System Requirements • Operating Systems: Windows 2000 Windows 2003 Server Windows NT 4 Windows XP, SP1, SP2 • Environments: .NET Framework 1.0 .NET Framework1.1 C# .NET Delphi Visual Basic .NET • Environments (Visual Studio 2005): .NET Framework 2.0 C# .NET Visual Basic .NET • Hard Disk Space: 31 MB of hard disk space for storage of the software • Disc Drive: CD or DVD-ROM drive if installing from CD Installing Demonstration Versions If you wish to try Reports for .NET or any of our other products and do not have a registration key, follow the steps through the installation wizard, and use the default serial number. The only difference between unregistered (demonstration) and registered (purchased) versions of our products is that registered versions will stamp every application you compile so a ComponentOne banner will not appear when your users run the applications. Uninstalling Reports for .NET To uninstall Reports for .NET, open the Control Panel and select the Add or Remove Programs. Select Reports for .NET and click the Remove button. END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE IMPORTANT-READ CAREFULLY: This End User License Agreement (this "EULA") contains the terms and conditions that govern your use of the SOFTWARE (as defined below) and imposes material limitations to your rights. You should read this EULA carefully and treat it as valuable property. I. THIS EULA. 1. Software Covered by this EULA. This EULA governs your use of the ComponentOne, LLC ("C1") software product(s) enclosed or otherwise accompanied herewith (individually and collectively, the "SOFTWARE"). The term "SOFTWARE" includes, to the extent provided by C1: 1) any revisions, updates and/or upgrades thereto; 2) any data, image or executable files, databases, data engines, computer software, or similar items customarily used or distributed with computer software products; 3) anything in END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE · 5 any form whatsoever intended to be used with or in conjunction with the SOFTWARE; and 4) any associated media, documentation (including physical, electronic and online) and printed materials (the "Documentation"). 2. This EULA is a Legally Binding Agreement Between You and C1. If you are acting as an agent of a company or another legal person, such as an officer or other employee acting for your employer, then "you" and "your" mean your principal, the entity or other legal person for whom you are acting. However, importantly, even if you are acting as an agent for another, you may still be personally liable for violation of federal and State laws, such as copyright infringement. By signifying your acceptance of the terms of this EULA, you intend to be, and hereby are, legally bound to this EULA to the same extent as if C1 and you physically signed this EULA. By installing, copying, or otherwise using the SOFTWARE, you agree to be bound by all the terms and conditions of this EULA. If you do not agree to all of such terms and conditions, you may not install or use the SOFTWARE. If you do not agree with any of the terms herewith and, for whatever reason, installation has begun or has been completed, you should cancel installation or un-install the SOFTWARE, as the case may be. Furthermore, you should promptly return the SOFTWARE to the place of business from which you obtained it in accordance with any return policies of such place of business. Return policies may vary among resellers; therefore you must comply with the return policies of your supplier as you agreed at the point of purchase. If the place of business from which you purchased the SOFTWARE does not honor a full refund for a period of thirty (30) days from the date of purchase, you may then return the SOFTWARE directly to C1 for a refund provided that such returns is authorized within the same thirty (30) days time period. To return the product directly to C1, you must first obtain a Return Authorization Number by contacting C1, and you must forward to C1 all items purchased, including the proof of purchase. The return must be postage-prepaid, and post-marked within thirty (30) days from the proof of purchase, time being of the essence. The return option to C1 is only available to the original purchaser of an unopened factory packaged item. II. YOUR LICENSE TO DEVELOP AND TO DISTRIBUTE. As provided in more detail below, this EULA grants you two licenses: 1) a license to use the SOFTWARE to develop other software products (the "Development License"); and 2) a license to use and/or distribute the Developed Software (the "Distribution License"). These licenses (individually and collectively, the "Licenses") are explained and defined in more detail below. 1. Definitions. The following terms have the respective meanings as used in this EULA: "Network Server" means a computer with one or more computer central processing units (CPU's) that operates for the purpose of serving other computers logically or physically connected to it, including, but not limited to, other computers connected to it on an internal network, intranet or the Internet. "Web Server" means a type of Network Server that serves other computers which, are specifically connected to it through either an intranet or the Internet. "Developed Software" means those computer software products that are developed by or through the use of the SOFTWARE. "Developed Web Server Software" means those Developed Software products that reside logically or physically on at least one Web Server and are operated (meaning the computer software instruction set is carried out) by the Web Server's central processing unit(s) (CPU). "Redistributable Files" means the SOFTWARE files or other portions of the SOFTWARE that are provided by C1 and are identified as such in the Documentation for distribution by you with the Developed Software. "Developer" means a human being or any other automated device using the SOFTWARE in accordance with the terms and conditions of this EULA. "Developer Seat License" means that each Developer using or otherwise accessing the programmatic interface or the SOFTWARE must obtain the right to do so by purchasing a separate End User License. 6 · Welcome to ComponentOne Reports for .NET "Source Code" shall mean computer software code or programs in human readable format, such as a printed listing of such a program written in a high-level computer language. The term "Source Code" includes, but is not limited to, documents and materials in support of the development effort of the SOFTWARE, such as flow charts, pseudo code and program notes. 2. Your Development License. You are hereby granted a limited, royalty-free, non-exclusive right to use the SOFTWARE to design, develop, and test Developed Software, on the express condition that, and only for so long as, you fully comply with all terms and conditions of this EULA. The SOFTWARE is licensed to you on a Developer Seat License basis. Developer Seat License basis means that you may perform an installation of the SOFTWARE for use in designing, testing and creating Developed Software by a single Developer on one or more computers, each with a single set of input devices, so long as 1) such computer/computers is/are used only by one single Developer at any given time and not concurrently and, 2) the user is the primary User to whom the license has been granted. Conversely, you may not install or use the SOFTWARE on a computer that is a network server or a computer at which the SOFTWARE is used by more than one Developer. You may not network the SOFTWARE or any component part of it, where it is or may be used by more than one Developer unless you purchase an additional Development License for each Developer. You must purchase another separate license to the SOFTWARE in order to add additional developer seats, whether the additional developers are accessing the SOFTWARE in a stand-alone environment or on a computer network. The license rights granted under this Agreement may be limited to a specified number of days after you first install the SOFTWARE unless you supply information required to license or verify your licensed copy, as the case may be, within the time and the manner described during the SOFTWARE setup sequence and/or in the dialog boxes appearing during use of the SOFTWARE. You may need to verify the SOFTWARE through the use of the Internet, email or telephone; toll charges may apply. You may need to re-verify the SOFTWARE if you modify your computer hardware. Product verification is based on the exchange of information between your computer and C1. None of this information contains personally identifiable information nor can they be used to identify any personal information about you or any information you store in your computer. YOU ACKNOWLEDGE AND UNDERSTAND THAT THERE ARE TECHNOLOGICAL MEASURES IN THE SOFTWARE THAT ARE DESIGNED TO PREVENT UNLICENSED OR ILLEGAL USE OF THE SOFTWARE. YOU AGREE THAT C1 MAY USE SUCH MEASURES AND YOU AGREE TO FOLLOW ANY REQUIREMENTS REGARDING SUCH TECHNOLOGICAL MEASURES. YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE WILL CEASE TO FUNCTION UNLESS AND UNTIL YOU VERIFY THE APPLICABLE SOFTWARE SERIAL KEY. You agree that C1 may audit your use of the SOFTWARE for compliance with these terms at any time, upon reasonable notice. In the event that such audit reveals any use of the SOFTWARE other than in full compliance with the terms of this EULA, you shall reimburse C1 for all reasonable expenses related to such audit in addition to any other liabilities you may incur as a result of such non-compliance. In all cases, (a) you may not use C1's name, logo, or trademarks to market your Developed Software without the express written consent of C1; (b) you must include the following C1 copyright notice in your Developed Software documentation and/or in the "About Box" of your Developed Software, and wherever the copyright/rights notice is located in the Developed Software (“Portions Copyright © ComponentOne, LLC 1991-2005. All Rights Reserved.”); (c) you agree to indemnify, hold harmless, and defend C1, its suppliers and resellers, from and against any claims or lawsuits, including attorney's fees that may arise from the use or distribution of your Developed Software; (d) you may use the SOFTWARE only to create Developed Software that is significantly different than the SOFTWARE. 3. Your Distribution License. License to Distribute Developed Software. Subject to the terms and conditions in this EULA, you are granted the license to use and to distribute Developed Software on a royalty-free basis, provided that the Developed Software incorporates the SOFTWARE as an integral part of the Developed Software in machine-language compiled format (customarily an ".exe", or ".dll", etc.). You may not distribute, bundle, wrap or subclass the SOFTWARE as Developed Software which, when used in a "designtime" END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE · 7 development environment, exposes the programmatic interface of the SOFTWARE. You may distribute, on a royalty-free basis, Redistributable Files with Developed Software only. You may not add or transfer the SOFTWARE license key to the computer where the Developed Software is installed. Users of the Developed Software may not use the SOFTWARE or the Redistributable Files, directly or indirectly, for development purposes. In particular, if you create a control (or user control) using the SOFTWARE as a constituent control, you are not licensed to distribute the control you created with the SOFTWARE to users for development purposes. 4. Specific Product Limitations. Notwithstanding anything in this EULA to the contrary, if the license you have purchased is for any of the following products, then the following additional limitations will apply: a. ComponentOne Reports for .NET Designer Edition. ComponentOne Reports for .NET Designer Edition includes at least: 1) one dynamic link library file (c1.win.c1reportdesigner.dll) known as C1ReportDesigner Component, 2) one executable file (ReportDesigner.exe) known as C1ReportDesigner Application and, 3) the Source Code of the C1ReportDesigner Application. The C1ReportDesigner Component is subject to the general terms and restrictions set forth in this EULA. The C1ReportDesigner Application is an executable file used to design and prepare reports; the C1ReportDesigner Application may be distributed, free of royalties, only in conjunction with the Developed Software. C1 hereby also grants you the right to use and to modify the C1ReportDesigner Application Source Code to create derivative works that are based on the licensed Source Code. You may distribute such derivative works, solely in object code format and exclusively in conjunction with and/or as a part of the Developed Software. You are expressly not granted the right to distribute, disclose or otherwise make available to any third party the licensed Source Code, any portion, modified version or derivative work thereof, in source code format. C1 shall retain all right, title and interest in and to the licensed Source Code, and all C1 updates, modifications or enhancements thereof. Nothing herein shall be deemed to transfer any ownership or title rights in and to the licensed Source Code from C1 to you. SOURCE CODE IS LICENSED TO YOU AS IS. C1 DOES NOT AND SHALL NOT PROVIDE YOU WITH ANY TECHNICAL SUPPORT FOR YOUR SOURCE CODE LICENSE. b. VSView Reporting Edition (ActiveX). VSView Reporting Edition includes at least one executable file listed as “VSRptX.exe” (where X indicates the version number i.e.7,8, etc.), known as “Designer.” The file "VSRptX.exe”, or any upgrade or future versions of the Designer, are subject to the restrictions set forth in this EULA and may not be distributed with your Developed Software or in any other way. c. Studio Products. You may not share the component parts of the Studio Products licensed to you with other Developers, nor may you allow the use and/or installation of such components by other Developers. 5. Updates/Upgrades; Studio Subscription. Subject to the terms and conditions of this EULA, the Licenses are perpetual. Updates and upgrades to the SOFTWARE may be provided by C1 from time-to-time, and, if so provided by C1, are provided upon the terms and conditions offered at that time by C1 in its sole discretion. C1 may provide updates and upgrades to the SOFTWARE for free or for any charge, at any time or never, and through its chosen manner of access and distribution, all in C1's sole discretion. C1 licenses certain of its separately-licensed products bundled together in a product suite, called the C1 "Studio" product line (the "Studio Products"). The exact separately-licensed products that are bundled into the Studio Products may change from time-to-time in C1's sole discretion. If the SOFTWARE is identified as a C1 "Studio" product, then the SOFTWARE is one of the Studio Products. The SOFTWARE and the Studio Products are revised from time-to-time (meaning, for example, revised with updates, upgrades and, in the case of Studio products, some times changes to the mix of products included in the bundle). To receive any such revisions to the SOFTWARE or the Studio Products, as the case may be, you must have a valid SOFTWARE license or a valid Studio subscription. Together with the Licenses, the original purchaser is granted a one-year subscription from the date of purchase. Upon expiration, you must renew your license subscription to continue to be entitled to receive SOFTWARE and/or the Studio Products revisions as the case may be. 8 · Welcome to ComponentOne Reports for .NET 6. Serial Number. With your license, you will be issued a unique serial number (the "Serial Number") used for the activation of the SOFTWARE. The Serial Number is subject to the restrictions set forth in this EULA and may not be disclosed or distributed either with your Developed Software or in any other way. The disclosure or distribution of the Serial Number constitutes a breach of this EULA, the effect of which shall be the immediate termination and revocation of all the rights granted herein. 7. Evaluation Copy. If you are using an "evaluation copy", specifically designated as such by C1 on its website or elsewhere, then the Licenses are limited as follows: a) you are granted a license to use the SOFTWARE for a period of thirty (30) days counted from the day of installation (the "Evaluation Period"); b) upon completion of the Evaluation Period, you shall either i) delete the SOFTWARE from the computer containing the installation, or you may ii) obtain a paid license of the SOFTWARE from C1 or any of its resellers; and c) any Developed Software developed with the Evaluation Copy may not be distributed or used for any commercial purpose. III. INTELLECTUAL PROPERTY. 1. Copyright. You agree that all right, title, and interest in and to the SOFTWARE (including, but not limited to, any images, photographs, animations, video, audio, music, text, and “applets” incorporated into the SOFTWARE), and any copies of the SOFTWARE, and any copyrights and other intellectual properties therein or related thereto are owned exclusively by C1, except to the limited extent that C1 may be the rightful license holder of certain third-party technologies incorporated into the SOFTWARE. The SOFTWARE is protected by copyright laws and international treaty provisions. The SOFTWARE is licensed to you, not sold to you. C1 reserves all rights not otherwise expressly and specifically granted to you in this EULA. 2. Backups. You may make a copy of the SOFTWARE solely for backup or archival purposes. Notwithstanding the foregoing, you may not copy the printed Documentation. 3. General Limitations. You may not reverse engineer, decompile, or disassemble the SOFTWARE, except and only to the extent that applicable law expressly permits such activity notwithstanding this limitation. 4. Software Transfers. You may not rent or lease the SOFTWARE. You may permanently transfer all of your rights under the EULA, provided that you retain no copies, that you transfer all the SOFTWARE (including all component parts, the media and printed materials, any updates, upgrades, this EULA and, if applicable, the Certificate of Authenticity), and that the transferee agrees to be bound by the terms of this EULA. If the SOFTWARE is an update or upgrade, any transfer must include all prior versions of the SOFTWARE. 5. Termination. Without prejudice to any other rights it may have, C1 may terminate this EULA and the Licenses if you fail to comply with the terms and conditions contained herein. In such an event, you must destroy all copies of the SOFTWARE and all of its component parts. 6. Export Restrictions. You acknowledge that the SOFTWARE is of U.S. origin. You acknowledge that the license and distribution of the SOFTWARE is subject to the export control laws and regulations of the United States of America, and any amendments thereof, which restrict exports and re-exports of software, technical data, and direct products of technical data, including services and Developed Software. You agree that you will not export or re-export the SOFTWARE or any Developed Software, or any information, documentation and/or printed materials related thereto, directly or indirectly, without first obtaining permission to do so as required from the United States of America Department of Commerce's Bureau of Export Administration ("BXA"), or other appropriate governmental agencies, to any countries, end-users, or for any end-uses that are restricted by U.S. export laws and regulations, and any amendments thereof, which include, but are not limited to: Restricted Countries, Restricted End-Users, and Restricted End-Uses. These restrictions change from time to time. You represent and warrant that neither the BXA nor any other United States federal agency has suspended, revoked or denied your export privileges. C1 acknowledges that it shall use reasonable efforts to supply you with all reasonably necessary information regarding the SOFTWARE and its business to enable you to fully comply with the provisions of this Section. If you have any questions regarding your obligations under United States of America export regulations, you should contact the Bureau of Export Administration, United States Department of END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE · 9 Commerce, Exporter Counseling Division, Washington DC. U.S.A. (202) 482-4811, http://www.bxa.doc.gov. 7. U.S. Government Restricted Rights. The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. You will comply with any requirements of the Government to obtain such RESTRICTED RIGHTS protection, including without limitation, the placement of any restrictive legends on the SOFTWARE, and any license agreement used in connection with the distribution of the SOFTWARE. Manufacturer is ComponentOne, LLC, 201 South Highland Avenue , 3rd Floor, Pittsburgh, Pennsylvania 15206 USA. For solicitations issued by the Government on or after December 1, 1995 and the Department of Defense on or after September 29, 1995, the only rights provided in the software and documentation provided herein shall be those contained in this EULA. Under no circumstances shall C1 be obligated to comply with any Governmental requirements regarding the submission of or the request for exemption from submission of cost or pricing data or cost accounting requirements. For any distribution of the SOFTWARE that would require compliance by C1 with the Government's requirements relating to cost or pricing data or cost accounting requirements, you must obtain an appropriate waiver or exemption from such requirements for the benefit of C1 from the appropriate Government authority before the distribution and/or license of the SOFTWARE to the Government. IV. WARRANTIES AND REMEDIES. 1. Limited Warranty. C1 warrants that the original media, if any, are free from defects for ninety (90) days from the date of delivery of the SOFTWARE. C1 also warrants that: (i) it has the full power to enter into this Agreement and grant the license rights set forth herein; (ii) it has not granted and will not grant any rights in the Software to any third party which grant is inconsistent with the rights granted to you in this Agreement; and (iii) the Software does not and will not infringe any trade secret, copyright, trademark or other proprietary right held by any third party and does not infringe any patent held by any third party. EXCEPT AS OTHERWISE PROVIDED IN THE PRECEDING SENTENCE, AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, C1 EXPRESSLY DISCLAIMS ANY WARRANTY FOR THE SOFTWARE, DOCUMENTATION AND ANYTHING ELSE PROVIDED BY C1 HEREBY AND C1 PROVIDES THE SAME IN “AS IS” CONDITION WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION REMAINS WITH YOU. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHERS WHICH VARY FROM STATE TO STATE. 2. Limited Remedy. C1 PROVIDES NO REMEDIES OR WARRANTIES, WHETHER EXPRESS OR IMPLIED, FOR ANY SAMPLE APPLICATION CODE, REDISTRIBUTABLE FILES, TRIAL VERSION AND THE NOT FOR RESALE VERSION OF THE SOFTWARE. ANY SAMPLE APPLICATION CODE, TRIAL VERSION AND THE NOT FOR RESALE VERSION OF THE SOFTWARE ARE PROVIDED “AS IS”. C1's entire liability and your exclusive remedy under this EULA shall be, at C1's sole option, either (a) return of the price paid for the SOFTWARE; (b) repair the SOFTWARE through updates distributed online or otherwise in C1's discretion; or (c) replace the SOFTWARE with SOFTWARE that substantially performs as described in the SOFTWARE documentation, provided that you return the SOFTWARE in the same manner as provided in Section I.2 for return of the SOFTWARE for nonacceptance of this EULA. Any media for any repaired or replacement SOFTWARE will be warranted for the remainder of the original warranty period or thirty (30) days, whichever is longer. THESE REMEDIES ARE NOT AVAILABLE OUTSIDE OF THE UNITED STATES OF AMERICA. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL C1 BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFIT, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF C1 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR 10 · Welcome to ComponentOne Reports for .NET INCIDENTAL DAMAGES IN CERTAIN CASES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. V. MISCELLANEOUS. 1. This is the Entire Agreement. This EULA (including any addendum to this EULA included with the SOFTWARE) is the final, complete and exclusive statement of the entire agreement between you and C1 relating to the SOFTWARE. This EULA supersedes any prior and contemporaneous proposals, purchase orders, advertisements, and all other communications in relation to the subject matter of this EULA, whether oral or written. No terms or conditions, other than those contained herein, and no other understanding or agreement which in any way modifies these terms and conditions, shall be binding upon the parties unless entered into in writing executed between the parties, or by other non-oral manner of agreement whereby the parties objectively and definitively act in a manner to be bound (such as by continuing with an installation of the SOFTWARE, etc.). Employees, agents and other representatives of C1 are not permitted to orally modify this EULA. 2. You Indemnify C1. You agree to indemnify, hold harmless, and defend C1 and its suppliers and resellers from and against any and all claims or lawsuits, including attorney's fees, which arise out of or result from your distribution of your Developed Software, your Developed Web Server Software or from your breach of any of the terms and conditions of this EULA. 3. Interpretation of this EULA. If for any reason a court of competent jurisdiction finds any provision of this EULA, or any portion thereof, to be unenforceable, that provision of this EULA will be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remainder of this EULA will continue in full force and effect. Formatives of defined terms shall have the same meaning of the defined term. Failure by either party to enforce any provision of this EULA will not be deemed a waiver of future enforcement of that or any other provision. Except as otherwise required or superseded by law, this EULA is governed by the laws of the Commonwealth of Pennsylvania, without regard to its conflict of laws principles. The parties consent to the personal jurisdiction and venue of the Commonwealth of Pennsylvania, in the County of Allegheny, and agree that any legal proceedings arising out of this EULA shall be conducted solely in such Commonwealth. If the SOFTWARE was acquired outside the United States, then local law may apply. Licensing FAQs This section describes the main technical aspects of licensing. It may help the user to understand and resolve licensing problems he may experience when using ComponentOne .NET and ASP.NET products. What is Licensing? Licensing is a mechanism used to protect intellectual property by ensuring that users are authorized to use software products. Licensing is not only used to prevent illegal distribution of software products. Many software vendors, including ComponentOne, use licensing to allow potential users to test products before they decide to purchase them. Without licensing, this type of distribution would not be practical for the vendor or convenient for the user. Vendors would either have to distribute evaluation software with limited functionality, or shift the burden of managing software licenses to customers, who could easily forget that the software being used is an evaluation version and has not been purchased. How does Licensing Work? ComponentOne uses a licensing model based on the standard set by Microsoft, which works with all types of components. Note: The Compact Framework components use a slightly different mechanism for licensing than the other ComponentOne components due to platform differences. Licensing FAQs · 11 When a user decides to purchase a product, he receives an installation program and a Serial Number. During the installation process, the user is prompted for the serial number that is saved on the system. (Users can also enter the serial number by clicking the "License" button on the About Box of any ComponentOne product.) When a licensed component is added to a form or web page, Visual Studio asks the newly created component for licensing information. The component looks for licensing information stored in the system and generates a key, which Visual Studio saves in two files: 1. a "<projectName>.licenses" resource file which contains the actual key and 2. a "licenses.licx" file that contains references to those resources. These files are automatically added to the project. Note that the licenses.licx file is usually not shown in the Solution Explorer; it appears if you press the "Show All Files" button in the Solution Explorer's toolbox, or select "Project | Show All Files" from Visual Studio's main menu. Later, when the component is created at run time, it gets passed the key that was created at design time and can decide whether to simply accept the key, to throw an exception and fail altogether, or to display some information reminding the user that the software has not been licensed. All ComponentOne products are designed to display licensing information if the product is not licensed. None will throw licensing exceptions and prevent applications from running. Common Scenarios Creating components at design time This is the most common scenario and also the simplest: the user adds one or more controls to the form, the licensing information is stored in the licenses.licx file, and the component works. Note that the mechanism is exactly the same for Windows Forms and Web Forms (ASP.NET) projects. Creating components at run time This is also a fairly common scenario. You do not need an instance of the component on the form, but would like to create one or more instances at run time. In this case, the project will not contain a licenses.licx file (or the file will not contain an appropriate key for the component) and therefore licensing will fail. To fix this problem, add an instance of the component to a form in the project. This will create the licenses.licx file and things will then work as expected. (The component can be removed from the form after the licenses.licx file has been created). Inheriting from licensed components If a component that inherits from a licensed component is created, the licensing information to be stored in the form is still needed. This can be done in two ways: 1. Add a LicenseProvider attribute to the component. This will mark the component as licensed. When a component is added to a form, Visual Studio will create and manage the licenses.licx file, and the base class will handle the licensing process as usual. No additional work is needed. For example: [LicenseProvider(typeof(LicenseProvider))] class MyGrid: C1.Win.C1FlexGrid.C1FlexGrid { // ... } 2. Add an instance of the base component to the form. 12 · Welcome to ComponentOne Reports for .NET This will embed the licensing information into the licenses.licx file as in the previous scenario, and the base component will find it and use it. As before, the extra instance can be deleted after the licenses.licx file has been created. Using licensed components in console applications When building console applications, there are no forms to add components to, and therefore Visual Studio won't create a licenses.licx file. In these cases, create a temporary Windows Forms application and add all the desired licensed components to a form. Then close the Windows Forms application and copy the licenses.licx file into the console application project. Make sure the licensex.licx file is configured as an embedded resource. To do this, right-click the licenses.licx file in the Solution Explorer window and select Properties. In the Property window, set the "Build Action" property to "Embedded Resource". Using licensed components in Visual C++ applications There is an issue in VC++ 2003 where the licenses.licx is ignored during the build process; therefore, the licensing information is not included in VC++ applications. To fix this problem, extra steps must be taken to compile the licensing resources and link them to the project. Note the following: 1. Build the C++ project as usual. This should create an exe file and also a licenses.licx file with licensing information in it. 2. Copy the licenses.licx file from the app directory to the target folder (Debug or Release). 3. Copy the C1Lc.exe utility and the licensed dlls to the target folder. (Don't use the standard lc.exe, it has bugs.) 4. Use C1Lc.exe to compile the licenses.licx file. The command line should look like this: c1lc /target:MyApp.exe /complist:licenses.licx /i:C1.Win.C1FlexGrid.dll 5. Link the licenses into the project. To do this, go back to Visual Studio, right-click the project, select properties, and go to the Linker/Command Line option. Enter the following: /ASSEMBLYRESOURCE:Debug\MyApp.exe.licenses 6. Rebuild the executable to include the licensing information in the application. Troubleshooting We try very hard to make the licensing mechanism as unobtrusive as possible, but problems may occur for a number of reasons. Below is a description of the most common problems and their solutions. I have a licensed version of a ComponentOne product but I still get the splash screen when I run my project. If this happens, there must be a problem with the licenses.licx file in the project. It either doesn't exist, contains wrong information, or is not configured correctly. First, try a full rebuild ("Rebuild All" from the Visual Studio Build menu). This will usually rebuild the correct licensing resources. If that fails, follow these steps: 1. Open the project and go to the Solution Explorer window. 2. Click the "Show All Files" button on the top of the window. Technical Support · 13 3. Find the licenses.licx file and delete it. 4. Close the project and reopen it. 5. Open the main form and add an instance of each licensed control. 6. Check the Solution Explorer window, there should be a licenses.licx file there. 7. Rebuild the project using the "Rebuild All" option (not just "Rebuild"). I have a licensed version of a ComponentOne product on my web server but the components still behave as unlicensed. There is no need to install any licenses on machines used as servers and not used for development. The components must be licensed on the development machine, therefore the licensing information will be saved into the executable (.exe or .dll) when the project is built. After that, the application can be deployed on any machine, including web servers. I downloaded a new build of a component that I have purchased, and now I'm getting the splash screen when I build my projects. Make sure that the license key is still valid. If you licensed the component over a year ago, your subscription may have expired. In this case, you have two options: Option 1 - Renew your subscription to get a new license key. If you choose this option, you will receive a new key that you can use to license the new components (from the installation utility or directly from the About Box). The new subscription will entitle you to a full year of upgrades and to download the latest maintenance builds directly from http://prerelease.componentone.com/. Option 2 – Continue to use the components you have. Subscriptions expire, products do not. You can continue to use the components you received or downloaded while your subscription was valid. Technical Support ComponentOne Reports for .NET Designer Edition is developed and supported by ComponentOne LLC, a company formed by the merger of APEX Software Corporation and VideoSoft. You can obtain technical support using any of the following methods: ComponentOne Web site The ComponentOne Web site at www.componentone.com provides a wealth of information and software downloads for Reports for .NET users, including: • Descriptions of the various support options available through the ComponentOne Service Team. • Answers to frequently asked questions (FAQ's) about our products, organized by functionality. Please consult the FAQ's before contacting us directly, as this can save you time and also introduce you to other useful information pertaining to our products. • Free product updates, which provide you with bug fixes and new features. ComponentOne HelpCentral ComponentOne HelpCentral is the new online resource for Visual Studio developers and Help authors. Visit HelpCentral to get information on ComponentOne products, view online demos, get Tech Tips and answers to frequently asked questions (FAQ's), search the ComponentOne knowledgebase and more! 14 · Welcome to ComponentOne Reports for .NET Internet e-mail For technical support through the Internet, e-mail us at: [email protected] To help us provide you with the best support, please include the following information when contacting ComponentOne: • Your ComponentOne product serial number. • The version and name of your operating system. • Your development environment and its version. For more information on technical support, go to: www.componentone.com/support Peer-to-Peer newsgroup ComponentOne also sponsors peer-to-peer newsgroups for C1Report users. ComponentOne does not offer formal technical support in this newsgroup, but instead sponsors it as a forum for users to post and answer each other's questions regarding C1Report. However, ComponentOne may monitor the newsgroups to ensure accuracy of information and provide comments when necessary. You can access the newsgroup from the ComponentOne Web site at http://helpcentral.componentone.com/Newsgroups.aspx. Documentation ComponentOne documentation is available with each of our products in HTML Help, Microsoft Help 2.0 (.NET, ASP.NET and Mobile Device products only), and PDF format. All of the PDFs are also available on ComponentOne HelpCentral, as well as online help that is directly viewable in your web browser. If you have suggestions on how we can improve our documentation, please email the Documentation team. Please note that e-mail sent to the Documentation team is for documentation feedback only. Technical Support and Sales issues should be sent directly to their respective departments. On-line samples The setup utility installs several samples that show how to accomplish common tasks using the ComponentOne controls. The samples are also available on-line from our samples page, which is updated frequently: http://helpcentral.componentone.com/ProductResources.aspx?View=Samples If you have samples that you would like to share with others, please post a message in the appropriate newsgroup and we will contact you. Redistributable Files ComponentOne Reports for .NET is developed and published by ComponentOne LLC. You may use it to develop applications in conjunction with Microsoft Visual Studio or any other programming environment that enables the user to use and integrate the control(s). You may also distribute, free of royalties, the following Redistributable Files with any such application you develop to the extent that they are used separately on a single CPU on the client/workstation side of the network: • C1.Win.C1Report.dll • C1.Win.C1Report.2.dll (if using Visual Studio 2005) Site licenses are available for groups of multiple developers. Please contact [email protected] for details. Upgrading from VSReport 8.0 · 15 Upgrading from VSReport 8.0 VSReport 8.0 users will have no trouble using C1Report. Although C1Report was completely rewritten in C# to take advantage of the latest .NET technologies, the object model is virtually identical to the one in VSReport 8.0. C1Report uses the same report definition files, and implements all the features you are used to, including subreports, export options including HTML/DHTML/PDF export, and much more. C1Report also includes the same powerful Report Designer that ships with VSView Reporting Edition, so creating and customizing your reports is as easy as ever. The main difference between VSReport and C1Report is how reports are rendered into preview controls: VSReport uses the VSPrinter control to provide report previewing. For example, the following line of code would render the report in vsreport1 into the vsprinter1 control: • Visual Basic vsreport1.Render(vsprinter1) • C# vsreport1.Render(vsprinter1); • Delphi vsreport1.Render(vsprinter1); C1Report exposes a PrintDocument object instead. This object can be used to print the report, or it can be attached to a preview control such as the ComponentOne C1PrintPreview or the Microsoft PrintPreview control. For example, the following line of code would render the report in c1report1 into the c1printPreview1 control: • Visual Basic c1printPreview1.Document = c1report1.Document • C# c1printPreview1.Document = c1report1.Document; • Delphi c1printPreview1.Document := c1report1.Document; C1Report event names are also different from VSReport. The events were renamed because VSReport has script-handler properties with the same name as the events. In .NET, events and properties must have different names. Aside from these differences, the controls have virtually identical object models. Both implement the RenderToFile method, which renders reports to HTML, PDF and other types of file, and both expose collections of Groups, Sections, and Fields. Namespaces Namespaces organize the objects defined in an assembly. Assemblies can contain multiple namespaces, which can in turn contain other namespaces. Namespaces prevent ambiguity and simplify references when using large groups of objects such as class libraries. The general namespace for ComponentOne Windows products is C1.Win. The namespace for the C1Report component is C1.Win.C1Report. The following code fragment shows how to declare a C1Report component using the fully qualified name for this class: • Visual Basic Dim c1rpt As C1.Win.C1Report.C1Report • C# C1.Win.C1Report.C1Report c1rpt; 16 · Welcome to ComponentOne Reports for .NET • Delphi c1rpt: C1.Win.C1Report.C1Report; Namespaces address a problem sometimes known as namespace pollution, in which the developer of a class library is hampered by the use of similar names in another library. These conflicts with existing components are sometimes called name collisions. For example, if you create a new class named Field, you can use it inside your project without qualification. However, the C1Report assembly also implements a class called Field. So, if you want to use the C1Report class in the same project, you must use a fully qualified reference to make the reference unique. If the reference is not unique, Visual Studio .NET produces an error stating that the name is ambiguous. The following code snippet demonstrates how to declare these objects: • Visual Basic ' Define a new Field object (custom Field class) Dim MyField as Field ' Define a new C1Report.Field object. Dim ReportField as C1.Win.C1Report.Field • C# // Define a new Field object (custom Field class) Field MyField; // Define a new C1Report.Field object. C1.Win.C1Report.Field ReportField; • Delphi // Define a new Field object (custom Field class) MyField: Field; // Define a new C1Report.Field object. ReportField: C1.Win.C1Report.Field; Fully qualified names are object references that are prefixed with the name of the namespace where the object is defined. You can use objects defined in other projects if you create a reference to the class (by choosing Add Reference from the Project menu) and then use the fully qualified name for the object in your code. Fully qualified names prevent naming conflicts because the compiler can always determine which object is being used. However, the names themselves can get long and cumbersome. To get around this, you can use the Imports statement (using in C#) to define an alias — an abbreviated name you can use in place of a fully qualified name. For example, the following code snippet creates aliases for two fully qualified names, and uses these aliases to define two objects: • Visual Basic Imports C1Field = C1.Win.C1Report.Field Imports MyField = MyProject.Field Dim f1 As C1Field Dim f2 As MyField • C# using C1Field = C1.Win.C1Report.Field; using MyField = MyProject.Field; C1Field f1; MyField f2; • Delphi uses C1.Win.C1Report.Field, MyProject.Field; Creating a .NET Project · 17 var f2: MyField; f1: C1Field; If you use the Imports statement without an alias, you can use all the names in that namespace without qualification provided they are unique to the project. Creating a .NET Project This topic demonstrates how to create a new .NET project. 1. From the File menu in Microsoft Visual Studio .NET, select New Project. The New Project dialog box opens. 2. Under Project Types, choose either Visual Basic or Visual C#, and select Windows Application from the list of Templates in the right pane. 3. Enter a name for your application in the Name field and click OK. A new Microsoft Visual Studio .NET project is created and a new Form1 is displayed in the Designer view. 4. Double-click the desired C1Report components from the Toolbox to add them to Form1. For information on adding a component to the Toolbox, see Adding the C1Report Component to the Toolbox (page 18). 18 · Welcome to ComponentOne Reports for .NET Adding the C1Report Component to the Toolbox After installing Reports for .NET on your computer, you need to add the C1Report component to the Visual Studio Toolbox: • C1Report In order to use this component, you must add it to the Visual Studio Toolbox: 1. Open the Visual Studio IDE (Microsoft Development Environment). Make sure the Toolbox is visible (select Toolbox in the View menu if necessary) and right-click it to open the context menu. 2. To make C1Report component appear on its own tab in the Toolbox, select Add Tab from the context menu and type in the tab name, C1Report, for example. 3. Right-click the tab where the component is to appear and select Choose Items from the context menu. Migrating a C1Report Project to Visual Studio 2005 · 19 Note: In Visual Studio 2002, select Customize Toolbox, or in Visual Studio 2003, select Add/Remove Items from the context menu. The Customize Toolbox dialog box opens and you can select the desired components as described in the next step. The Choose Toolbox Items dialog box opens. 4. In the dialog box, select the .NET Framework Components tab. Sort the list by Namespace (click the Namespace column header) and check the check boxes for all components belonging to namespace C1.Win.C1Report. Note that there may be more than one component for each namespace. Migrating a C1Report Project to Visual Studio 2005 To migrate a project using ComponentOne components to Visual Studio 2005, there are two main steps that must be performed. First, you must convert your project to Visual Studio 2005, which includes removing any references to a previous assembly and adding a reference to the new assembly. Secondly, the .licx file, or licensing file, must be updated in order for the project to run correctly. To convert the project: 1. Open Visual Studio 2005 and select File, Open Project. 2. Locate the .sln file for the project that you wish to convert to Visual Studio 2005. Select it and click Open. The Visual Studio Conversion Wizard appears. 20 · Welcome to ComponentOne Reports for .NET 3. Click Next. 4. Select Yes, create a backup before converting to create a backup of your current project and click Next. 5. Click Finish to convert your project to Visual Studio 2005. The Conversion Complete window appears. Migrating a C1Report Project to Visual Studio 2005 · 21 6. Click Show the conversion log when the wizard is closed if you want to view the conversion log. 7. Click Close. The project opens. Now you must remove references to any of the previous ComponentOne .dlls and add references to the new ones. 8. Go to the Solution Explorer (View | Solution Explorer) and click the Show All Files button. Note: The Show All Files button does not appear in the Solution Explorer toolbar if the Solution project node is selected. 9. Expand the References node, right-click C1.Common and select Remove. Also remove C1.Win.C1Report the same way. 10. Right-click the References node and select Add Reference. 11. Locate and select C1.Win.C1Report.2.dll. Click OK to add it to the project. 22 · Welcome to ComponentOne Reports for .NET To update the .licx file: 1. In the Solution Explorer, right-click the licenses.licx file and select Delete. 2. Click OK to permanently delete licenses.licx. The project must be rebuilt to create a new, updated version of the .licx file. 3. Click the Start Debugging button to compile and run the project. The new .licx file may not be visible in the Solution Explorer. 4. Select File, Close to close the form and then double-click the Form.vb or Form.cs file in the Solution Explorer to reopen it. The new licenses.licx file appears in the list of files. Migrating a C1Report Project to Visual Studio 2005 · 23 The migration process is complete. The C1Report Component · 25 Overview Reports for .NET includes two main elements: the C1Report component and the C1Report Designer application. The C1Report component generates Access-style, data-based banded reports that can be rendered directly to a printer, exported to various portable formats (including HTML, PDF, and text), or rendered into preview controls such as the Microsoft PrintPreview control or the ComponentOne C1PrintPreview control. The C1Report Designer allows you to create and edit reports, or to import existing Microsoft Access reports. The Designer has a user interface that is similar to the one in Microsoft Access. The C1Report Component The C1Report component reads report definitions stored in XML files, combines them with data from a data source, and generates reports that can be previewed, printed, or saved to files. C1Report can export reports to HTML, DHTML, PDF, and Text file formats, or render them directly into a C1PrintPreview control. You can distribute C1Report royalty-free with your applications. C1Report uses an object model largely based on Microsoft Access reports, and it supports most features found in Access reports, including: 1. A Microsoft Access-style banded-report model based on Groups, Sections, and Fields. (These objects are fully exposed by the object model, so you can write your own report designers.) 2. Fields may be bound to simple and binary (object) database fields. 3. Fields may contain VBScript expressions, including extensions for aggregate expressions (Sum, Max, Average, and so on), and have access to the control's object model. 4. Reports may contain event handlers, making them independent of the host application. 5. Reports may contain Subreports. 6. Reports may contain parameterized queries, allowing the user to constrain the data that should be included in the report. 7. Report definitions may be saved within the control at design time or loaded at run time from XML report definition files. The C1Report Designer The C1Report Designer is an application that can create, edit, load, and save report definition files. Report definition files are XML files that may contain multiple reports and can be read directly by the C1Report component. The report definition files are identical to the ones used by VSReport, the ActiveX version of C1Report. The Designer can import report definitions from Microsoft Access MDB files and from CrystalReports RPT files. Note that importing from MDB files requires Microsoft Access to be present on the computer at the time the files are imported. The Designer has a user interface similar to the Microsoft Access report designer, including a Wizard used to create new reports. The primary user of the Designer will be the developer. If you would like to distribute the designer to your end-users, you should get the C1Report Designer Edition package. This package includes the C1Report control, with unlimited distribution rights to the control itself and the report designer. The package also 26 · Overview includes the source code to the report designer, so you can customize the application or integrate it with your own product. To find out how to use the Designer, see Using the C1Report Designer (page 83). The overall picture To create reports, you start using the C1Report Designer to create report definitions. Report definitions are saved in XML files, and can be designed from scratch or imported from existing Microsoft Access reports. Next, use the C1Report component to read the report definitions and render the reports using data from any standard .NET data source. The report definitions can be loaded at design time, and embedded in your application, or they can be read and modified at run time. (You can even create report definitions from scratch, using the C1Report object model). Reports can be rendered directly to a printer, into a C1PrintPreview control, or into HTML and PDF files that can be published on the Web. The diagram below shows the relationship between the components in the Reports for .NET package. Boxes with a bold border represent code components (controls and applications). Boxes with a thin border represent files containing information (report definitions, data, and finished reports). Numbered arrows indicate relationships between components, described below: 1. Use the C1Report Designer to create, edit, and save XML report definition files. 2. The C1Report component loads report definitions from the XML files created with the Designer. This can be done at design time (in this case the XML file is persisted with the control and not needed at run time), or at run time using the Load method. 3. The C1Report component loads data from the data source specified in the report definition file. Alternatively, you can provide your own custom data source. 4. The C1Report component formats the data according to the report definition and renders reports to a printer (a), to one of several file formats (b), or to a print preview control (c). 5. Custom applications can communicate with the C1Report component using a rich object model, so you can easily customize your reports or generate entirely new ones. The C1Report Designer is a good example of such an application. The overall picture · 27 The object model for the C1Report component is summarized below. It is largely based on the Microsoft Access model, except that Access has different types of controls (label control, textbox control, line control, and so on), while C1Report has a single Field object with properties that can make it look like a label, textbox, line, picture, subreport, and so on. The table below lists all objects, along with their main properties and methods. Note: C1Report uses twips for all measurements. One twip is 1/20 point, so 72 points = 1440 twips = 1 inch). C1Report Object: the main component. ReportName, GetReportInfo, Load, Save, Clear, Render, RenderToFile, RenderToStream, PageImages, Document, DoEvents, IsBusy, Cancel, Page, MaxPages, Font, OnOpen, OnClose, OnNoData, OnPage, OnError, Evaluate, Execute Layout Object: determines how the report will be rendered on the page. Width, MarginLeft, MarginTop, MarginRight, MarginBottom, PaperSize, Orientation, Columns, ColumnLayout, PageHeader, PageFooter, Picture, PictureAlign, PictureShow DataSource Object: manages the data source ConnectionString, RecordSource, Filter, MaxRecords, Recordset Groups Collection: a report may have many groups. Group Object: controls data sorting and grouping Name, GroupBy, Sort, KeepTogether, SectionHeader, SectionFooter, Move Sections Collection: all reports have at least 5 sections. Section Object: contains Field objects (also known as "report band") Name, Type, Visible, BackColor, OnFormat, OnPrint, Height, CanGrow, CanShrink, Repeat, KeepTogether, ForcePageBreak Fields Collection: a report usually has many Fields. Field Object: a rectangular area within a section where information is displayed. Name, Section, Text, TextDirection, Calculated, Value, Format, Align, WordWrap, Visible, Left, Top, Width, Height, CanGrow, CanShrink, Font, BackColor, ForeColor, BorderColor, BorderStyle, LineSlant, LineWidth, MarginLeft, MarginRight, MarginTop, MarginBottom, LineSpacing, ForcePageBreak, HideDuplicates, RunningSum, Picture, PictureAlign, Subreport, CheckBox, RTF Every report has at least five sections, indexed as follows: Section Description 0 - vsrDetail This section contains fields that are rendered once for each record in the source recordset. 1 - vsrHeader The report header section is rendered at the beginning of the report. 2 - vsrFooter The report footer section is rendered at the end of the report. 3 - vsrPageHeader The page header section is rendered at the top of every page (except optionally for pages that contain the report header). 4 - vsrPageFooter The page footer section is rendered at the bottom of every page (except optionally for pages that contain the report footer). In addition to these five sections, there are two additional sections for each group: a group header and a group footer section. For example, a report with 3 grouping levels will have 11 sections. 28 · Overview Note that sections can be made invisible, but they cannot be added or removed, except by adding or removing groups. The diagram below shows how each section is rendered on a typical report: The first section rendered is the report header. This section usually contains information that identifies the report. After the report header comes the page header. If the report has no groups, this section usually contains labels that describe the fields in the detail section. The next sections are the group headers, detail, and group footers. These are the sections that contain the actual report data. Group headers and footers often contain aggregate functions such as group totals, percentages, maximum and minimum values, and so on. Group headers and footers are inserted whenever the value of the expression specified by the GroupBy property changes from one record to the next. The detail section contains data for each record. It is possible to hide this section by setting its Visible property to False, and display only group headers and footers. This is a good way to create summary reports. At the bottom of each page is the page footer section. This section usually contains information such as the page number, total number of pages in the report, and/or the date the report was printed. Finally, the report footer section is printed before the last page footer. This section is often used to display summary information about the entire report. You can determine whether or not a section is visible by setting its Visible property to True or False. Group headers can be repeated at the top of every page (whether or not it is the beginning of a group) by setting their Repeat property to True. Page headers and footers can be removed from pages that contain the report header and footer sections by setting the PageHeader and PageFooter properties on the Layout object. Visual Basic Samples · 29 C1Report Samples Please be advised that this ComponentOne software title is accompanied by various sample projects and/or demos, which may or not make use of other ComponentOne development tools. While the sample projects and/or demos included with the software are used to demonstrate and highlight the product’s features, and how the control may be integrated with the rest of the ComponentOne product line, some of the controls used in the demo/sample project may not be included with the purchase of certain individual products. The ComponentOne Samples are also available at http://helpcentral.componentone.com/ProductResources.aspx?View=Samples Visual Basic Samples CreateReport Create reports dynamically using code. This sample uses the C1Report control. CustomData Create custom data source objects for use with C1Report. This sample uses the C1Report and C1PrintPreview controls. Embedded Load report definitions into the C1Report component at design time. This sample uses the C1Report and C1PrintPreview controls. Newsletter Create reports without data sources (unbound reports). This sample uses the C1Report and C1PrintPreview controls. NorthWind View reports imported from the NorthWind data base. This sample uses the C1Report control. C# Samples Chart Add charts to reports using C1Report and C1Chart. This sample uses the C1Report and C1Chart controls. ChartAX Add charts to reports using C1Report and the MS ActiveX Chart control. This sample uses the C1Report control. CreateReport Create reports dynamically using code. This sample uses the C1Report control. CustomPaperSize Create reports that use custom paper sizes. This sample uses the C1Report and C1PrintPreview controls. DebitCredit N/A, there are no project files. DynamicFormat Use script properties to format the report based on its contents. This sample uses the C1Report control. 30 · C1Report Samples HierReport Create reports based on hierarchical data. This sample uses the C1Report control. ParseParameters Parse a PARAMETERS statement in a RecordSource string. This sample uses the C1Report control. ReportBrowser Open report definition files and list their contents. This sample uses the C1Report control. RTFReport Shows how to render RTF fieds in a report. This sample uses the C1Report control. SubReportDataSource Use custom data sources with subreports. This sample uses the C1Report control. XMLData Use any XML document as a report data source. This sample uses the C1Report control. ZipReport Compress and encrypt report definition files. This sample uses the C1Report and C1Zip controls. Creating a Report Definition Using Code · 31 Using Reports for .NET Although you can use Reports for .NET in many different scenarios, on the desktop and on the Web, the main sequence of steps is always the same: 1: Create a report definition This can be done directly with the C1Report Designer or using the report designer in Microsoft Access and then importing it into the C1Report Designer. You can also do it using code, either using the object model to add groups and fields or by writing a custom XML file. 2: Load the report into the C1Report component This can be done at design time, using the "Load Report" context menu, or at run time using the Load method. If you load the report at design time, it will be persisted (saved) with the control and you won't need to distribute the report definition file. 3: Render the report (desktop applications) If you are writing a desktop application, you can render the report into a C1PrintPreview control (or a Microsoft PrintPreview control) using the Document property. The preview control will display the report on the screen, and users will be able to preview it with full zooming, panning, and so on. For example: • Visual Basic c1printPreview1.Document = c1report1.Document • C# c1printPreview1.Document = c1report1.Document; • Delphi c1printPreview1.Document := c1report1.Document; 4: Render the report (Web applications) If you are writing a Web application, you can render reports into HTML or PDF files using the RenderToFile method, and your users will be able to view them using any browser. Creating a Report Definition Using Code The easiest way to create new report definitions is to use the C1Report Designer, but you can also create reports from scratch, using code. This approach requires some extra work, but it gives you complete flexibility. You can even write your own report designer or ad-hoc report generator. Note that creating a report definition is not the same as rendering a report. To render a report, you can simply load an existing definition and call the Render method. The example that follows uses Visual Basic to create a simple tabular report definition based on the NorthWind database. The code is commented and illustrates most important elements of the C1Report object model. 1. First, we initialize the control, named c1r, using the Clear method to clear its contents and set the control font (this is the font that will be assigned to new fields): • Visual Basic ' initialize control With c1r .Clear() ' clear any existing fields .Font.Name = "Tahoma" ' set default font for all controls 32 · Using Reports for .NET .Font.Size = 8 End With 2. 3. • C# // initialize control With c1r; .Clear(); // clear any existing fields .Font.Name = "Tahoma"; // set default font for all controls .Font.Size = 8; } With; • Delphi // initialize control With c1r do begin Clear; // clear any existing fields Font.Name := 'Tahoma'; // set default font for all controls Font.Size := 8; end; Next, we set up the DataSource object to retrieve the data we want from the NorthWind database. This is done using the ConnectionString and RecordSource properties (similar to the Microsoft ADO DataControl): • Visual Basic ' initialize DataSource With c1r.DataSource .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\…\VB98\Nwind.mdb;" & _ "Persist Security Info=False" .RecordSource = "Employees" End With • C# // initialize DataSource With c1r.DataSource; .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\…\VB98\Nwind.mdb;" + "Persist Security Info=false"; .RecordSource = "Employees"; } With • Delphi // initialize DataSource with c1r.DataSource do begin ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+'Data Source=C:\…\VB98\Nwind.mdb;'+'Persist Security Info=False'; RecordSource := 'Employees'; end; Next, we initialize the Layout object that defines how the report will be laid out on the page. In this case, we'll render the report in Portrait mode and set its Width to 6.5 inches (8.5 page width minus one inch for margins on either side): • Visual Basic ' initialize Layout With c1r.Layout .Orientation = OrientationEnum.Portrait .Width = 6.5 * 1440 ' 8.5 – margins, in twips End With Creating a Report Definition Using Code · 33 4. • C# // initialize Layout With c1r.Layout; .Orientation = OrientationEnum.Portrait; .Width = 6.5 * 1440; // 8.5 – margins, in twips } With • Delphi // initialize Layout with c1r.Layout do begin Orientation := OrientationEnum.Portrait; Width := 6.5 * 1440; // 8.5 – margins, in twips end; Now comes the interesting part. Every report has five basic sections: detail, report header, report footer, page header, and page footer. We'll set up the report header by setting a couple of properties and adding a title field to it. • Visual Basic ' variable used to create and format report fields Dim f As Field ' create a report header With c1r.Sections(SectionTypeEnum.Header) .Height = 1440 .Visible = True .BackColor = Color.FromArgb(200, 200, 200) f = .Fields.Add("FldTitle", "Employees Report", 0, 0, 8000, 1440) f.Font.Size = 24 f.Font.Bold = True f.ForeColor = Color.FromArgb(0, 0, 100) End With • C# // variable used to create and format report fields Field f; // create a report header With c1r.Sections(SectionTypeEnum.Header); .Height = 1440; .Visible = true; .BackColor = Color.FromArgb(200, 200, 200); f = .Fields.Add("FldTitle", "Employees Report", 0, 0, 8000, 1440); f.Font.Size = 24; f.Font.Bold = true; f.ForeColor = Color.FromArgb(0, 0, 100); } With • Delphi // variable used to create and format report fields // create a report header with c1r.Sections[SectionTypeEnum.Header] do begin Height := 1440; Visible := True; BackColor := Color.FromArgb(200, 200, 200); f := Fields.Add('FldTitle','Employees Report', 0, 0, 8000, 1440); f.Font.Size := 24; 34 · Using Reports for .NET f.Font.Bold := True; f.ForeColor := Color.FromArgb(0, 0, 100); end; The section object has a Fields collection. The collection's Add method creates a new field and assigns it to the section. The parameters specify the new field's Name, Text, Left, Top, Width, and Height properties. By default, the field has the same font as the control. Since this is a title, it makes sense to change the font and make it larger. Note that the field should be tall enough to accommodate the font size, or nothing will appear in it. 5. Next, we'll set up the page footer section. This section is more interesting because it contains calculated fields. Calculated fields contain VBScript expressions in their Text property, which are evaluated when the report is rendered. To make a field calculated, set its Calculated property to True. • Visual Basic ' create a page footer With c1r.Sections(SectionTypeEnum.PageFooter) .Height = 500 .Visible = True f = .Fields.Add("FldFtrLeft", """Employees: Printed on "" & Now", 0, 0, 4000, 300) f.Calculated = True f = .Fields.Add("FldFtrRight", """Page "" & Page & "" of "" & Pages", 4000, 0, 4000, 300) f.Calculated = True f.Align = FieldAlignEnum.RightTop f.Width = c1r.Layout.Width - f.Left f = .Fields.Add("FldLine", "", 0, 0, c1r.Layout.Width, 20) f.LineSlant = LineSlantEnum.NoSlant f.BorderStyle = BorderStyleEnum.Solid f.BorderColor = Color.FromArgb(0, 0, 100) End With • C# // create a page footer With c1r.Sections(SectionTypeEnum.PageFooter); .Height = 500; .Visible = true; f = .Fields.Add("FldFtrLeft", """Employees: Printed on "" + Now", 0, 0, 4000, 300); f.Calculated = true; f = .Fields.Add("FldFtrRight", """Page "" + Page + "" of "" + Pages", 4000, 0, 4000, 300); f.Calculated = true; f.Align = FieldAlignEnum.RightTop; f.Width = c1r.Layout.Width - f.Left; f = .Fields.Add("FldLine", "", 0, 0, c1r.Layout.Width, 20); f.LineSlant = LineSlantEnum.NoSlant; f.BorderStyle = BorderStyleEnum.Solid; f.BorderColor = Color.FromArgb(0, 0, 100); } With • Delphi // create a page footer with c1r.Sections[SectionTypeEnum.PageFooter] do begin Height := 500; Visible := True; f := Fields.Add('FldFtrLeft','"Employees: Printed on " & Now',0, 0, Creating a Report Definition Using Code · 35 4000, 300); f.Calculated := True; f := Fields.Add('FldFtrRight','"Page " & Page & " of " & Pages',4000, 0, 4000, 300); f.Calculated := True; f.Align := FieldAlignEnum.RightTop; f.Width := c1r.Layout.Width - f.Left; f := Fields.Add('FldLine','', 0, 0, c1r.Layout.Width, 20); f.LineSlant := LineSlantEnum.NoSlant; f.BorderStyle := BorderStyleEnum.Solid; f.BorderColor := Color.FromArgb(0, 0, 100); end; The page footer section uses expressions with variables that are not intrinsic to VBScript, but are defined by C1Report. Page and Pages are variables that contain the current page number and the total page count. The section also uses a field configured to look like a line. This is done using the BorderStyle and LineSlant properties. 6. Next, we'll set up the page header section. This section gets rendered at the top of every page and will display the field labels. Using a page header section to display field labels is a common technique in tabular reports. The code is simple, but looks a bit messy because of all the field measurements. In a real application, these values would not be hard-wired into the program. • Visual Basic ' create a page header with field labels With c1r.Sections(SectionTypeEnum.PageHeader) .Height = 500 .Visible = True c1r.Font.Bold = True f = .Fields.Add("LblID", "ID", 0, 50, 400, 300) f.Align = FieldAlignEnum.RightTop f = .Fields.Add("LblFirstName", "First", 500, 50, 900, 300) f = .Fields.Add("LblLastName", "Last", 1500, 50, 900, 300) f = .Fields.Add("LblTitle", "Title", 2500, 50, 2400, 300) f = .Fields.Add("LblTitle", "Notes", 5000, 50, 8000, 300) c1r.Font.Bold = False f = .Fields.Add("FldLine", "", 0, 400, c1r.Layout.Width, 20) f.LineSlant = LineSlantEnum.NoSlant f.LineWidth = 50 f.BorderColor = Color.FromArgb(100, 100, 100) End With • C# // create a page header with field labels With c1r.Sections(SectionTypeEnum.PageHeader); .Height = 500; .Visible = true; c1r.Font.Bold = true; f = .Fields.Add("LblID", "ID", 0, 50, 400, 300); f.Align = FieldAlignEnum.RightTop; f = .Fields.Add("LblFirstName", "First", 500, 50, 900, 300); f = .Fields.Add("LblLastName", "Last", 1500, 50, 900, 300); f = .Fields.Add("LblTitle", "Title", 2500, 50, 2400, 300); f = .Fields.Add("LblTitle", "Notes", 5000, 50, 8000, 300); c1r.Font.Bold = false; f = .Fields.Add("FldLine", "", 0, 400, c1r.Layout.Width, 20); f.LineSlant = LineSlantEnum.NoSlant; 36 · Using Reports for .NET f.LineWidth = 50; f.BorderColor = Color.FromArgb(100, 100, 100); } With • Delphi // create a page header with field labels with c1r.Sections(SectionTypeEnum.PageHeader) do begin Height := 500; Visible := True; c1r.Font.Bold := True; f := Fields.Add('LblID','ID', 0, 50, 400, 300); f.Align := FieldAlignEnum.RightTop; f := Fields.Add('LblFirstName','First', 500, 50, 900, 300); f := Fields.Add('LblLastName','Last', 1500, 50, 900, 300); f := Fields.Add('LblTitle','Title', 2500, 50, 2400, 300); f := Fields.Add('LblTitle','Notes', 5000, 50, 8000, 300); c1r.Font.Bold := False; f := Fields.Add('FldLine','', 0, 400, c1r.Layout.Width, 20); f.LineSlant := LineSlantEnum.NoSlant; f.LineWidth := 50; f.BorderColor := Color.FromArgb(100, 100, 100); end; The code above illustrates a powerful technique for handling fonts. Since every field inherits the control font when it is created, we set the control's Font.Bold property to True before creating the fields, and set it back to False afterwards. As a result, all controls in the page header section have a bold font. 7. To finalize the report, we will add the detail section. This is the section that shows the actual data. It has one calculated field below each label in the page header section. • Visual Basic ' create the detail section With c1r.Sections(SectionTypeEnum.Detail) .Height = 330 .Visible = True f = .Fields.Add("FldID", "EmployeeID", 0, 0, 400, 300) f.Calculated = True f = .Fields.Add("FldFirstName", "FirstName", 500, 0, 900, 300) f.Calculated = True f = .Fields.Add("FldLastName", "LastName", 1500, 0, 900, 300) f.Calculated = True f = .Fields.Add("FldTitle", "Title", 2500, 0, 2400, 300) f.Calculated = True f = .Fields.Add("FldNotes", "Notes", 5000, 0, 8000, 300) f.Width = c1r.Layout.Width - f.Left f.Calculated = True f.CanGrow = True f.Font.Size = 6 f.Align = FieldAlignEnum.JustTop f = .Fields.Add("FldLine", "", 0, 310, c1r.Layout.Width, 20) f.LineSlant = LineSlantEnum.NoSlant f.BorderStyle = BorderStyleEnum.Solid f.BorderColor = Color.FromArgb(100, 100, 100) End With Creating a Report Definition Using Code · 37 • C# // create the detail section With c1r.Sections(SectionTypeEnum.Detail); .Height = 330; .Visible = true; f = .Fields.Add("FldID", "EmployeeID", 0, 0, 400, 300); f.Calculated = true; f = .Fields.Add("FldFirstName", "FirstName", 500, 0, 900, 300); f.Calculated = true; f = .Fields.Add("FldLastName", "LastName", 1500, 0, 900, 300); f.Calculated = true; f = .Fields.Add("FldTitle", "Title", 2500, 0, 2400, 300); f.Calculated = true; f = .Fields.Add("FldNotes", "Notes", 5000, 0, 8000, 300); f.Width = c1r.Layout.Width - f.Left; f.Calculated = true; f.CanGrow = true; f.Font.Size = 6; f.Align = FieldAlignEnum.JustTop; f = .Fields.Add("FldLine", "", 0, 310, c1r.Layout.Width, 20); f.LineSlant = LineSlantEnum.NoSlant; f.BorderStyle = BorderStyleEnum.Solid; f.BorderColor = Color.FromArgb(100, 100, 100); } With • Delphi // create the detail section with c1r.Sections(SectionTypeEnum.Detail) do begin Height := 330; Visible := True; f := Fields.Add('FldID','EmployeeID', 0, 0, 400, 300); f.Calculated := True; f := Fields.Add('FldFirstName','FirstName', 500, 0, 900, 300); f.Calculated := True; f := Fields.Add('FldLastName','LastName', 1500, 0, 900, 300); f.Calculated := True; f := Fields.Add('FldTitle','Title', 2500, 0, 2400, 300); f.Calculated := True; f := Fields.Add('FldNotes','Notes', 5000, 0, 8000, 300); f.Width := c1r.Layout.Width - f.Left; f.Calculated := True; f.CanGrow := True; f.Font.Size := 6; f.Align := FieldAlignEnum.JustTop; f := Fields.Add('FldLine','', 0, 310, c1r.Layout.Width, 20); f.LineSlant := LineSlantEnum.NoSlant; f.BorderStyle := BorderStyleEnum.Solid; f.BorderColor := Color.FromArgb(100, 100, 100); end; Note that all fields are calculated, and their Text property corresponds to the names of fields in the source recordsetsource. Setting the Calculated property to True ensures that the Text property is interpreted as a database field name, as opposed to being rendered literally. It is important to adopt a naming convention for report fields that makes them unique, different from recordset field names. If you had two fields named "LastName", an expression such as "Left(LastName,1)" would be ambiguous. In this example we have adopted the convention of beginning all report field names with "Fld". 38 · Using Reports for .NET Note also that the "FldNotes" field has its CanGrow property set to True, and a smaller font than the others. This was done because the "Notes" field in the database contains a lot of text, and we want it all to appear in the report. Rather than make the field very tall and waste space, setting the CanGrow property to True tells the control to expand the field as needed to fit its contents; it also sets the containing section's CanGrow property to True, so the field doesn't spill off the section. 8. The report definition is done. To render it, all it takes is one line of code: • Visual Basic ' render the report into the PrintPreviewControl ppv.Document = c1r.Document • C# // render the report into the PrintPreviewControl ppv.Document = c1r.Document; • Delphi // render the report into the PrintPreviewControl ppv.Document := c1r.Document; This renders the report into a C1PrintPreview control named ppv that displays the report on the screen. Here's what the report looks like: Add Grouping and Sorting Using Code Useful reports don't simply show data, they show it in an organized manner. C1Report uses groups to group and sort data. To demonstrate how this works, let's go back to our example and show the employees grouped by country. The following code creates a group object that sorts and groups records by country. (It should be added to the previous code after the block that creates the detail section.) • Visual Basic If chkGroup.Checked Then ' group employees by country, in ascending order Dim grp As Group Add Grouping and Sorting Using Code · 39 grp = c1r.Groups.Add("GrpCountry", "Country", SortEnum.Ascending) ' format the header section for the new group With grp.SectionHeader .Height = 500 .Visible = True f = .Fields.Add("CtlCountry", "Country", 0, 0, c1r.Layout.Width, 500) f.Calculated = True f.Align = FieldAlignEnum.LeftMiddle f.Font.Bold = True f.Font.Size = 12 f.BorderStyle = BorderStyleEnum.Solid f.BorderColor = Color.FromArgb(0, 0, 150) f.BackStyle = BackStyleEnum.Opaque f.BackColor = Color.FromArgb(150, 150, 220) f.MarginLeft = 100 End With ' sort employees by first name within each country c1r.Groups.Add("GrpName", "FirstName", SortEnum.Ascending) End If • C# if ( chkGroup.Checked ) { // group employees by country, in ascending order Group grp; grp = c1r.Groups.Add("GrpCountry", "Country", SortEnum.Ascending); // format the header section for the new group With grp.SectionHeader; .Height = 500; .Visible = true; f = .Fields.Add("CtlCountry", "Country", 0, 0, c1r.Layout.Width, 500); f.Calculated = true; f.Align = FieldAlignEnum.LeftMiddle; f.Font.Bold = true; f.Font.Size = 12; f.BorderStyle = BorderStyleEnum.Solid; f.BorderColor = Color.FromArgb(0, 0, 150); f.BackStyle = BackStyleEnum.Opaque; f.BackColor = Color.FromArgb(150, 150, 220); f.MarginLeft = 100; } With // sort employees by first name within each country c1r.Groups.Add("GrpName", "FirstName", SortEnum.Ascending); } • Delphi var grp: Group; begin if chkGroup.Checked then begin // group employees by country, in ascending order grp := c1r.Groups.Add('GrpCountry','Country', SortEnum.Ascending); // format the header section for the new group with grp.SectionHeader do begin 40 · Using Reports for .NET 500); Height := 500; Visible := True; f := Fields.Add('CtlCountry','Country', 0, 0, c1r.Layout.Width, f.Calculated := True; f.Align := FieldAlignEnum.LeftMiddle; f.Font.Bold := True; f.Font.Size := 12; f.BorderStyle := BorderStyleEnum.Solid; f.BorderColor := Color.FromArgb(0, 0, 150); f.BackStyle := BackStyleEnum.Opaque; f.BackColor := Color.FromArgb(150, 150, 220); f.MarginLeft := 100; end; end; // sort employees by first name within each country c1r.Groups.Add('GrpName','FirstName', SortEnum.Ascending); end; Every group has a header and a footer sections. These are invisible by default, but the code above makes the header section visible to show which country defines the group. Then it adds a field with the country. The new field has a solid blue background. Finally, the code adds a second group to sort the employees within each country by their first name. This group is only used for sorting, so the header and footer sections remain invisible. We're done with our changes. To render the new report, we need to finish the routine with a call to the Render method, as before: • Visual Basic ' render the report into the PrintPreviewControl ppv.Document = c1r.Document • C# // render the report into the PrintPreviewControl ppv.Document = c1r.Document; • Delphi // render the report into the PrintPreviewControl ppv.Document := c1r.Document; Adding Charts to C1Reports · 41 Here's what the new report looks like: Adding Charts to C1Reports Using Chart Fields Chart fields are implemented using the C1Chart control. Note: you must deploy the C1Chart assembly with your application if you use charts. To add a Chart field to your report, open the report in the Report Designer, click the Chart field in the toolbar, and mark the area in the report where the Chart should be displayed. Then set the field properties as usual. The only unusual aspect of Chart fields is that unlike most bound fields, they display multiple values. To select the data you want to display, you should set the Chart field's DataX and DataY properties. You can also customize the chart appearance by setting other properties such as ChartType, Palette, and so on. 42 · Using Reports for .NET The following tutorial walks through the creation of a report with an embedded chart: 1. Use the Report Wizard to create a new report Use the Wizard to select a data source for the report. For this tutorial, we will use the NorthWind database and the Sales by Category view. The following image shows this step: 2. Select the fields you want to display. In this tutorial, we will group the data by Category and show ProductName and ProductSales in the detail section of the report: To add groups and detail fields, drag them from the Available list on the left to the Groups or Detail lists on the right: Adding Charts to C1Reports · 43 Click Next until the wizard is done to finish creating the initial version of the report. 3. Add the Chart to the Group Header section of the report. Charts usually make sense in the group header sections of a report, to summarize the information for the group. To add the chart, start by making some room for it in the group header section, then click the Chart button in the field toolbar and place the field in the report. This is what the report should look like at this point (note that the Chart button is pressed in the image): 44 · Using Reports for .NET The chart is not visible yet because there's no data attached to it. Select the chart field and scroll the Property window to see the properties in the Chart category (switch the property grid to category view and turn off the property filter if necessary). Set the DataY property to the name of the field that contains the values to be charted, in this case, ProductSales. Also set the DataX property to the name of the field that contains the labels for each data point, in this case, ProductName. Note that the DataY property may specify more than one chart series. Just add as many fields or calculated expressions as you want, separating them with semicolons. The Chart control will now display some sample data so you can see the effect of the properties that are currently set (the actual data is not available at design time). You may want to experiment changing the values of some properties such as ChartType, ForeColor, DataColor, and GridLines. You can also use the regular field properties such as Font and ForeColor. Adding Charts to C1Reports · 45 Click the Preview button to see the report. The sample report should look like the following image: Note that the Report field is sensitive to its position in the report. Because it is in a group header section, it only includes the data within that group. If you place the Chart field in a detail section, it will include all the data for the entire report. This is not useful because there will be one chart in each detail section and they will all look the same. If you need more control over what data should be displayed in the chart, you can use the DataSource property in the chart field itself. That is discussed later, in the Chart reference. You can now save the report and use it in your WinForms and ASP.NET applications. Using Gadient Fields Gradient fields are much simpler than charts. They are mainly useful as a background feature to make other fields stand out. For example, add a gradient field over the labels in the group header section. You may have to right-click the field and select Send To Back to ensure it is behind the labels. Then set the ColorFrom and ColorTo properties to Red and White, and set the Angle property to -90. 46 · Using Reports for .NET Typical Usage Scenarios This section describes how you can use Reports for .NET in typical desktop and web scenarios. Desktop Scenarios In typical desktop scenarios, C1Report runs on the same computer where the reports will be generated and viewed (the report data itself may still come from a remote server). These scenarios assume that C1Report will be hosted in a Visual Basic.NET, C#.NET or C++.NET application. Scenario 1: Embedded Reports (Loaded at Design-Time) Under this scenario, an application generates reports using a fixed set of report definitions that are built into the application. This type of application does not rely on any external report definition files, and end-users have no way to modify the reports. The main advantage of this type of application is that you don't need to distribute the report definition file, and you can be sure that no one will modify the report format. The disadvantage is that to make any modifications to the report, you must recompile the application. If you want to use a report definition that you already have, without any modifications, follow these steps (we will later describe how you can edit an embedded report or create one from scratch): 1. Use the C1Report component to create all the reports you will need. (See Using the C1Report Designer (page 83) for details on how to do this.) 2. Add one C1Report component for each report definition you want to distribute. You may want to name each control after the report it will render (this will make your code easier to maintain). 3. Right-click each C1Report component and select the Load Report menu option to load report definitions into each control. You can also click the Load Report link at the bottom of the Designer window. Typical Usage Scenarios · 47 This will bring up the Load Report dialog box, which allows you to select a report definition file and then a report within that file. To load a report, click theellipse button to select the report definition file you created in step 1, then select the report from the drop-down list and click the Load button. The property page will show the name of the report you selected and a count of groups, sections, and fields. This is what the dialog box looks like: Add a single C1PrintPreview control to the form (or a Microsoft PrintPreview control) and also add a control that will allow the user to pick a report (this could be a menu, a list box, or a group of buttons.) 4. Add code to render the report selected by the user. For example, if you added a group of buttons in step 3, the code would look like this: • Visual Basic Private Sub btnProductsReport_Click() ppv.Document = rptProducts.Document End Sub • C# private void btnProductsReport_Click() { ppv.Document = rptProducts.Document; } • Delphi procedure btnProductsReport_Click; ppv.Document := rptProducts.Document; end; Where rptProducts is the name of the C1Report component that contains the report selected by the user and ppv is the name of the C1PrintPreview control. 48 · Using Reports for .NET Scenario 2: Embedded Reports (Created at Design-Time) The Load Report command described in Scenario 1 makes it easy to embed reports you already have into your application. In some cases, however, you may want to customize the report, or use data source objects that are defined in your Visual Studio application rather than use connection strings and record sources. In these situations, use the Edit Report command instead. To create or edit reports at design time, right-click the C1Report component and select the Edit Report menu option to invoke the C1ReportDesigner application (you can also click the Edit Report link at the bottom of the Designer window). Note: If the Edit Report command doesn't appear on the context menu and Properties window, it is probably because the control could not find the report designer application. To fix this, simply run the C1ReportDesigner application once in stand-alone mode. The designer will save its location to the registry, and the C1Report component should be able to find it afterwards. The C1ReportDesigner will show the report currently loaded in the C1Report component. If the C1Report component is empty, the designer will show the report wizard so you can create a new report. This is the same C1ReportDesigner application used in stand-alone mode. The only differences you will notice when you start it in this mode are: • You can use the data source objects defined in your application as data sources for your new reports. • When you close the designer, any changes you made will be saved back into the C1Report component on the form (unless you choose to discard the changes by selecting in the designer, in the File menu, Cancel Changes and Exit). To use data source objects defined in your application, click the Data Source button in the designer ( then select the Data Objects page in the Data Source dialog. ), The Data Objects page will show a list of data objects currently defined on the form (the page will not be visible if there aren't any valid data sources on the form). Alternatively, you can use the Connections button to build and select a connection string and recordsource as usual. For example, if the main form contains a DataSet object with several DataTables attached to it, the data source picker dialog might look like this: Typical Usage Scenarios · 49 Once you are done creating or editing the report, you can close the designer by selecting in the File menu, Save Changes and Exit. This will save the report definition directly into the component (as if you had loaded it from a file using the Load Report command). If you change your mind and decide to cancel the changes, quit the designer using Cancel Changes and Exit in the File menu. Scenario 3: Reports Loaded at Run-Time Under this scenario, an application loads reports definitions from a file at run time. This type of application requires a report definition file and works like a viewer. The main advantage of this type of application is that if you modify the report format, there's no need to update the application. Simply send the new report definition file to the users and you are done. To create an application with reports loaded at run-time, follow these steps: 1. Use the C1Report Designer to create all the reports you will need. (See Using the C1Report Designer (page 83) for details on how to do this.) 2. Add the following controls to the application: 3. • C1Report named c1r • C1PrintPreview named ppv • ComboList named cmbReport • StatusBar control named status Add the following Import statements to the top of the file: • Visual Basic Imports C1.Win.C1Report Imports System.IO • C# using C1.Win.C1Report; using System.IO; 50 · Using Reports for .NET • Delphi uses C1.Win.C1Report, System.IO; This allows you to reference the C1Report and System.IO classes and objects without having to specify the full namespaces. 4. Add code to read the report definition file and build a list of all reports in it. This can be done as follows: • Visual Basic ' get application path Dim appPath As String appPath = Path.GetDirectoryName(Application.ExecutablePath).ToLower() Dim i As Integer = appPath.IndexOf("/bin") If (i < 0) Then i = appPath.IndexOf("\bin") If (i > 0) Then appPath = appPath.Remove(i, appPath.Length - i) ' get names of reports in the report definition file m_ReportDefinitionFile = appPath & "\Data\Nwind.xml" Dim reports As String() = c1r.GetReportInfo(m_ReportDefinitionFile) ' populate combo box cmbReport.Items.Clear() Dim report As String For Each report In reports cmbReport.Items.Add(report) Next • C# // get application path string appPath; appPath = Path.GetDirectoryName(Application.ExecutablePath).ToLower(); int i = appPath.IndexOf("/bin"); if ((i < 0) ) { i = appPath.IndexOf("\bin") if ((i > 0) ) { appPath = appPath.Remove(i, appPath.Length - i) // get names of reports in the report definition file m_ReportDefinitionFile = appPath + "\Data\Nwind.xml"; string ( reports) = c1r.GetReportInfo(m_ReportDefinitionFile); // populate combo box cmbReport.Items.Clear(); string report; foreach ( report In reports cmbReport.Items.Add(report); } • Delphi var appPath: string; i: Integer; reports: array of string; begin // get application path appPath := Path.GetDirectoryName(Application.ExecutablePath).ToLower; i := appPath.IndexOf('/bin'); if (i < 0) then i := appPath.IndexOf('\bin'); if (i > 0) then Typical Usage Scenarios · 51 appPath := appPath.Remove(i, appPath.Length - i); // get names of reports in the report definition file m_ReportDefinitionFile := appPath + '\Data\Nwind.xml'; reports := c1r.GetReportInfo(m_ReportDefinitionFile); // populate combo box cmbReport.Items.Clear; for i := 0 to High(reports) do cmbReport.Items.Add(reports[i]); end The code starts by getting the location of the file that contains the report definitions. This is done using static methods in the system-defined Path and Application classes. You may have to adjust the code to reflect the location and name of your report definition file. Then it uses the GetReportInfo method to retrieve an array containing the names of all reports in the report definition file (created in step 1), and populates the combo box that will allow users to select the report. 5. Add code to render the report selected by the user. For example: • Visual Basic Private Sub cmbReport_SelectedIndexChanged(ByVal sender As Object,_ ByVal e As EventArgs) Handles cmbReport.SelectedIndexChanged Try Cursor = Cursors.WaitCursor ' load report status.Text = "Loading " & cmbReport.Text c1r.Load(m_ReportDefinitionFile, cmbReport.Text) ' render into print preview control status.Text = "Rendering " & cmbReport.Text ppv.Document = c1r.Document ' give focus to print preview control ppv.StartPage = 0 ppv.Focus() Finally Cursor = Cursors.Default End Try End Sub • C# private void cmbReport_SelectedIndexChanged( object sender,_ EventArgs e) cmbReport.SelectedIndexChanged; { try { Cursor = Cursors.WaitCursor; // load report status.Text = "Loading " + cmbReport.Text; c1r.Load(m_ReportDefinitionFile, cmbReport.Text); // render into print preview control status.Text = "Rendering " + cmbReport.Text; ppv.Document = c1r.Document; 52 · Using Reports for .NET // give focus to print preview control ppv.StartPage = 0; ppv.Focus(); } • } finally { Cursor = Cursors.Default; } Delphi Include(Self.cmbReport.SelectedIndexChanged, Self.cmbReport_SelectedIndexChanged); procedure cmbReport_SelectedIndexChanged(sender: System.Object; e: System.EventArgs); begin Cursor := Cursors.WaitCursor; try // load report status.Text := 'Loading '+ cmbReport.Text; c1r.Load(m_ReportDefinitionFile, cmbReport.Text); // render into print preview control status.Text := 'Rendering '+ cmbReport.Text; ppv.Document := c1r.Document; // give focus to print preview control ppv.StartPage := 0; ppv.Focus; finally; Cursor := Cursors.Default; end; end; Scenario 4: Customizable Reports This scenario is a variation on the above. It consists of loading the basic report definitions from a file, then writing code to customize the reports according to user selections. For example, the code below changes the font used in the detail section: • Visual Basic Imports C1.Win.C1Report Dim i%, strDetailFont$ strDetailFont = "Arial Narrow" With c1r.Sections(SectionTypeEnum.Detail).Fields For i = 0 To .Count – 1 .Item(i).Font.Name = strDetailFont Next End With Dim detail As Section = c1r.Sections(SectionTypeEnum.Detail) Dim f As Field For Each f In detail.Fields f.Font.Name = "Arial Narrow" Next Typical Usage Scenarios · 53 • C# using C1.Win.C1Report; Section detail = c1r.Sections[SectionTypeEnum.Detail]; foreach (Field f in detail.Fields) f.Font.Name = "Arial Narrow"; • Delphi Imports C1.Win.C1Report; strDetailFont := 'Arial Narrow'; with c1r.Sections[SectionTypeEnum.Detail].Fields do begin for i = 0 to Count – 1 do begin Item[i].Font.Name := strDetailFont; end; end; detail := c1r.Sections[SectionTypeEnum.Detail]; for i := 0 to detail.Fields.Count - 1 do detail.Fields[i].Font.Name := 'Arial Narrow'; The code below toggles the display of a group by turning its Sort property on or off and setting the Visible property of the group's header and footer sections: • Visual Basic Dim bShowGroup As Boolean bShowGroup = True With c1r.Groups(0) If bShowGroup Then .SectionHeader.Visible = True .SectionFooter.Visible = True .Sort = SortEnum.Ascending Else .SectionHeader.Visible = False .SectionFooter.Visible = False .Sort = SortEnum.NoSort End If End With • C# bool bShowGroup; bShowGroup = true; With c1r.Groups(0); if ( bShowGroup ) { .SectionHeader.Visible = true; .SectionFooter.Visible = true; .Sort = SortEnum.Ascending; } else { .SectionHeader.Visible = false; .SectionFooter.Visible = false; .Sort = SortEnum.NoSort; } } With • Delphi bShowGroup := True; with c1r.Groups[0] do begin 54 · Using Reports for .NET if bShowGroup then begin SectionHeader.Visible := True; SectionFooter.Visible := True; Sort := SortEnum.Ascending; end else begin SectionHeader.Visible := False; SectionFooter.Visible := False; Sort := SortEnum.NoSort; end; end; These samples illustrate some of the things you can do to customize reports. There are infinite possibilities, because the object model offers access to every aspect of the report. (In fact, you can create whole reports entirely with code). Web Scenarios If you are developing reports for the Web (ASP.NET), you can use the C1WebReport control included with the ComponentOne ASP.NET Studio package. This control encapsulates the C1Report component and provides methods and properties that make it very easy to add reports to your web pages. The C1WebReport control is 100% compatible with C1Report, and provides advanced caching and rendering options designed specifically for Web scenarios, as well as the usual design-time editing options provided by ASP.NET server controls. If you don't want to purchase ComponentOne ASP.NET Studio, you can still use the C1Report control in your web applications, except you will have to write some code to create HTML or PDF versions of the reports. The following sections describe how to do this. In typical web scenarios, C1Report runs on the server machine and creates reports either in batch mode or on demand. The user can select the reports and preview or print them on the client machine, using a web browser. Scenario 1: Static Web Reports This scenario is based on a server application that runs periodically and creates a predefined set of reports, saving them to HTML or PDF files. These files are referenced by web pages on your site, and they are downloaded to the client machine like any other web page. To implement this type of application, follow these steps: 1. Use the C1Report Designer to create all the reports you will need. (See Using the C1Report Designer (page 83) for details on how to do this.) 2. Create an application on the server that contains a C1Report component. If you don't want to use forms and windows, create the control using the CreateObject function in Visual Basic or CoCreateInstance in C++.NET. 3. Add a routine that runs periodically and updates all the reports you want to make available to your users. The loop would look like this: • Visual Basic ' ** this runs every 6 hours: ' get a list of all reports in the definition file sFile = "c:\inetpub\wwwroot\Reports\MyReports.xml" sList = c1r.GetReportInfo(sFile) Typical Usage Scenarios · 55 ' refresh the reports on the server For i = 0 To sList.Length – 1 c1r.Load(sFile, sList(i)) sFile = "Reports\Auto\" & sList(i) & ".htm" c1r.RenderToFile(sFile, FileFormatEnum.HTMLPaged) Next • C# // ** this runs every 6 hours: // get a list of all reports in the definition file sFile = "c:\inetpub\wwwroot\Reports\MyReports.xml"; sList = c1r.GetReportInfo(sFile); // refresh the reports on the server for ( i = 0 ; GAIS <= sList.Length – 1 c1r.Load(sFile, sList(i)); sFile = "Reports\Auto\" + sList(i) + ".htm"; c1r.RenderToFile(sFile, FileFormatEnum.HTMLPaged); • Delphi // ** this runs every 6 hours: // get a list of all reports in the definition file sFile := 'c:\inetpub\wwwroot\Reports\MyReports.xml'; sList := c1r.GetReportInfo(sFile); // refresh the reports on the server for i := 0 to High(sList) do begin c1r.Load(sFile, sList[i]); sFile := 'Reports\Auto\'+ sList(i) +'.htm'; c1r.RenderToFile(sFile, FileFormatEnum.HTMLPaged); end; The code uses the GetReportInfo method to retrieve a list of all reports contained in the MyReports.xml report definition file (created in step 1), then renders each report into a paged HTML file. (Paged HTML files contain one HTML page for each page in the original report, with a navigation bar that allows browsing.) 4. Edit the "home" HTML page by adding links to the reports that were saved. You are not restricted to HTML. C1Report can also export to PDF files, which can be viewed on any browser with freely available plug-ins. The PDF format is actually superior to HTML in many ways, especially when it comes to producing hard copies of your web reports. Scenario 2: Dynamic Web Reports In this scenario, reports are created on-demand, possibly based on data supplied by the user. This type of solution typically involves using an ASP.NET page that presents a form to the user and collects the information needed to create the report, then creates a C1Report component to render the report into a temporary file, and returns a reference to that file. The example that follows is a simple ASP.NET page that allows users to enter some information and to select the type of report they want. Based on this, the ASP code creates a custom version of the NorthWind Employee Sales by Country report and presents it to the user in the selected format. The sample uses a temporary file on the server to store the report. In a real application, you would have to generate unique file names and delete them after a certain time, to avoid overwriting reports before the users 56 · Using Reports for .NET get a chance to see them. Despite this, the sample illustrates the main techniques involved in delivering reports over the web with C1Report. 1. Start by creating a new C# Web Application with a web page that looks like this: The page has five server controls: • _lstYear: Contains a list of valid years for which we have data (1994, 1995, and 1996). • _txtGoal: Contains the yearly sales goal for each employee. • _btnHTML, _btnRTF: Buttons used to render the report into HTML or PDF, and show the result. • _lblStatus: Displays error information if something goes wrong. Note: If you run this application with a demo or beta version of the C1Report component, there will be errors when the control tries to display its About dialog box on the server. If that happens, simply reload the page and the problem should go away. After the page has been set up, you need to add a reference to the C1Report component to the project. Just right-click the References entry in the Solution Explorer window, select Add Reference and pick the C1Report component. 2. If you have used traditional ASP, this is where things start to become interesting. Double-clicking the controls will take you to a code window where you can write full-fledged C# code to handle the events, using the same editor and environment you use to write Windows Forms C# projects. Double-click both buttons to create handlers for their Click event, and then add the following code: • Visual Basic ' handle user clicks Private Sub _btnHTML_Click(ByVal sender As Object, ByVal e As System.EventArgs) RenderReport(FileFormatEnum.HTMLDrillDown) End Sub Private Sub _btnPDF_Click(ByVal sender As Object, ByVal e As System.EventArgs) RenderReport(FileFormatEnum.PDF) End Sub • C# // handle user clicks private void _btnHTML_Click(object sender, System.EventArgs e) { RenderReport(FileFormatEnum.HTMLDrillDown); Typical Usage Scenarios · 57 } private void _btnPDF_Click(object sender, System.EventArgs e) { RenderReport(FileFormatEnum.PDF); } • Delphi // handle user clicks procedure Class1._btnHTML_Click(sender: System.Object; e: System.EventArgs); begin RenderReport(FileFormatEnum.HTMLDrillDown); end; procedure Class1._btnPDF_Click(sender: System.Object; e: System.EventArgs); begin RenderReport(FileFormatEnum.PDF); end; 3. This is the code that gets executed on the server, when the user clicks either button. The code delegates the work to the main routine, RenderReport: • Visual Basic Private Sub RenderReport(ByVal fmt As FileFormatEnum) ' build file names Dim rpt As String = "Employee Sales by Country" Dim fileIn As String = GetDataPath() & "NWind.xml" Dim ext As String = IIf(fmt = FileFormatEnum.PDF, ".pdf", ".htm") Dim fileOut As String = GetOutputPath() & rpt & ext Try ' create C1Report component Dim c1r As New C1Report() ' load the report c1r.Load(fileIn, rpt) ' get user parameters Dim year As String = _lstYear.SelectedItem.Text Dim goal As String = _txtGoal.Text ' customize the report data source Dim sSQL As String = "SELECT DISTINCTROW " & _ "Employees.Country, Employees.LastName, " & _ "Employees.FirstName, Orders.ShippedDate, Orders.OrderID, " & _ " [Order Subtotals].Subtotal AS SaleAmount " & _ "FROM Employees INNER JOIN (Orders INNER JOIN " & _ " [Order Subtotals] ON Orders.OrderID = " & _ " [Order Subtotals].OrderID) " & _ " ON Employees.EmployeeID = Orders.EmployeeID " & _ "WHERE Year(Orders.ShippedDate) = " & year & ";" c1r.DataSource.RecordSource = sSQL ' customize the report's event handlers Dim sScript As String = _ 58 · Using Reports for .NET "If SalespersonTotal > " & goal & " Then" & vbCrLf & _ " ExceededGoalLabel.Visible = True" & vbCrLf & _ " SalespersonLine.Visible = True" & vbCrLf & _ "Else" & vbCrLf & _ " ExceededGoalLabel.Visible = False" & vbCrLf & _ " SalespersonLine.Visible = False" & vbCrLf & _ "End If" c1r.Sections(SectionTypeEnum.GroupHeader2).OnPrint = sScript ' render the report into a temporary file c1r.RenderToFile(fileOut, fmt) ' redirect user to report file Response.Redirect("Temp/" + rpt + ext) Catch x As Exception _lblStatus.Text = "*** " & x.Message End Try End Sub • C# // render the report private void RenderReport(FileFormatEnum fmt) { // build file names string rpt = "Employee Sales by Country"; string fileIn = GetDataPath() + "NWind.xml"; string ext = (fmt == FileFormatEnum.PDF)? ".pdf": ".htm"; string fileOut = GetOutputPath() + rpt + ext; try { // create C1Report component C1Report c1r = new C1Report(); // load the report c1r.Load(fileIn, rpt); // get user parameters string year = _lstYear.SelectedItem.Text; string goal = _txtGoal.Text; // customize the report data source string sSQL = "SELECT DISTINCTROW " + "Employees.Country, Employees.LastName, " + "Employees.FirstName, Orders.ShippedDate, Orders.OrderID, " + " [Order Subtotals].Subtotal AS SaleAmount " + "FROM Employees INNER JOIN (Orders INNER JOIN " + " [Order Subtotals] ON Orders.OrderID = " + " [Order Subtotals].OrderID) " + " ON Employees.EmployeeID = Orders.EmployeeID " + "WHERE Year(Orders.ShippedDate) = " + year + ";"; c1r.DataSource.RecordSource = sSQL; Typical Usage Scenarios · 59 // customize the report's event handlers string sScript = "If SalespersonTotal > " + goal + " Then \n" + " ExceededGoalLabel.Visible = True\n" + " SalespersonLine.Visible = True\n" + "Else\n" + " ExceededGoalLabel.Visible = False\n" + " SalespersonLine.Visible = False\n" + "End If"; c1r.Sections[SectionTypeEnum.GroupHeader2].OnPrint = sScript; // render the report into a temporary file c1r.RenderToFile(fileOut, fmt); } • // redirect user to report file Response.Redirect("Temp/" + rpt + ext); } catch (Exception x) { _lblStatus.Text = "*** " + x.Message; } Delphi procedure RenderReport(fmt: FileFormatEnum); var rpt: String; fileIn: String; ext: String; fileOut: String; c1r: C1Report; year: String; goal: String; sSQL: String; sScript: String; begin c1r := C1Report.Create; // build file names rpt := 'Employee Sales by Country'; fileIn := GetDataPath +'NWind.xml'; if fmt = FileFormatEnum.PDF then ext := '.pdf' else ext := '.htm'; fileOut := GetOutputPath + rpt + ext; try // create C1Report component // load the report c1r.Load(fileIn, rpt); // get user parameters year := _lstYear.SelectedItem.Text; goal := _txtGoal.Text; 60 · Using Reports for .NET // customize the report data source c1r.DataSource.RecordSource := sSQL; // customize the report' s event handlers sScript := 'If SalespersonTotal > '+ goal +' Then'#13#10' ExceededGoalLabel.Visible = True'#13#10' SalespersonLine.Visible = True'#13#10'Else'#13#10 +' ExceededGoalLabel.Visible = False'#13#10' SalespersonLine.Visible = False'#13#10'End If'; c1r.Sections(SectionTypeEnum.GroupHeader2).OnPrint := sScript; // render the report into a temporary file c1r.RenderToFile(fileOut, fmt); // redirect user to report file Response.Redirect('Temp/'+ rpt + ext); except on x: Exception do _lblStatus.Text := '*** '+ x.Message; end; end; The RenderReport routine is long but pretty simple. It starts out working out the names of the input and output files. All file names are built relative to the current application directory. 4. Next, the routine creates a C1Report component and loads the "Employee Sales by Country" report. This is the raw report, which we will customize below. The parameters entered by the user are available in the _lstYear and _txtGoal server-side controls. The code reads these values and uses them to customize the report's RecordSource property and to build a VBScript handler for the OnPrint event. These techniques were discussed in previous sections. Once the report definition is ready, the code calls the RenderToFile method, which causes the C1Report component to write HTML or PDF files to the output directory. When the method returns, the report is ready to be displayed to the user. 5. The last step is the call to Response.Redirect, which displays the report we just created on the user's browser. Note that the whole code is enclosed in a try/catch block. If anything goes wrong while the report is being generated, the user gets to see a message explaining the problem. 6. Finally, there's a couple of simple helper routines that need to be added: • Visual Basic ' get directories to use for loading and saving files Private Function GetDataPath() As String Return Request.PhysicalApplicationPath + "Data\" End Function Private Function GetOutputPath() As String Return Request.PhysicalApplicationPath + "Temp\" End Function • C# // get directories to use for loading and saving files private string GetDataPath() { VBScript Expressions · 61 return Request.PhysicalApplicationPath + @"Data\"; } private string GetOutputPath() { return Request.PhysicalApplicationPath + @"Temp\"; } • Delphi // get directories to use for loading and saving files function Class1.GetDataPath: string; begin Result := (Request.PhysicalApplicationPath + 'Data\'); end; function Class1.GetOutputPath: string; begin Result := (Request.PhysicalApplicationPath + 'Temp\'); end; 7. After you enter this code, the application is ready. You can press F5 and trace its execution within Visual Studio. The picture below shows what the result looks like in the browser: VBScript Expressions C1Report relies on VBScript to evaluate expressions in calculated fields and to handle report events (the difference between report events and control events is discussed below). VBScript is a full-featured language, and you have access to all its methods and functions when writing C1Report expressions. This document does not cover the intrinsic features of the VBScript language, which is documented in many books and web sites, as well as on the Microsoft Developer's Network (MSDN). C1Report extends VBScript by exposing additional objects, variables, and functions. These extensions are described below: 62 · Using Reports for .NET Objects and Variables Database Field Names Names of fields in the report's source datasetsource are evaluated and return the current field value. If a field name contains spaces or periods, it must be enclosed in square brackets. For example: OrderID [Customer.FirstName] [Name With Spaces] Report Field Names Names of Field objects are evaluated and return a reference to the object, so you can access the field's properties). The default property for the Field object is Value, so by itself the field name returns the field's current value. For example: • Visual Basic MyField.BackColor = RGB(200,250,100) MyField.Font.Size = 14 MyField * 2 ' (same as MyField.Value * 2) • C# MyField.BackColor = RGB(200,250,100); MyField.Font.Size = 14; MyField * 2; // (same as MyField.value * 2) • Delphi MyField.BackColor := RGB(200, 250, 100); MyField.Font.Size := 14; MyField * 2; // (same as MyField.value * 2) Note: If you give a report field the same name as a data field, you won't be able to access the report field. Report Section Names Names of Section objects are evaluated and return a reference to the object, so you can access the section's properties. The default property for the Section object is Name. For example: • Visual Basic If Page = 1 Then [Page Footer].Visible = False • C# if ( Page = 1 ) { [Page Footer].Visible = false; • Delphi if ( Page = 1 ) then [Page Footer].Visible := false; Report Object Returns a reference to the control object, so you can access the full C1Report object model from your scripts and expressions. For example: • Visual Basic "Fields: " & Report.Fields.Count • C# "Fields: " + Report.Fields.Count; • Delphi 'Fields: ' + Report.Fields.Count; Page Variable Returns or sets the value of the Page property. This property is initialized by the control when it starts rendering a report, and is incremented at each page break. You may reset it using code. For example: VBScript Expressions · 63 • Visual Basic If Country <> LastCountry Then Page = 1 LastCountry = Country • C# if ( Country != LastCountry ) { Page = 1 LastCountry = Country; • Delphi var LastCountry: System.Object; begin if (Country <> LastCountry) then LastCountry := Country; end; Pages Variable Returns a token that gets replaced with the total page count when the report finishes rendering. This is a readonly property that is typically used in page header or footer fields. For example: • Visual Basic "Page " & Page & " of " & Pages • C# "Page " + Page + " of " + Pages; • Delphi var Pages: System.Object; begin 'Page ' + Page.ToString + ' of ' + Pages.ToString; end; Cancel Set to True to cancel the report rendering process. For example: • Visual Basic If Page > 100 Then Cancel = True • C# if ( Page > 100 ) Cancel = true; • Delphi begin if (Page > 100) then Cancel := True; end; Compatibility Functions To increase compatibility with code written in Visual Basic and Microsoft Access (VBA), C1Report exposes two functions that are not available in VBScript: IIf and Format. IIf evaluates a Boolean expression and returns one of two values depending on the result. For example: • Visual Basic IIf(SalesAmount > 1000, "Yes", "No") • C# IIf(SalesAmount > 1000, "Yes", "No") 64 · Using Reports for .NET • Delphi if SalesAmount > 1000 then v := 'Yes' else v := 'No'; Format converts a value into a string formatted according to instructions contained in a format expression. The value may be a number, date, time, Boolean or string. The format is a string built using syntax similar to the format string used in Visual Basic or VBA. The table below describes the syntax used for the format string: Value Type Format String Description Number Percent, % Formats a number as a percentage, with zero or two decimal places. For example: Format(0.33, "Percent") = "33%" Format(0.3333333, "Percent") = "33.33%" #,###.##0 Formats a number using a mask. The following symbols are recognized: # 0 , ( % digit placeholder digit placeholder, force display use thousand separators enclose negative values in parenthesis format as percentage For example: Format(1234.1234, "#,###.##") = "1,234.12" Format(-1234, "#.00") = "(1234.12)" Format(.1234, "#.##") = ".12" Format(.1234, "0.##") = "0.12" Format(.3, "#.##%") = "30.00%" Currency Currency, $ Formats a number as a currency value. For example: Format(1234, "$") = "$1,234.00" Boolean Yes/No Date Long Date Returns "Yes" or "No". Format(#12/5/1#, "long date") = "December 5, 2001" Format(#12/5/1#, "short date") = "12/5/2001" Format(#12/5/1#, "medium date") = "05-Dec01" Short Date Medium Date String q,m,d,w,yyyy Returns a date part (quarter, month, day of the month, week of the year, year. For example: Format(#12/5/1#, "q") = "4" @@-@@/@@ Formats a string using a mask. The "@" character is a placeholder for a single character (or for the whole value string if there is a single "@"). Other characters are interpreted as literals. For example: Format("AC55512", "@@-@@/@@") = "AC-555/12" Format("AC55512", "@") = "AC55512" VBScript Expressions · 65 Value Type Format String Description @;Missing Uses the format string on the left of the semi-colon if the value is not null or an empty string, otherwise returns the part on the right of the semi-colon. For example: Format("@;Missing", "UK") = "UK" Format("@;Missing", "") = "Missing" Note: VBScript has its own built-in formatting functions (FormatNumber, FormatCurrency, FormatPercent, FormatDateTime, etc). You may use them instead of the VBA-style Format function described here. Aggregate Functions Aggregate functions are used to summarize data over the group being rendered. When used in a report header field, these expressions return aggregates over the entire dataset. When used in group headers or footers, they return the aggregate for the group. All C1Report aggregate functions take two arguments: 1. A string containing a VBScript expression to be aggregated over the group. 2. An optional string containing a VBScript expression used as a filter (domain aggregate). The filter expression is evaluated before each value is aggregated. If the filter returns False, the value is skipped and is not included in the aggregate result. C1Report defines the following aggregate functions: Function Description Avg Average value of the expression within the current group. For example, the expressions below calculate the average sales for the whole group and the average sales for a certain type of product: Avg(SalesAmount) Avg(SalesAmount, ProductType = 3) Sum Sum of all values in the group. Count Count of records in the group with non-null values. Use an asterisk for the expression to include all records. For example, the expressions below count the number of employees with valid (non-null) addresses and the total number of employees: Count(Employees.Address) Count(*) CountDistinct Count of records in the group with distinct non-null values. Min, Max Minimum and maximum values for the expression. For example: "Min Sale = " & Max(SaleAmount) Range Range between minimum and maximum values for the expression. StDev, Var Standard deviation and variance of the expression in the current group. The values are calculated using the sample (n-1) formulas, as in SQL and Microsoft Excel. StDevP, VarP Standard deviation and variance of the expression in the current group. These values are calculated using the population (n) formulas, as in SQL and Microsoft Excel. The next section explains how to use aggregate functions in detail, including how they work in the context of a report and how to use them efficiently. 66 · Using Reports for .NET Using Aggregate Functions To use the aggregate functions, add a calculated field to a section header or footer section, and assign the expression to the field's Text property. For example, the "Employee Sales by Country" report in the sample NWind.xml file contains several aggregate fields. The report groups records by Country and by Employee. The SalespersonTotal field in the footer section of the Employee group contains the following expression: Sum([SaleAmount]) Because the field is in the Employee group footer, the expression returns the total sales for the current employee. The CountryTotal and GrandTotal fields contain exactly the same expression. However, because these fields are in the Country group footer and report footer, the expression returns the total sales for the current country and for the entire recordset. You may need to refer to a higher-level aggregate from within a group. For example, in the "Employee Sales by Country" report, there is a field that shows sales in the current country as a percentage of the grand total. Since all aggregates calculated within a country group refer to the current country, the report cannot calculate this directly. Instead, the PercentOfGrandTotal field uses the following expression: [CountryTotal]/[GrandTotal] CountryTotal and GrandTotal are fields located in the Country and report footer sections. Therefore, CountryTotal holds the total for the current country and GrandTotal holds the total for the whole recordset. It is important to realize that evaluating aggregate functions is time-consuming, since it requires the control to traverse the recordset. Because of this, you should try to use aggregate functions in a few calculated fields only. Other fields can then read the aggregate value directly from these fields, rather than evaluating the aggregate expression again. For example, the "Employee Sales by Country" report in the NorthWind database has a detail field that shows each sale as a percentage of the country's total sales. This field contains the following expression: [SaleAmount]/[CountryTotal] SaleAmount is a reference to a recordset field, which varies for each detail record. CountryTotal is a reference to a report field that contains an aggregate function. When the control evaluates this expression, it gets the aggregate value directly from the report field, and does not recalculate the aggregate. Using VBScript to Format Reports You are not restricted to using VBScript to evaluate expressions in calculated fields. You can also specify scripts that are triggered when the report is rendered, and you can use those to change the formatting of the report. These scripts are contained in event properties. An event property is similar to a Visual Basic event handler, except that the scripts are executed in the scope of the report rather than in the scope of the application that is displaying the report. For example, you could use an event property to set a field's Font and ForeColor properties depending on its value. This behavior would then be a part of the report itself, and would be preserved regardless of the application used to render it. Of course, traditional events are also available, and you should use them to implement behavior that affects the application rather than the report. For example, you could write a handler for the StartPage event to update a page count in your application, regardless of which particular report is being rendered. The table below lists the event properties that are available and typical uses for them: Object Property Description Report OnOpen Fired when the report starts rendering. Can be used to modify the ConnectionString or RecordSource properties, or to initialize VBScript variables. VBScript Expressions · 67 Object Section Property Description OnClose Fired when the report finishes rendering. Can be used to perform clean-up tasks. OnNoData Fired when a report starts rendering but the source recordset is empty. You can set the Cancel property to True to prevent the report from being generated. You could also show a dialog box to alert the user as to the reason why no report is being displayed. OnPage Fired when a new page starts. Can be used to set the Visible property of sections of fields depending on a set of conditions. The control maintains a Page variable that is incremented automatically when a new page starts. OnError Fired when an error occurs. OnFormat Fired before the fields in a section are evaluated. At this point, the fields in the source recordset reflect the values that will be rendered, but the report fields do not. OnPrint Fired before the fields in a section are printed. At this point, the fields have already been evaluated and you can do conditional formatting. The following examples illustrate typical uses for these properties. Format a field according to its value This is probably the most common use for the OnPrint property. Take for example the "Orders by Value" report in the Nwind.XML sample file. The report lists order values grouped by product. Instead of using an extra field to display the quantity in stock, the report highlights products that are below the reorder level by displaying their name in bold red characters. This is done using an event script that looks like this: • Visual Basic Dim script As String = _ "If UnitsInStock < ReorderLevel Then" & vbCrLf & _ " ProductNameCtl.ForeColor = RGB(255,0,0)" & vbCrLf & _ " ProductNameCtl.Font.Bold = True" & vbCrLf & _ "Else" & vbCrLf & _ " ProductNameCtl.ForeColor = RGB(0,0,0)" & vbCrLf & _ " ProductNameCtl.Font.Bold = False" & vbCrLf & _ "End If" c1r.Sections("Detail").OnPrint = script • C# string script = "if ( UnitsInStock < ReorderLevel ) {\r\n" + " ProductNameCtl.ForeColor = RGB(255,0,0)\r\n" + " ProductNameCtl.Font.Bold = true\r\n" + "} else {\r\n" + " ProductNameCtl.ForeColor = RGB(0,0,0)\r\n" + " ProductNameCtl.Font.Bold = false\r\n" + "}"; c1r.Sections("Detail").OnPrint = script; • Delphi script := 'If UnitsInStock < ReorderLevel Then'#13#10' ProductNameCtl.ForeColor = RGB(255,0,0)'#13#10' ProductNameCtl.Font.Bold = True'#13#10'Else'#13#10+ 68 · Using Reports for .NET ' ProductNameCtl.ForeColor = RGB(0,0,0)'#13#10' ProductNameCtl.Font.Bold = False'#13#10'End If'; c1r.Sections['Detail'].OnPrint := script; The code builds a string containing the VBScript event handler, and then assigns it to the section's OnPrint property. (When using the C1Report Designer, you can type the script code directly into the Event Editor window instead of writing the code above.) The control executes the VBScript code whenever the section is about to be printed. The script gets the value of the "ReorderLevel" database field and sets the "ProductName" report field's Font.Bold and ForeColor properties according to the value. If the product is below reorder level, its name becomes bold and red. Here's what the report looks like: Show or hide a field depending on a value Instead of changing the field format to highlight its contents, you could set another field's Visible property to True or False to create special effects. For example, if we created a new field called "BoxCtl" and formatted it to look like a bold rectangle around the product name, then we could change the script as follows: • Visual Basic Dim script As String = _ "If UnitsInStock < ReorderLevel Then" & vbCrLf & _ " ProductNameCtl.ForeColor = RGB(255,0,0)" & vbCrLf & _ " ProductNameCtl.Font.Bold = True" & vbCrLf & _ " BoxCtl.Visible = False" & vbCrLf & _ "Else" & vbCrLf & _ " ProductNameCtl.ForeColor = RGB(0,0,0)" & vbCrLf & _ " ProductNameCtl.Font.Bold = False" & vbCrLf & _ " BoxCtl.Visible = True" & vbCrLf & _ "End If" c1r.Sections("Detail").OnPrint = script • C# string script = "if ( UnitsInStock < ReorderLevel ) {\r\n" + " ProductNameCtl.ForeColor = RGB(255,0,0)\r\n" + " ProductNameCtl.Font.Bold = true\r\n" + VBScript Expressions · 69 " BoxCtl.Visible = false\r\n" + "} else {\r\n" + " ProductNameCtl.ForeColor = RGB(0,0,0)\r\n" + " ProductNameCtl.Font.Bold = false\r\n" + " BoxCtl.Visible = true\r\n" + "}"; c1r.Sections("Detail").OnPrint = script; • Delphi script := 'If UnitsInStock < ReorderLevel Then'#13#10 + ' ProductNameCtl.ForeColor = RGB(255,0,0)'#13#10 + ' ProductNameCtl.Font.Bold = True'#13#10 + ' BoxCtl.Visible = False'#13#10 + 'Else'#13#10' ProductNameCtl.ForeColor = RGB(0,0,0)'#13#10 + ' ProductNameCtl.Font.Bold = False'#13#10' BoxCtl.Visible = True'#13#10'End If'; c1r.Sections['Detail'].OnPrint := script; Prompt users for parameters Instead of highlighting products which are below the reorder level stored in the database, you could have the report prompt the user for the reorder level to use. To get the value from the user, you would change the report's RecordSource property to use a parameter query. (For details on how to build parameter queries, see the Reset the Page Counter (page 70).) • Visual Basic c1r.DataSource.RecordSource = _ "PARAMETERS [Critical Stock Level] Short 10;" & _ c1r.DataSource.RecordSource • C# c1r.DataSource.RecordSource = "PARAMETERS [Critical Stock Level] short 10;" + c1r.DataSource.RecordSource; • Delphi begin c1r.DataSource.RecordSource := 'PARAMETERS [Critical Stock Level] short 10;' + c1r.DataSource.RecordSource; end; This setting causes the control to prompt the user for a "Critical Stock Level" value, which gets stored in a global VBScript variable where your events can use it. The default value for the variable is specified as 10. To use the value specified by the user, the script should be changed as follows: • Visual Basic Dim script As String = _ "level = [Critical Stock Level]" & vbCrLf & _ "If UnitsInStock < level Then" & vbCrLf & _ " ProductNameCtl.ForeColor = RGB(255,0,0)" & vbCrLf & _ " ProductNameCtl.Font.Bold = True" & vbCrLf & _ "Else" & vbCrLf & _ " ProductNameCtl.ForeColor = RGB(0,0,0)" & vbCrLf & _ " ProductNameCtl.Font.Bold = False" & vbCrLf & _ "End If" c1r.Sections("Detail").OnPrint = script 70 · Using Reports for .NET • C# string script = "level = [Critical Stock Level]\r\n" + "if ( UnitsInStock < level ) {\r\n" + " ProductNameCtl.ForeColor = RGB(255,0,0)\r\n" + " ProductNameCtl.Font.Bold = true\r\n" + "} else {\r\n" + " ProductNameCtl.ForeColor = RGB(0,0,0)\r\n" + " ProductNameCtl.Font.Bold = false\r\n" + "}"; c1r.Sections("Detail").OnPrint = script; • Delphi script := 'level = [Critical Stock Level]'#13#10 + 'If UnitsInStock < level Then'#13#10 + ' ProductNameCtl.ForeColor = RGB(255,0,0)'#13#10 + ' ProductNameCtl.Font.Bold = True'#13#10 + 'Else'#13#10 + ' ProductNameCtl.ForeColor = RGB(0,0,0)'#13#10 + ' ProductNameCtl.Font.Bold = False'#13#10 + 'End If'; c1r.Sections['Detail'].OnPrint := script; The change is in the first two lines of the script. Instead of comparing the current value of the "UnitsInStock" filed to the reorder level stored in the database, the script compares it to the value entered by the user and stored in the "[Critical Stock Level]" VBScript variable. Reset the Page Counter The Page variable is created and automatically updated by the control. It is useful for adding page numbers to page headers or footers. In some cases, you may want to reset the page counter when a group starts. For example, in a report that groups records by country and has a calculated page footer field with the expression: • Visual Basic c1r.Fields("PageFooter").Text = "[Country] & "" "" & [Page]" • C# c1r.Fields("PageFooter").Text = "[Country] + "" "" + [Page]"; • Delphi begin c1r.Fields['PageFooter'].Text := '[Country] + " " + [Page]'; end; It would be good to reset the Page variable for each new country. To do this, assign the following script to the country group header section: • Visual Basic c1r.Sections ("CountryGroupHeader").OnPrint = "Page = 1" • C# c1r.Sections ("CountryGroupHeader").OnPrint = "Page = 1"; • Delphi begin c1r.Sections['CountryGroupHeader'].OnPrint := 'Page = 1'; end; VBScript Expressions · 71 Change a Field's dimensions to create a Bar Chart We saved the most sophisticated example for last. Instead of showing a field's value as text, you can change its dimensions to create a chart. (The example described below is included in the NWind.xml sample file that ships with C1Report; it is called "Sales Chart".) To create a chart, the first thing you need to do is find out the scale, that is, the measurements that will be used to the maximum and minimum values. The "Sales Chart" report has a field designed to do this. It is a report footer field called SaleAmountMaxFld that has the size of the longest bar we want to appear on the chart, and holds the following expression: • Visual Basic SaleAmountMaxFld.Text = "Max([SaleAmount])" • C# SaleAmountMaxFld.Text = "Max([SaleAmount])"; • Delphi begin SaleAmountMaxFld.Text := 'Max([SaleAmount])'; end; To draw the actual bars, the report has a detail field called BarFld that is formatted to look like a solid box. The detail section has the following script assigned to its OnPrint event: • Visual Basic c1r.Sections("Detail").OnPrint = & _ "BarFld.Width = SaleAmountMaxFld.Width * " & _ "(SaleAmountFld / SaleAmountMaxFld)" • C# c1r.Sections("Detail").OnPrint = + "BarFld.Width = SaleAmountMaxFld.Width * " + "(SaleAmountFld / SaleAmountMaxFld)"; • Delphi c1r.Sections['Detail'].OnPrint := 'BarFld.Width = SaleAmountMaxFld.Width * (SaleAmountFld / SaleAmountMaxFld)'; This expression calculates the width of the bar based on the width and value of the reference field and on the value of the SaleAmountFld for the current record. The result is a report that looks like this: 72 · Using Reports for .NET Advanced Topics Parameter Queries A parameter query is a query that displays its own dialog box prompting the user for information, such as criteria for retrieving records or a value for a report field. You can design the query to prompt the user for more than one piece of information; for example, you can design it to retrieve two dates. C1Report will then retrieve all records that fall between those two dates. You can also create a monthly earnings report based on a parameter query. When you render the report, C1Report displays a dialog box asking for the month that you want the report to cover. You enter a month and C1Report prints the appropriate report. To create a parameter query, you need to edit the SQL statement in the RecordSource property and add a PARAMETERS clause to it. The syntax used to create parameter queries is the same as that used by Microsoft Access. 1. The easiest way to create a parameter query is to start with a plain SQL statement with one or more items in the WHERE clause, then manually replace the fixed values in the clause with parameters. For example, starting with the plain SQL statement: strSQL = "SELECT DISTINCTROW * FROM Employees " & _ "INNER JOIN (Orders INNER JOIN [Order Subtotals] " & _ "ON Orders.OrderID = [Order Subtotals].OrderID) " & _ "ON Employees.EmployeeID = Orders.EmployeeID " & _ "WHERE (((Orders.ShippedDate) " & _ "Between #1/1/1994# And #1/1/2001#));" 2. The next step is to identify the parts of the SQL statement that will be turned into parameters. In this example, the parameters are the dates in the WHERE clause, shown above in boldface. Let's call these parameters Beginning Date and Ending Date. Since these names contain spaces, they need to be enclosed in square brackets: strSQL = "SELECT DISTINCTROW * FROM Employees " & _ "INNER JOIN (Orders INNER JOIN [Order Subtotals] " & _ "ON Orders.OrderID = [Order Subtotals].OrderID) " & _ "ON Employees.EmployeeID = Orders.EmployeeID " & _ "WHERE (((Orders.ShippedDate) " & _ "Between [Beginning Date] And [Ending Date]));" 3. Finally, the parameters must be identified in the beginning of the SQL statement with a PARAMETERS clause, that includes the parameter name, type, and default value: strSQL = "PARAMETERS [Beginning Date] DateTime 1/1/1994, " & _ "[Ending Date] DateTime 1/1/2001;" & _ "SELECT DISTINCTROW * FROM Employees " & _ "INNER JOIN (Orders INNER JOIN [Order Subtotals] " & _ "ON Orders.OrderID = [Order Subtotals].OrderID) " & _ "ON Employees.EmployeeID = Orders.EmployeeID " & _ "WHERE (((Orders.ShippedDate) " & _ "Between [Beginning Date] And [Ending Date]));" When this statement is executed, the control shows a dialog box prompting the user for Beginning Date and Ending Date values. The values supplied by the user are plugged into the SQL statement and the report is generated only for the period selected by the user. The dialog box is created on-the-fly by C1Report. It includes all parameters in the query, and uses controls appropriate to the parameter type. For example, check boxes are used for Boolean parameters, and date-time picker controls are used for Date parameters. Here is what the dialog box looks like for the SQL statement listed above: Advanced Topics · 73 The syntax for the PARAMETERS clause consists of a comma-separated list of items, ending with a semicolon. Each item describes one parameter and includes the following information: • Parameter name. If the name contains spaces, it must be enclosed in square brackets (for example, [Beginning Date]). The parameter name appears in the dialog box used to collect the information from the user, and it also appears in the WHERE clause for the SQL statement, where it is replaced with the value entered by the user. • Parameter type. The following types are recognized by the control: • Type Name ADO Type Date adDate DateTime adDate Bit, Byte, Short, Long adInteger Currency adCurrency Single adSingle Double adDouble Text, String adBSTR Boolean, Bool, YesNo adBoolean Default value. This is the value initially displayed in the dialog box. The easiest way to build a parameterized query is incrementally. Start with a simple query that works, then add the PARAMETERS clause (don't forget to end the PARAMETERS clause with a semi-colon). Finally, edit the WHERE clause and add the parameter names at the proper place. You can use the GetRecordSource method to retrieve a proper SQL statement (without the PARAMETERS clause) from a parameter query. This is useful if you want to create your own recordset using data contained in the report. Note: Instead of using a parameter query, you could write code in Visual Basic or in C++.NET to create a dialog box, get the information from the user, and fix the SQL statement or set the DataSource Object's Filter property as needed. The advantage of using parameter queries is that it places the parameter logic in the report itself, and it is independent of the viewer application. (It also saves you from writing some code.) Unbound Reports Unbound reports are reports without an underlying source recordset. This type of report can be useful in two situations: • You create documents that have a fixed format, and only the content of a few fields that change every time you need to render the document. Business forms are a typical example: the forms have a fixed format, and the field values change. • You want to consolidate several summary reports into a single one. In this case, you would create an unbound main report, and you would add bound subreports to it. 74 · Using Reports for .NET As an example of a simple unbound report, let's create a simple newsletter without a source recordset. This is done with the C1Report Designer, except that you leave the ConnectionString and RecordSource properties blank and add placeholder fields to the report. The placeholder fields are simple labels whose contents will be set by an application. Assuming you created a report with six placeholder fields named "FldHeadLineXXX" and "FldBodyXXX" (where XXX ranges from 1 to 3), you could use the following Visual Basic code to render the report: • Visual Basic Private Sub MakeReport() ' find report definition file Dim path As String = Application.StartupPath Dim i As Integer = path.IndexOf("\bin") If i > -1 Then path = path.Substring(0, i) path = path & "\" ' load unbound report c1r.Load(path & "Newsletter.xml", "NewsLetter") ' set field values c1r.Fields("FldHeadline1").Text = "C1Report Launched" c1r.Fields("FldBody1").Text = "ComponentOne unveils…" c1r.Fields("FldHeadline2").Text = "Competitive Upgrades" c1r.Fields("FldBody2").Text = "Get ahead …" c1r.Fields("FldHeadline3").Text = "C1Report Designer" c1r.Fields("FldBody3").Text = "The C1Report Designer…" ' done, show the report c1ppv.Document = c1r.Document ' and/or save it to an HTML document so your subscribers ' can get to it over the Web c1r.RenderToFile(path & "Newsletter.htm", FileFormatEnum.HTML) End Sub • C# private void MakeReport() { // find report definition file string path = Application.StartupPath; int i = path.IndexOf("\bin"); if ( i > -1 ) { path = path.Substring(0, i) path = path + "\"; // load unbound report c1r.Load(path + "Newsletter.xml", "NewsLetter"); // set field values c1r.Fields["FldHeadline1"].Text = "C1Report Launched"; c1r.Fields["FldBody1"].Text = "ComponentOne unveils…"; c1r.Fields["FldHeadline2"].Text = "Competitive Upgrades"; c1r.Fields["FldBody2"].Text = "get { ahead …"; c1r.Fields["FldHeadline3"].Text = "C1Report Designer"; c1r.Fields["FldBody3"].Text = "The C1Report Designer…"; Advanced Topics · 75 // done, show the report c1ppv.Document = c1r.Document; } • // and/or save it to an HTML document so your subscribers // can get to it over the Web c1r.RenderToFile(path + "Newsletter.htm", FileFormatEnum.HTML); Delphi procedure MakeReport; var path: String; i: Integer; begin // find report definition file path := Application.StartupPath; i := path.IndexOf('\bin'); if i > -1 then path = path.Substring(0, i); path := path +'\'; // load unbound report c1r.Load(path +'Newsletter.xml','NewsLetter'); // set field values c1r.Fields['FldHeadline1'].Text := 'C1Report Launched'; c1r.Fields['FldBody1'].Text := 'ComponentOne unveils…'; c1r.Fields['FldHeadline2'].Text := 'Competitive Upgrades'; c1r.Fields['FldBody2'].Text := 'Get ahead …'; c1r.Fields['FldHeadline3'].Text := 'C1Report Designer'; c1r.Fields['FldBody3'].Text := 'The C1Report Designer…'; // done, show the report c1ppv.Document := c1r.Document; // and/or save it to an HTML document so your subscribers // can get to it over the Web c1r.RenderToFile(path + 'Newsletter.htm', FileFormatEnum.HTML); end; Here's what this issue of our newsletter looks like. Notice that our simple program does not deal with any formatting at all; it simply supplies the report contents. The report definition created with the C1Report Designer takes care of all the formatting, including a headline with a logo, page footers, fonts and text positioning. Separating format from content is one of the main advantages of unbound reports. 76 · Using Reports for .NET Custom Data Sources By default, C1Report uses the ConnectionString and RecordSource properties to create an internal DataTable object that is used as a data source for the report. However, you can also create your own recordsets and assign them directly to the Recordset property. In this case, C1Report will use the recordset provided instead of opening its own. You can assign three types of objects to the Recordset property: DataTable, DataView or any object that implements the IC1ReportRecordset interface. Using your own DataTable objects The main reason to use your own DataTable objects is in situations where you already have the object available, and want to save some time by not creating a new one. You may also want to implement security schemes or customize the object in some other way. To use your own DataTable object, simply assign it to the RecordSet property before you render the report. For example: • Visual Basic Private Sub CreateReport(strSelect As String, strConn As String) ' fill a DataSet object Dim da As OleDbDataAdapter da = new OleDbDataAdapter(strSelect, strConn) Dim ds As DataSet = new DataSet() da.Fill(ds) ' get the DataTable object Dim dt As DataTable = ds.Tables(0) ' load report c1r.Load "RepDef.xml", "My Report" Advanced Topics · 77 ' render report c1r.DataSource.Recordset = ds.Tables(0) c1ppv.Document = c1r.Document End Sub • C# private void CreateReport(string { strSelect, string strConn) // fill a DataSet object OleDbDataAdapter da; da = new OleDbDataAdapter(strSelect, strConn); DataSet DataSet ds = new DataSet(); da.Fill(ds); // get the DataTable object DataTable dt = ds.Tables[0]; // load report c1r.Load "RepDef.xml", "My Report"; // render report c1r.DataSource.Recordset = ds.Tables[0]; c1ppv.Document = c1r.Document; } • Delphi procedure Class1.CreateReport(strSelect: string; strConn: string); var dt: DataTable; DataSet: DataSet; da: OleDbDataAdapter; begin // fill a DataSet object da := OleDbDataAdapter.Create(strSelect, strConn); ds := DataSet.Create; da.Fill(ds); // get the DataTable object dt := ds.Tables[0]; // load report c1r.Load( 'RepDef.xml', 'My Report'); // render report c1r.DataSource.Recordset := ds.Tables[0); c1ppv.Document := c1r.Document; end; The code above creates a DataTable object using standard ADO.NET calls, and then assigns the table to the Recordset property. Note that you could also create and populate the DataTable object on the fly, without relying on and actual database. 78 · Using Reports for .NET Writing your own custom Recordset object For the ultimate in data source customization, you can implement your own data source object. This option is indicated in situations where: 1. Your data is already loaded in memory. 2. Some or all of the data is calculated on demand, and does not even exist until you request it. 3. The data comes from disparate data sources and you don't have an easy way to create a standard DataTable object from it. To implement your own data source object, you need to create an object that implements the IC1ReportRecordset interface. This interface contains a few simple methods described in the reference section of this document. After you have created the custom data source object, all you need to do is create an instance of it and assign that to the Recordset property. For a complete example, refer to the CustomData sample. Data Security Data security is an important issue for most corporations. If you plan to create and distribute a phone-directory report for your company, you want to show employee names and phone extensions. You probably don't want people to change the report definition and create a report that includes people's salaries. Another concern is that someone could look at the report definition file, copy a connection string and start browsing (or hacking) your database. These are legitimate concerns that affect all types of data-based applications, including C1Report. This section discusses some measures you can take to protect your data. Use Windows NT Integrated security One of the strengths of Windows NT is the way it handles security. When a user logs on, the system automatically gives him a set of permissions granted by the system administrator. After this, each application or service can query Windows NT to see what resources he can access. Most popular database providers offer this type of security as an option. Under this type of scenario, all you need to do is make sure that the people with whom you want to share your data have the appropriate permissions to read it. In this case, the ConnectionString in the report definition file doesn't need to contain any passwords. Authorized users will get to see the data and others will not. Build a ConnectionString with a user-supplied password This is a very simple alternative. Before rendering a report (or when the control reports a "failed to connect" error), you can prompt the user for a password and plug that into the connection string. For example: • Visual Basic ' build connection string with placeholder for password Dim strConn strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\SecureData\People.mdb;" & _ "Password={{THEPASSWORD}};" ' get password from the user Dim strPwd$ strPwd = InputBox("Please enter your password:") If Len(strPwd) = 0 Then Exit Sub ' build new connection string and assign it to the control strConn = Replace(strConn, "{{THEPASSWORD}}", strPwd) vsr.DataSource.ConnectionString = strConn Advanced Topics · 79 • C# // build connection string with placeholder for password string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\SecureData\People.mdb;" + "Password={{THEPASSWORD}};"; // get password from the user string strPwd = InputBox("Please enter your password:"); if (Len(strPwd) = 0) return // build new connection string and assign it to the control strConn = Replace(strConn, "{{THEPASSWORD}}", strPwd); c1r.DataSource.ConnectionString = strConn; • Delphi // build connection string with placeholder for password strConn := 'Provider=Microsoft.Jet.OLEDB.4.0;' + 'Data Source=C:\SecureData\People.mdb;' + 'Password={{THEPASSWORD}};'; // get password from the user strPwd := InputBox('Please enter your password:'); if strPwd.Length = 0 then exit; // build new connection string and assign it to the control strConn := Replace(strConn,'{{THEPASSWORD}}', strPwd); vsr.DataSource.ConnectionString := strConn; Application-defined aliases Another possible scenario is one where you want to allow certain users to see the reports, but you don't want to give them any special authorizations or information about where the data is stored. There are two simple ways to achieve this with C1Report. One is by using embedded reports. Load the report definition into your application at design time, using the Load Report dialog box, and the report will be embedded in the application. This way, you don't have to distribute a report definition file and no one will have access to the data source information. The second way would be for your application to define a set of connection string aliases. The report definition file would contain the alias, and your application would replace it with the actual connection string before rendering the reports. The alias would be useless in any other applications (such as the C1Report Designer). Depending on how concerned you are with security, you could also perform checks on the RecordSource property to make sure no one is trying to get unauthorized access to certain tables or fields in the database. The code below shows how you might implement a simple alias scheme: • Visual Basic Private Sub RenderReport(strReportName As String) ' load report requested by the user c1r.Load("c:\Reports\MyReports.xml", strReportName) ' replace connection string alias Dim strConn$ Select Case c1r.DataSource.ConnectionString Case "$$CUSTOMERS" Case "$$EMPLOYEES" strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\SecureData\People.mdb;" & _ "Password=slekrsldksd;" 80 · Using Reports for .NET Case "$$SALES" strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\SecureData\Numbers.mdb;" & _ "Password=slkkdmssids;" End Select ' set connection string, render report c1r.DataSource.ConnectionString = strConn ppv1.Document = c1r.Document End Sub • C# private void RenderReport(string strReportName) { // load report requested by the user c1r.Load("c:\Reports\MyReports.xml", strReportName); // replace connection string alias string strConn$; switch (i) { c1r.DataSource.ConnectionString; } } • case "$$CUSTOMERS"; case "$$EMPLOYEES"; strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + _ "Data Source=C:\SecureData\People.mdb;" + "Password=slekrsldksd;"; case "$$SALES"; strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\SecureData\Numbers.mdb;" + "Password=slkkdmssids;"; // set connection string, render report c1r.DataSource.ConnectionString = strConn; ppv1.Document = c1r.Document; Delphi procedure RenderReport(strReportName: string); var strConn: string; begin // load report requested by the user c1r.Load('c:\Reports\MyReports.xml', strReportName) // replace connection string alias if (c1r.DataSource.ConnectionString = '$$CUSTOMERS') or (c1r.DataSource.ConnectionString = '$$EMPLOYEES') then strConn := 'Provider=Microsoft.Jet.OLEDB.4.0;' + 'Data Source=C:\SecureData\People.mdb;' + 'Password=slekrsldksd;' else if c1r.DataSource.ConnectionString = '$$SALES' then strConn := 'Provider=Microsoft.Jet.OLEDB.4.0;' + 'Data Source=C:\SecureData\Numbers.mdb;' + 'Password=slkkdmssids;' else Advanced Topics · 81 strConn := ''; // set connection string, render report c1r.DataSource.ConnectionString := strConn; ppv1.Document := c1r.Document; end; Custom datasets You can also assign an arbitrary dataset created by your application to the Recordset object. This way, you can adopt whatever security measures you see fit, and you don't need to bother with the ConnectionString and RecordSource properties at all. Using the C1Report Designer · 83 Using the C1Report Designer The C1Report Designer is a tool used for creating and editing C1Report report definition files. The Designer allows you to create, edit, load, and save files (xml) that can be read by the C1Report component. It also allows you to import report definitions from Microsoft Access files (MDB) and VSReport 1.0 (vsr). To run the Designer, double-click the C1ReportDesigner.exe file. Here's what the designer looks like: The main Designer window has the following components: • Menu bar: Provides access to the main Designer functions. Use the File menu to load and save report definition files, to import report definitions, and to print reports. • Main toolbar: Provides shortcuts to the most common menu functions: new file, open, import, save, print, undo/redo, cut/copy/paste, create/delete report, and help. • View toolbar: Switches between preview and design modes, activates the design grid, and displays the property and grouping windows. • Toolbox: Provides tools for creating report fields. This toolbar is enabled only in design mode. • Format toolbar: Provides tools for aligning, sizing, and spacing report fields. This toolbar is enabled only in design mode. • Report list: Lists all reports contained in the current report definition file. You can double-click a report name to preview or edit the report. You can also use the list to rename, copy and delete reports. • Property window: Allows you to edit properties for the objects that are selected in the designer. • Preview/Design pane: This is the main working area of the Designer. In preview mode, it displays the current report. In design mode, it shows the report's sections and fields and allows you to change the report definition. 84 · Using the C1Report Designer • Status bar: The status bar displays information about what the Designer is working on (for example, loading, saving, printing, rendering, importing, etc). The following sections explain how you can use the C1Report Designer to create, edit, use, and save report definition files. Creating a basic report definition You can design your report to display your data in a variety of ways on the printed page. Using the C1Report Designer, you can design comprehensive lists, summaries, or special subsets of data, like an invoice. The easiest way to start a new report is to use the Report Wizard. Click the New Report button on the main toolbar, or on the File menu, select New Report. The Report Wizard will appear, and will guide you through five easy steps. Creating a basic report definition · 85 1. Select the data source for the new report. Use this page to select the ConnectionString and RecordSource that will be used to retrieve the data for the report. You can specify the ConnectionString in three ways: • Type the string directly into the editor. • Use the drop down list to select a recently used connection string (the Designer keeps a record of the last eight connection strings). • Click the button with the ellipsis button (…) to bring up the standard connection string builder. You can specify the RecordSource string in two ways: • Click the Table button and select a table from the list. • Click the SQL button and type (or paste) an SQL statement into the editor. 2. Select the fields you want to include in the report. This page contains a list of the fields available from the recordset you selected in Step 1, and two lists that define the group and detail fields for the report. Group fields define how the data will be sorted and summarized, and detail fields define what information you want to appear in the report. You can move fields from one list to another by dragging them. Drag fields into the Detail list to include them in the report, or drag within the list to change their order. Drag fields back into the Available list to remove them from the report. 86 · Using the C1Report Designer 3. Select the layout for the new report. This page offers you several options to define how the data will be organized on the page. When you select a layout, a thumbnail preview appears on the left to give you an idea of what the layout will look like on the page. There are two groups of layouts, one for reports that have no groups and one for reports with groups. Select the layout that best approximates what you want the final report to look like. This page also allows you to select the page orientation and whether fields should be adjusted to fit the page width. The Labels layout option is used to print Avery-style labels. If you select this option, you will see a page that prompts you for the type of label you want to print. Creating a basic report definition · 87 4. Select the Style for the new report. • Group and No Group Layouts This page allows you to select the fonts and colors that will be used in the new report. Like the previous page, it shows a preview to give you an idea of what each style looks like. Select the one that you like best (and remember, you can refine it and adjust the details later). 88 · Using the C1Report Designer • Label Layout Only This page allows you to select the type of label you want to create. The Designer has over 170 predefined label types for you to choose from. The labels are divided into four groups, depending on whether they use metric or English measurements, and on the type of paper they use (sheets or continuous forms). Creating a basic report definition · 89 5. Select a Title for the new report. This last page allows you to select a title for the new report and to decide whether you would like to preview the new report right away or whether you would like to go into edit mode and start improving the design before previewing it. 90 · Using the C1Report Designer If you choose to preview the report and click finish, you will immediately see the report in the preview pane of the Designer. It should look like this: Modifying the report layout The report generated for you by the wizard is a good starting point, but you will usually need to adjust and enhance it to get exactly what you want. You can do this with the Designer. Modifying the report layout · 91 To start using the designer, click the Design button on the View toolbar or select Design in the View menu. The right pane of the main window will switch from Review mode into Design mode, and it will show the controls and fields that make up the report: The picture shows how the report is divided into sections (Header, Page Header, etc). The sections contain fields that hold the labels, variables, and expressions that you want in the printed report. In our example, the Header section contains a label with the report title. The Page Header section contains labels that identify the fields in the Detail section, and the Page Footer section contains fields that show the current time, the page number and the total page count for the report. The sections of the report determine what each page, group, and the beginning and end of the report look like. The table below describes where each section appears in the report and what it is typically used for. Section Appears Report header Once per report Typically Contains The report title and summary information for the whole report. Page header Once per page Labels that describe detail fields, and/or page numbers. Group header Once per group Fields that identify the current group, and possibly aggregate values for the group (for example, total, percentage of the grand total). Detail Once per record Fields containing data from the source recordset. Group footer Once per group Aggregate values for the group. Page footer Once per page Page number, page count, date printed, report name. Report footer Once per report Summary information for the whole report. Note that you cannot add and delete sections directly. The number of groups determines the number of sections in a report. Every report has exactly five fixed sections (Report Header/Footer, Page Header/Footer, and Detail) plus two sections per group (a Header and a Footer). You can hide sections that you don't want to display by setting their Visible property to False. To enhance your report, you can add lines, rectangles, and pictures to any section. You can also modify the existing fields and sections by changing their properties with the Property window, or move and resize them with the mouse. To resize a section, drag its border to the position where you want it. The rulers on the left and on top of the design window show the size of each section (excluding the page margins). Note that you cannot make the 92 · Using the C1Report Designer section smaller than the height and width required to contain the fields in it. To reduce the size of a section beyond that, move or resize the fields in it first, then resize the section. To see how this works, move the mouse to the area between the bottom of the Page Header section and the gray bar on top of the Detail section. The mouse cursor will change to show that you are over the resizing area. Click the mouse and drag the line down until the section is about twice its original height. Release the button and the section will be resized. Selecting, Moving, and Copying Fields You can use the mouse to select fields in the report designer as usual: • Click a field to select it. • Shift-click a field to toggle its selected state. • Control-drag creates a copy of the selected fields. • Click the empty area and drag to select multiple fields. • Drag field corners to resize fields. • Double-click right or bottom field corners to autosize the field. To select fields that intersect vertical or horizontal regions of the report, click and drag the mouse on the rulers along the edges of the designer. If fields are small or close together, it may be easier to select them by name. You can select fields and sections by picking them from the drop-down list above the Property window. The Show Grid and Snap to Grid buttons provide a grid that helps position controls at discrete positions. While the grid is on, the top left corner of the fields will snap to the grid when you create or move fields. You can change the grid units (English or metric) by selecting Options in the View menu. When multiple fields are selected, you can use the buttons on the Format toolbar to align, resize, and space them. When you click any of these buttons, the last field in the selection is used as a reference and the settings are applied to the remaining fields in the selection. The Apply Style button applies the style of the reference field to the entire selection. The style of a field includes all font, color, line, alignment, and margin properties. You can use the property grid to apply set the value of individual properties to the entire selection. If some fields overlap, you can control their z-order using the Bring to Front/Send to Back buttons. This will determine which fields are rendered before (behind) the others. The Report Designer also allows you to select and move fields using the keyboard: • Use the TAB key to select the next field. • Use SHIFT-TAB to select the previous field. • Use the arrow keys to move the selection one pixel at a time (or shift arrow to by 5 pixels). • Use the DELETE key to delete the selected fields. • When a single field is selected, you can type into it to set the Text property. Changing Field, Section, and Report properties · 93 After you have placed the fields in the desired positions, you can lock them to prevent inadvertently moving them with the mouse or keyboard. Use the Lock Fields button to lock and unlock the fields. Changing Field, Section, and Report properties Once an object is selected, you can use the Property window to edit its properties. When one or more fields are selected, the Property window will show property values that all fields have in common, and will leave the other properties blank. If no fields are selected and you click on a section (or on the bar above a section), the Section properties will be displayed. If you click the gray area in the background, the Report properties will be displayed. To see how this works, click the label in the Header section and change its Font and ForeColor properties. You can also change a field's position and dimensions by typing new values for the Left, Top, Width, and Height properties. The Property window expresses all measurements in twips (the native unit used by C1Report), but you can type in values in other units (in, cm, mm, pix, pt) and they will be automatically converted into twips. For example, if you set the field's Height property to "0.5in", the Property window will convert it into 720 twips. Changing the data source The data source is defined by the ConnectionString, RecordSource, and Filter properties. These are regular Report properties and may be set using the Property window and clicking on the background area where there are no sections. Or click the DataSource button to get a dialog box that allows you to set the ConnectionString and RecordSource properties directly. Adding fields to the report Use the ToolBox to add fields to your report. Each button creates a field and initializes its properties as follows: Button Name Description Label field Creates a field that displays static text. Bound field Creates a field that is bound to the source recordset. When you click this button, a menu appears and you can select the recordset field. Bound Fields are not limited to displaying raw data from the database. You can edit their Text property and use any VBScript expression. Checkbox field Creates a bound field that displays a Boolean value as a check box. By default, the checkbox displays a regular checkmark. You can change it into a radio button or crossmark by changing the value of the field's Checkbox property after it has been created. 94 · Using the C1Report Designer Button Name Description Barcode field Creates a field that displays a barcode. When you click this button, a menu appears where you can select other fields that are contained in the same report definition file to be displayed as a barcode. RTF field Creates a RTF field. When you click this button, a menu appears where you can select other fields that are contained in the same report definition file to be displayed in RTF format. Expression field Creates a calculated field. When you click this button, the code editor dialog box will appear so you can enter the VBScript expression whose value you want to display. Common expression field Creates a field with a commonly used expression. When you click this button, a menu appears and you can select expressions that render the date or time when the report was created or printed, the page number, page count, or "page n of m", or the report name. Unbound Picture field Creates a field that displays a static picture, such as a logo. When you click this button, a dialog box will appear to prompt you for a picture file to insert in the report. A copy will be made of the picture you select and placed in the same directory as the report file. You must distribute this file with the application unless you embed the report file in the application. When you embed a report file in your application, any unbound picture files are embedded too. Bound Picture field Creates a field that displays a picture (or object) stored in the recordset. When you click this button, a menu appears so you can select a picture field in the source recordset (if there is one; not all recordsets contain this type of field). Line field Creates a line. Lines are often used as separators. Rectangle field Creates a rectangle. Rectangles are often used to highlight groups of fields or to create tables and grids. Subreport field Creates a field that displays another report. When you click this button, a menu appears and you can select other reports that are contained in the same report definition file. Page Break field Creates a field that inserts a page break. After you click any of these buttons, drag the mouse over the report and the cursor will change into a crosshair. Click and drag to define the rectangle that the new field will occupy, and then release the button to create the new field. If you change your mind, hit the ESC key or click the arrow button to cancel the operation. Note that C1Report only has one type of Field object. The buttons simply set some properties on the Field object to make it look and act in a certain way. Linking subreports to the main report · 95 You can also add fields by copying and pasting existing fields, or by holding down the control key and dragging a field or group of fields to a new position to create a copy. To see how this works, click the Unbound Picture button and select a picture file. Then move the mouse over the Page Header section and mark a rectangular area above the first label. The picture you selected will appear in the area you marked. Linking subreports to the main report Subreports are regular reports contained in a field in another report (the main report). Subreports are usually designed to display detail information based on a current value in the main report, in a master-detail scenario. For example, the main report may contain orders, and a subreport in the detail section will contain order details for the current order. This master-detail relationship is controlled by the Text property of the subreport field. This property should contain an expression that evaluates into a filter condition that can be applied to the subreport data source. The Report Designer can build this expression automatically for you. Right-click the subreport field and select the Link Subreport menu. This will show a dialog that allows you to select which fields should be linked. Once you make a selection and click OK, the Report Designer will build the link expression and assign it to the Text property of the subreport field. In this case, the expression is: "[OrderID] = '" & [OrderID] & "'" Grouping and sorting data After designing the basic layout, you may decide that grouping the records by certain fields or other criteria would make the report easier to read. Grouping allows you to separate groups of records visually and display introductory and summary data for each group. The group break is based on a grouping expression. This expression is usually based on one or more recordset fields but it can be as complex as you like. Groups are also used for sorting the data, even if you don't plan to show the Group Header and Footer sections. To add or edit the groups in the report, click the Sorting and Grouping button or select in the View menu Grouping Window. The Sorting and Grouping dialog box will appear. You can use this dialog box to create, edit, reorder, and delete groups. To create a group, click the Add button and set the properties for the new group. The Group By field defines how the records will be grouped in the report. For simple grouping, you can select fields directly from the drop-down list. For more complex grouping, you can type grouping expressions. For 96 · Using the C1Report Designer example, you could use "Country" to group by country or "Left(Country, 1)" to group by country initial. To follow along with our report, select "Country" for the Group By expression. Next, select the type of sorting you want ("Ascending" in our example). You can also specify whether the new group will have visible Header and Footer sections, and whether the group should be rendered together on a page. Note: You cannot use memo or binary (object) fields for grouping and sorting. This is a limitation imposed by OLEDB. Here's what the Sorting and Grouping dialog box should look like at this point: If you add more fields, you can change their order using the arrow buttons on the right of the group list. This will automatically adjust the position of the Group Header and Footer sections in the report. To delete a field, use the Delete button. Once you are done arranging the fields, click OK to dismiss the dialog box and see the changes in the Designer. There are two new sections, a Header and Footer for the new group. Both have height zero at this point, you can expand them by dragging the edges with the mouse. Notice that the group header section is visible, and the footer is not. This is because we checked the Group Header button in the dialog, and left the Group Footer button unchecked. Invisible sections are displayed with a hatch pattern to indicate they are invisible. On the gray bars that mark the top of the new sections there are labels that contain the section name and the value of the group's GroupBy property. Previewing and printing your report · 97 To see how groups work, click the Bound Field button, select "Country" from the menu and mark an area in the newly created Group Header Section. Click the new field to select it and change its Font property to make the new field stand out a little. Previewing and printing your report To preview a report, select it from the Report List on the left pane of the Designer window and click the Preview button, or select the Preview in the View menu. The report will be displayed on the right pane, as shown below: The main window has a preview navigation toolbar, with buttons that let you page through the document and select the zoom mode. At this point, you can print the report by clicking the Print button or in the File menu, select Print. Exporting and publishing your report Instead of printing the report, you may want to export it into a file and distribute it electronically to your clients or co-workers. The Designer supports several export formats, listed below: Format Description Excel Creates an XLS file that can be opened by Microsoft Excel. Paged HMTL Creates one HTML file for each page in the report. The HTML pages contain links that let the user navigate the report. Drill-Down HTML Creates a single HTML file with sections that can be collapsed and expanded by the user by clicking on them. Plain HMTL Creates a single HTML file with no drill-down functionality. PDF Creates a PDF file that can be viewed on any computer equipped with Adobe's Acrobat viewer or browser plug-ins. PDF with embedded fonts Creates a PDF file with embedded font information for extra portability. This option significantly increases the size of the PDF file. 98 · Using the C1Report Designer Format Description RTF Creates an RTF file that can be opened by most popular word processors (for example, Microsoft Word, WordPad). Text Creates a plain text file. TIFF Creates a multi-page TIFF file. To create an export file, in the File menu select Export and use the File Save dialog box to select the type of file you want to create, its name, and location. Saving your report definition When you are done creating and viewing your report, use the Save button or the in the File menu, select Save to save the report definition file. The Designer will save the report definition in XML format, which can be read back into the Designer or directly into a C1Report component. Managing your report definition files A report definition file may contain several reports. Occasionally, you may want to copy or move a report from one file to another. To move a report from one file to another, open two instances of the Designer and drag the report from one instance to the other. If you hold down the control key while doing this, the report will be copied. Otherwise, it will be moved. You can also copy a report within a single file. This will create a new copy of the report, which is a good way to start designing a new report that is similar to an existing one. Note that the report definition files are saved in XML, so you can also edit and maintain them using any text editor. Importing Microsoft Access reports One of the most powerful features of the C1Report Designer is the ability to import reports created with Microsoft Access. This feature requires Access to be installed on the computer. Once the report is imported into the Designer, Access is no longer required. To import reports from an Access file, click the Import button or in the File menu, select Import. A dialog box will prompt you for the name of the file you want to import. Importing Microsoft Access reports · 99 Select a Microsoft Access file (MDB or ADP) and the designer scan the file and show a dialog where you can select which reports you would like to import: The dialog also allows you to specify if the designer should clear all currently defined reports before starting the import process. The import process handles most elements of the source reports, with a few exceptions listed below: • Event handler code Access reports can use VBA, macros and forms to format the report dynamically. C1Report can do the same things, but it only uses VBScript. Because of this, all report code needs to be translated manually. • Form-oriented field types Access reports may include certain fields that are not handled by the Designer's import procedure. The field types not supported are Chart, CommandButton, ToggleButton, OptionButton, OptionGroup, ComboBox, ListBox, TabCtl, and CustomControl. • Reports that use VBScript reserved words Because Access does not use VBScript, you may have designed reports that use VBScript reserved words as identifiers for report objects or dataset field names. This causes problems when the VBScript engine tries to evaluate the expression, and will prevent the report from rendering correctly. Reserved words you shouldn't use as identifiers include Date, Day, Hour, Length, Minute, Month, Second, Time, TimeValue, Value, Weekday, and Year. For a complete list, please refer to a VBScript reference. • Reports that sort dates by quarter (or weekday, month of the year, and so on) C1Report uses the ADO.NET dataset Sort property to sort groups. This property sorts datasets according to field values only and does not take expressions. (Note that you can group according to an arbitrary expression, but you can't sort.) An Access report that sorts groups by quarter will sort them by date after it is imported. To fix this, you have two options: Either create a field that contains the value for the expression you want to sort on or change the SQL statement that creates the dataset and perform the sorting that way. These limitations affect a relatively small number of reports, but you should preview all reports after importing them, to make sure they still work correctly. 100 · Using the C1Report Designer To illustrate how the Designer fares in a real-life example, try importing the NWind.mdb file. It contains 13 reports, listed below with some comments. (The NWind.XML file that ships with C1Report already contains all the modifications described below.) 1. Alphabetical List of Products No action required. 2. Catalog No action required. 3. Customer Labels No action required. 4. Employee Sales by Country This report contains code which needs to be translated manually. The following code should be assigned to the Group 1 Header Section's OnPrint event: • Visual Basic If SalespersonTotal > 5000 Then ExceededGoalLabel.Visible = True SalespersonLine.Visible = True Else ExceededGoalLabel.Visible = False SalespersonLine.Visible = False End If • C# if ( SalespersonTotal > 5000 ) { ExceededGoalLabel.Visible = true; SalespersonLine.Visible = true; } else { ExceededGoalLabel.Visible = false; SalespersonLine.Visible = false; } • Delphi begin if (SalespersonTotal > 5000) then begin ExceededGoalLabel.Visible := True; SalespersonLine.Visible := True; end else begin ExceededGoalLabel.Visible := False; SalespersonLine.Visible := False; end; end; 5. Invoice No action required. 6. Products by Category No action required. 7. Sales by Category Importing Microsoft Access reports · 101 This report contains a Chart control that is not imported. To add a chart to your report, you could use an unbound picture field, then write a VB event handler that would create the chart and assign it to the field as a picture. 8. Sales by Category Subreport No action required. 9. Sales by Year This report contains code and references to a Form object which need to be translated manually. To replace the Form object, edit the RecordSource property to add a [Show Details] parameter: • Visual Basic PARAMETERS (Beginning Date) DateTime 1/1/1994, (Ending Date) DateTime 1/1/2001, (Show Details) Boolean False; ... • C# PARAMETERS [Beginning Date] DateTime 1/1/1994, [Ending Date] DateTime 1/1/2001, [Show Details] Boolean False; ... • Delphi PARAMETERS [Beginning Date] DateTime 1/1/1994, [Ending Date] DateTime 1/1/2001, [Show Details] Boolean False; ... Use the new parameter in the report's OnOpen event: • Visual Basic Report.OnOpen = "b = [Show Details]" & vbCrLf & _ " Detail.Visible = b" & vbCrLf & _ " [Group 0 Footer].Visible = b" & vbCrLf & _ " DetailsLabel.Visible = b" & vbCrLf & _ " LineNumberLabel2.Visible = b" & vbCrLf & _ " Line15.Visible = b" & vbCrLf & _ " SalesLabel2.Visible = b" & vbCrLf & _ " OrdersShippedLabel2.Visible = b" & vbCrLf & _ " ShippedDateLabel2.Visible = b" & vbCrLf & _ " Line10.Visible = b" • C# Report.OnOpen = "b = [Show Details]" + " Detail.Visible = b\r\n" + " [Group 0 Footer].Visible = b\r\n" + " DetailsLabel.Visible = b\r\n" + " LineNumberLabel2.Visible = b\r\n" + " Line15.Visible = b\r\n" + " SalesLabel2.Visible = b\r\n" + " OrdersShippedLabel2.Visible = b\r\n" + " ShippedDateLabel2.Visible = b\r\n" + " Line10.Visible = b"; • Delphi Report.OnOpen := 'b = [Show Details]'#13#10 + ' Detail.Visible = b'#13#10 + ' [Group 0 Footer].Visible = b'#13#10 + ' DetailsLabel.Visible = b'#13#10 + ' LineNumberLabel2.Visible = b'#13#10 + 102 · Using the C1Report Designer ' ' ' ' ' Line15.Visible = b'#13#10 + SalesLabel2.Visible = b'#13#10 + OrdersShippedLabel2.Visible = b'#13#10 + ShippedDateLabel2.Visible = b'#13#10 + Line10.Visible = b'; Finally, two more lines of code need to be translated: • Visual Basic Sections ("Detail").OnPrint = _ "PageHeader.Visible = True" Sections("Group 0 Footer).OnPrint = _ "PageHeader.Visible = False" • C# Sections ("Detail").OnPrint = "PageHeader.Visible = true"; Sections("Group 0 Footer).OnPrint = "PageHeader.Visible = false"; • Delphi begin Sections['Detail'].OnPrint := 'PageHeader.Visible = True'; Sections['Group 0 Footer'].OnPrint := 'PageHeader.Visible = False'; end; 10. Sales by Year Subreport No action required. 11. Sales Totals by Amount This report contains code that needs to be translated manually. The following code should be assigned to the Page Header Section's OnPrint event: • Visual Basic PageTotal = 0 • C# PageTotal = 0; • Delphi PageTotal := 0; The following code should be assigned to the Detail Section's OnPrint event: • Visual Basic PageTotal = PageTotal + SaleAmount HiddenPageBreak.Visible = (Counter = 10) • C# PageTotal = PageTotal + SaleAmount; HiddenPageBreak.Visible = (Counter = 10); • Delphi PageTotal := PageTotal + SaleAmount; HiddenPageBreak.Visible := Counter = 10; Importing Crystal reports · 103 12. Summary of Sales by Quarter This report has a group that is sorted by quarter (see item 4 above). To fix this, add a field to the source dataset that contains the value of the ShippedDate quarter, by changing the RecordSource property as follows: SELECT DISTINCTROW Orders.ShippedDate, Orders.OrderID, [Order Subtotals].Subtotal, DatePart("q",Orders.ShippedDate) As ShippedQuarter FROM Orders INNER JOIN [Order Subtotals] ON Orders.OrderID = [Order Subtotals].OrderID WHERE (((Orders.ShippedDate) Is Not Null)); Change the group's GroupBy property to use the new field, ShippedQuarter. 13. Summary of Sales by Year No action required. Summarizing the information on the table: out of 13 reports imported from the NorthWind database, eight did not require any editing, three required some code translation, one required changes to the SQL statement and one had a chart control that was not replaced. Importing Crystal reports The C1Report Designer can also import Crystal report definition files (.rpt files). To import reports from a Crystal report definition file, click the Import button or in the File menu, select Import. A dialog box will prompt you for the name of the file you want to import. Select a Crystal report definition file (RPT) and the designer will convert the report into the C1Report format. The import process handles most elements of the source reports, with a few exceptions for elements that are not exposed by the Crystal object model or not supported by C1Report. The exceptions include image fields, charts, and cross-tab fields. Load report definitions · 105 C1Report Task-Based Help The task-based help assumes that you are familiar with programming in .NET, have a basic knowledge of reports, and know how to use controls in general. By following the steps outlined in the help, you will be able to create projects demonstrating a variety of C1Report features, and get a good sense of what the C1Report component can do. Most of the topics below have pre-built reports that illustrate them. The pre-built reports can be found in the CommonTasks.xml report definition file, which is available for download from the ComponentOne HelpCentral Sample page. Load report definitions C1Report works by combining a report definition with raw data to create reports. In order to create reports, you need to load the report definition into C1Report. There are several ways to do that: Load a report definition from a file You can use the C1Report Designer to create report definition files. Report definition files are XML files that may contain one or more report definitions. For details on how to use the C1Report Designer, see the Using the C1Report Designer (page 83) section of the documentation. To load a report definition from a file at design time, right-click the C1Report component and select the Load Report menu option. Use the Report Picker dialog to select the report you want, click Load and close the dialog. This is what the report picker dialog looks like: To load a report definition from a file at run time, use the C1Report Load method. It takes as parameters the name of the report definition file and the name of the report you want to load. If you want to list the reports contained in a report definition file, use the C1Report GetReportInfo method. It returns a list of the reports in the file. For example: • Visual Basic ' get list of reports in a report definition file Dim reports As String() = c1r1.GetReportInfo(reportFile) 106 · C1Report Task-Based Help ' load first report into c1r1 component c1r1.Load(reportFile, reports(0)) • C# // get list of reports in a report definition file string[] reports = c1r1.GetReportInfo(reportFile); // load first report into c1r1 component c1r1.Load(reportFile, reports[0]); • Delphi var reportFile: String; reports: array of String; // defined elsewhere begin // get list of reports in a report definition file reports := c1r1.GetReportInfo(reportFile); // load first report into c1r1 component c1r1.Load(reportFile, reports[0]); end; Create or modify a report definition at design time You can also use the C1Report Designer directly from Visual Studio, without report definition files. To create or edit a report definition at design time, right-click the C1Report component and select the Edit Report menu option. This will start the C1Report Designer, where you can change the report definition. When you are done, close the designer and the component will be automatically updated with the modified report definition. Load a report definition from a string C1Report has a ReportDefinition property that allows you to get or set the entire report definition as a string. This is a convenient way to store and retrieve report definitions in databases or in data structures within your application. The ReportDefinition string contains the exact same XML that would be stored in the report definition file. For example: • Visual Basic ' load report definition into c1r1 component c1r1.Load(reportFile, reportName) ' copy report definition to the clipboard Dim repDef As String = c1r1.ReportDefinition Clipboard.SetDataObject(repDef) ' copy report definition to c1r2 component c1r2.ReportDefinition = repDef • C# // load report definition into c1r1 component c1r1.Load(reportFile, reportName); // copy report definition to the clipboard string repDef = c1r1.ReportDefinition; Clipboard.SetDataObject(repDef); Load report data · 107 // copy report definition to c1r2 component c1r2.ReportDefinition = repDef; • Delphi var reportFile: String; reportName: String; repDef: String; // defined elsewhere // defined elsewhere begin // load report definition into c1r1 component c1r1.Load(reportFile, reportName); // copy report definition to the clipboard repDef := c1r1.ReportDefinition; Clipboard.SetDataObject(repDef); // copy report definition to c1r2 component c1r2.ReportDefinition := repDef; end; Create a report definition using code C1Report exposes a rich object model that allows you to create entire reports using code. That is how the C1Report Designer works. It starts with a Wizard that presents some options to the user, then adds groups and fields to the report based on the user's choices. This is useful in cases where you want to create your own report designers, fully customized ad-hoc reports, or special reports without a pre-defined structure (i.e. data schema). Load report data In addition to a report definition, C1Report needs the actual data to create the report. In most cases, the data comes from a database, but there are other options. Let C1Report load the data from a database The simplest option for loading the report data is to set the C1Report DataSource properties ConnectionString and RecordSource. If these properties are set, C1Report uses them to load the data from the database automatically and no additional work is needed. Let C1Report load the data from an XSD file Another option is to set the ConnectionString property to the name of an XSD file. XSD files contain XML representations of ADO.NET DataSet objects. In this case, set the RecordSource property to the name of a table in the DataSet. Note: To create an XSD file, take an existing DataSet object and call the WriteXml method using the XmlWriteMode.WriteSchema parameter. Use a DataTable object as a data source Many applications need to work on the data outside of C1Report and load it into DataTable objects. In these cases, you may use these objects as report data sources, avoiding the need to load them again when rendering the report. 108 · C1Report Task-Based Help This approach is also useful in applications where: • Security restrictions dictate that connection strings must be kept private and only the data itself may be exposed (not its source) • The database is not supported by OleDb (the provider used internally by C1Report). • The data does not come from a database at all. Instead, the DataTable is created and populated using custom code. To use a DataTable object as a C1Report data source, simply load the report definition and then assign the DataTable to the C1Report Recordset property. For example: • Visual Basic ' load DataTable from cache or from a secure/custom provider Dim dt As DataTable = GetMyDataTable() ' load report definition (before setting the data source) c1r1.Load(reportFile, reportName) ' use DataTable as the data source for the c1r1 component c1r1.DataSource.Recordset = dt • C# // load DataTable from cache or from a secure/custom provider DataTable dt = GetMyDataTable(); // load report definition (before setting the data source) c1r1.Load(reportFile, reportName); // use DataTable as the data source for the c1r1 component c1r1.DataSource.Recordset = dt; • Delphi var reportFile: String; reportName: String; dt: DataTable; // defined elsewhere // defined elsewhere begin // load DataTable from cache or from a secure/custom provider dt := GetMyDataTable(); // load report definition (before setting the data source) c1r1.Load(reportFile, reportName); // use DataTable as the data source for the c1r1 component c1r1.DataSource.Recordset := dt; end; Use a custom data source objects Finally, you can use custom objects as data sources. The only requirement is that the custom object must implement the IC1ReportRecordset interface. IC1ReportRecordset is a simple and easy-to-implement interface that can be added easily to virtually any collection of data. This is often more efficient than creating a DataTable object and copying all the data into it. For example, you could use custom data source objects to wrap a file system or custom XML files. Render reports (preview, print, export) · 109 To use a custom data source objects, load the report definition and then assign the object to the C1Report Recordset property. For example: • Visual Basic ' get custom data source object Dim rs As IC1ReportRecordset = CType(GetMyCustomDataSource(), IC1ReportRecordset) ' load report definition (before setting the data source) c1r1.Load(reportFile, reportName) ' use custom data source object in c1r1 component c1r1.DataSource.Recordset = rs • C# // get custom data source object IC1ReportRecordset rs = (IC1ReportRecordset)GetMyCustomDataSource(); // load report definition (before setting the data source) c1r1.Load(reportFile, reportName); // use custom data source object in c1r1 component c1r1.DataSource.Recordset = rs; • Delphi var reportFile: String; reportName: String; rs: IC1ReportRecordset; // defined elsewhere // defined elsewhere begin // get custom data source object rs := GetMyCustomDataSource() as IC1ReportRecordset; // load report definition (before setting the data source) c1r1.Load(reportFile, reportName); // use custom data source object in c1r1 component c1r1.DataSource.Recordset := rs; end; Render reports (preview, print, export) Once the report definition has been loaded into the component and a data source has been defined, you can render the report to the printer, into preview controls, or to report files. Print reports To print a report directly to the printer, use the C1Report Document property. This property returns a standard PrintDocument object that has a Print method and exposes printer and page settings. For example, the code below shows a print dialog and prints the report: • Visual Basic ' load report definition c1r1.Load(reportFile, reportName); 110 · C1Report Task-Based Help ' get PrintDocument object PrintDocument doc = c1r1.Document; ' show a PrintDialog so user can customize the printing Dim pd As PrintDialog = New PrintDialog() ' use PrinterSettings in report document pd.PrinterSettings = doc.PrinterSettings; ' show the dialog and print the report If pd.ShowDialog() = DialogResult.OK Then doc.Print(); End If ' cleanup and release PrintDialog resources pd.Dispose() • C# // load report definition c1r1.Load(reportFile, reportName); // get PrintDocument object PrintDocument doc = c1r1.Document; // show a PrintDialog so user can customize the printing PrintDialog pd = new PrintDialog(); // use PrinterSettings in report document pd.PrinterSettings = doc.PrinterSettings; // show the dialog and print the report if (pd.ShowDialog() == DialogResult.OK) doc.Print(); // cleanup and release PrintDialog resources pd.Dispose(); • Delphi var reportFile: String; reportName: String; doc: PrintDocument; pd: PrintDialog; // defined elsewhere // defined elsewhere begin // load the report definition c1r1.Load(reportFile, reportName); // get PrintDocument object doc := c1r1.Document; // show a PrintDialog so user can customize the printing pd := PrintDialog.Create(); // user PrinterSettings in report document pd.PrinterSettings := doc.PrinterSettings; Render reports (preview, print, export) · 111 // show the dialog and print the report if (pd.ShowDialog() = DialogResult.OK) then doc.Print(); // cleanup and release PrintDialog resources pd.Dispose(); end; Preview reports You can also use the use the C1Report Document property to preview the report. Assign it to the Document property in the C1Preview control or to the .NET PrintPreview or PrintPreviewDialog controls and the preview controls will display the report and allow the user to browse, zoom, or print it. For example: • Visual Basic ' load report definition c1r1.Load(reportFile, reportName) ' preview the document c1preview1.Document = c1r1.Document • C# // load report definition c1r1.Load(reportFile, reportName); // preview the document c1preview1.Document = c1r1.Document; • Delphi // load report definition c1r1.Load(reportFile, reportName); // preview the document c1preview1.Document := c1r1.Document; Note: C1Report works with the .NET preview components, but it is optimized to work with C1Preview. When used with C1Preview, you can see each report page as it is generated. With the standard controls, you have to wait until the entire report is ready before the first page is displayed. Export the report to common file formats C1Report has a RenderToFile method that allows you to export your report to several file formats, including HTML, RTF, PDF, TIFF, Text, and XLS. For example, the code below creates PDF and XLS versions of a report: • Visual Basic ' load report definition c1r1.Load(reportFile, reportName) ' export to Pdf c1r1.RenderToFile(outFile + ".pdf", FileFormatEnum.PDF) c1r1.RenderToFile(outFile + ".xls", FileFormatEnum.Excel) • C# // load report definition c1r1.Load(reportFile, reportName); // export to Pdf c1r1.RenderToFile(outFile + ".pdf", FileFormatEnum.PDF); c1r1.RenderToFile(outFile + ".xls", FileFormatEnum.Excel); 112 · C1Report Task-Based Help • Delphi // load report definition c1r1.Load(reportFile, reportName); // export to Pdf c1r1.RenderToFile(outFile +'.pdf', FileFormatEnum.PDF); c1r1.RenderToFile(outFile +'.xls', FileFormatEnum.Excel); Export the report to custom formats If you want to export the report to a format that is not supported by C1Report, you can write your own export filter class and use the RenderToFilter method to render the report into your custom filter. Custom filters are classes that derive from the C1.Win.C1Report.ExportFilter class and override a few simple methods like StartReport, StartSection, RenderField, EndSection, and EndReport. Writing a custom export filter is not difficult. It can be used for example to create custom XML representations of your reports for later processing by other applications. Display a Progress Indicator while the report renders Most preview applications have progress indicators that show which page is being rendered and have a button that allows the user to cancel the report while it is being generated. The .NET print preview controls provide this automatically for you. If you are printing the report directly to the printer or exporting it to a file, however, there is no built-in progress report UI. To create a progress report dialog, or to update a status bar while the report is being rendered, you should use C1Report events. The StartPage and EndReport events are sufficient to provide feedback on which page is being printed and when the report is finished. To cancel the report before it is finished, add a Cancel button to your application and use it to set the C1Report Cancel property to true. You may also want to provide progress bars and "page n of m" indicators, but that is generally difficult to do because the page count is not knows until the report has been rendered. For a generic example, see the "ProgressIndicator" sample available for download at ComponentOne HelpCentral. Create a report with Alternating Background Color ('Greenbar') To create a report with alternating background color, use the OnPrint event of the detail section to change the BackColor property of the section. For example: ' VBScript: Report.OnOpen event ' initialize counter cnt = 0 ' VBScript: Detail.OnPrint event ' alternate back color cnt = cnt + 1 if cnt mod 2 = 0 then detail.backcolor = rgb(200,220,200) else detail.backcolor = rgb(255,255,255) endif Whenever a detail section is rendered, the counter is incremented and the BackColor property of the detail section is toggled. See report "01: Alternating Background (Greenbar report)" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create a report with a Custom Paper Size · 113 Create a report with a Custom Paper Size By default, C1Report creates reports using the default paper size on the default printer. You can specify the paper size and orientation using the PaperSize and Orientation properties. However, C1Report checks that the selected paper size is available on the current printer before rendering, and changes to the default paper size if the selected setting is not available. If you want to specify a certain paper size and use it regardless of the printers available, set the PaperSize property to Custom, and set the CustomWidth and CustomHeight properties to the page dimensions (in twips). For example, the code below sets the report paper size to 25 x 11", regardless of what is available on the printer: • Visual Basic c1r1.Layout.PaperSize = PaperKind.Custom c1r1.Layout.CustomHeight = 25 * 1440 ' in twips c1r1.Layout.CustomWidth = 11 * 1440 • C# c1r1.Layout.PaperSize = PaperKind.Custom; c1r1.Layout.CustomHeight = 25 * 1440; // in twips c1r1.Layout.CustomWidth = 11 * 1440; • Delphi c1r1.Layout.PaperSize := PaperKind.Custom; c1r1.Layout.CustomHeight := 25 * 1440 // in twips c1r1.Layout.CustomWidth := 11 * 1440; Note that you can make these settings using the property grid in the report designer. The property grid allows you to type in measurements with units, and converts them into twips automatically. If you type "11in", the grid will display the measurement in twips (36000). See report "02: Custom Paper Size" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create a report with Unbound Images Unbound images are static images such as logos and watermarks that are not stored in the database. To add bound image fields in the C1Report Designer, click the Unbound Image button. This will show a dialog where you can pick the image file you want to include in the report. The image file can be embedded in the report definition, or it can be a reference to an external file. In the Designer's View menu, select Options to choose the option you prefer. See report " 03: Unbound Images" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create a report with Bound Images Bound images are images stored in database fields. To display these images in your reports, add a field to the report and set its Picture property to a string containing the name of the column where the image is stored. For example, if the field "Photo" in the database contains embedded OLE objects or raw image streams, and the report contains a field called "fEmployeePhoto", then the following code would display the employee photo in the field: • Visual Basic fEmployeePhoto.Picture = "Photo" 114 · C1Report Task-Based Help • C# fEmployeePhoto.Picture = "Photo"; • Delphi fEmployeePhoto.Picture :='Photo'; To add bound image fields in the C1Report Designer, click the Bound Image button. This will show a menu with all binary fields in the current data source, where you can select the field you want to add to the report. See report "04: Bound Images" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create a report with a Watermark Watermarks are images displayed behind the report content. The images are often washed-out to prevent them from interfering with the actual report content. To display an image as a watermark, set the Picture property to a file that contains the image. You can also control the way the watermark is scaled and the pages on which it should appear using the PictureAlign and PictureShow properties. See report " 05: Watermark" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create a report with CanGrow/CanShrink fields It is common for report fields to have content that may span multiple lines or collapse to no lines at all. In some cases, you may want to allow these fields to grow or shrink to fit their content rather than clip the excess or leave white spaces in the report. To do this, set the Field object's CanGrow and CanShrink properties to true. Fields that grow push down the fields below them. Likewise, fields that can shrink push up the fields below them. Below in this case means "strictly" below, as shown in the diagram below: Field 1 will push or pull fields 2 and 3 when it grows or shrinks. Field 4 will not be affected because it is not directly below field 1. The shaded area in the diagram shows the region affected by field 1. If you want field 4 to remain aligned with fields 2 and 3, add an extra field spanning the whole area above fields 2 and 3. The new field will be pushed down by field 1 and will in turn push fields 2, 3, and 4. The diagram below shows this new layout: Control Page Breaks in a report · 115 See report "06: CanGrow CanShrink" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Control Page Breaks in a report By default, C1Report fills each page until the bottom, inserts a page break, and continues rendering in the next page. You can override this behavior using several properties: • KeepTogether: Determines whether group header sections are allowed to render on a page by themselves, if they must be rendered with at least one detail section, or if the entire group should be kept together on a page. • KeepTogether: Determines whether page breaks are allowed within sections. It has lower precedence than KeepTogether. • ForcePageBreak: Allows you to specify that page breaks should be inserted before, after, or before and after the section. • KeepTogether: Determines whether page breaks are allowed within fields. This allows long text fields to span multiple pages. It has lower precedence than KeepTogether. • ForcePageBreak: Allows you to specify that page breaks should be inserted before, after, or before and after the field. You set these properties at design time, and you can use script to change these them while the report is being rendered. For example, the script below causes page breaks after each 10 detail sections: ' VBScript: Report.OnOpen event cnt = 0 ' initialize detail counter ' VBScript: Detail.OnPrint event cnt = cnt + 1 detail.forcepagebreak = "none" if cnt >= 10 then cnt = 0 detail.forcepagebreak = "after" endif See report "07: Force Page Breaks" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Define and use Global Constants in a report There is no special mechanism for doing this, but you can add hidden fields to the report and use their values as global parameters. For example, if you add a field called "linesPerPage" to the report, set its Text property to a number, and Visible to false, then you can control the number of detail lines per page using a script similar to the one described above: ' VBScript: Report.OnOpen event cnt = 0 ' initialize detail counter ' VBScript: Detail.OnPrint event cnt = cnt + 1 detail.forcepagebreak = "none" if cnt >= linesPerPage then cnt = 0 detail.forcepagebreak = "after" endif 116 · C1Report Task-Based Help The value in the "linesPerPage" field can be set prior to rendering the report, by changing the field's Text property, See report "08: Global Constant" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Change Page Headers dynamically C1Report has PageHeader and PageFooter properties that allow you to specify whether page header and page footer sections should appear on all pages, or be suppressed on the pages that contain the report header and report footer sections. Sometimes you may want to further customize this behavior. For example, you may want to render different headers on odd and even pages. This can be done with some script that shows or hides fields depending on the page being rendered. For example, if a report header contains several fields named "h<x>odd" and "h<x>even", then the following script would show or hide these fields for odd and even pages: ' VBSsript: PageHeader.OnFormat event odd = (page mod 2 <> 0) h1odd.Visible = odd h2odd.Visible = odd h1even.Visible = not odd h2even.Visible = not odd To prevent the page header from showing blank spaces, all the fields should have the CanShrink property set to true. See report "09: Dynamic Page Header" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create a report with a Gutter margin Gutter margins are extra space added to the margins next to the binding. They make it easier to bind the pages into folders, brochures, etc. To add a gutter margin to a report, you should increase the MarginLeft property on odd pages and use the default value on even pages. This can be done with script that changes the margins based on the page being rendered. For example: ' VBScript: Report.OnOpen gutter = report.layout.marginleft ' initialize variable ' VBScript: Report.OnPage report.layout.marginleft = _ iif(page mod 2 = 1, gutter, gutter - 1440) See report "10: Gutter" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create reports with Charts In the initial versions of C1Report, adding charts to reports required handling the StartSection event, generating the chart, and assigning the chart image to a field's Picture property. This is not hard to do, and continues to be the most flexible way to add dynamic images to reports. However, this approach has two drawbacks: 1. It requires you to write code outside the report definition, which means only your application will be capable of showing the report the way it is meant to be shown. Create reports with Custom Fields · 117 2. It does require you to write code for generating the chart, which can be tedious. The current C1Report supports custom report fields, including a Chart field that is based on the C1Chart control. To add a Chart field to a report, use the C1ReportDesigner to add a Chart field to a group header section and set the Chart field's DataX and DataY properties to the values you want to display on the chart. You can show several series by setting the DataY property to a list of fields delimited by semicolons (e.g. "UnitsInStock;ReorderLevel"). The chart data is automatically scoped to the current report group, so when rendering the "Beverages" section, only data for that category will be charted. You can customize the chart using many other properties such as ChartType, GridLines, Use3D, and Palette properties. See report "11: Charts" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create reports with Custom Fields You can create your own custom fields and add them to the report designer palette. To do that, you have to: 1. Create a custom field class that derives from C1.Win.C1Report.Field. 2. Register your custom field assembly in the report designer's settings file. This is how the Chart and Gradient fields are implemented. The source code for these custom fields is available; you can use it as a starting point to create your own custom fields. The Chart and Gradient fields are registered in the C1Report Designer settings file with this entry: <customfields> <item value="C1.Win.C1Report.CustomFields;C1.Win.C1Report.CustomFields.Chart" /> <item value="C1.Win.C1Report.CustomFields;C1.Win.C1Report.CustomFields.Gradie nt" /> </customfields> See report "12: Custom Fields" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Add Subtotals and other aggregates to reports C1Report supports aggregate expressions in all its calculated fields. The aggregate expressions include all the usual Sum, Avg, Min, Max, Count, Range, StDev, etc. All aggregate functions take an expression as argument and evaluate it within a scope that is determined by their position in the report. For example, aggregates in group headers or footers have the scope of the group. Aggregates in the report header or footer have the scope of the entire report. For example, "Sum(Sales)" would return the sum of all values in the "Sales" field for the scope of the aggregate (group or report). "Sum(Sales * 0.085)" would return the total amount of sales taxes paid for all values in the report (assuming an 8.5% sales tax). You can reduce the scope of any aggregate using a second argument called 'domain'. The domain argument is an expression that determines whether each value in the current scope should be included in the aggregate calculation. For example, "Sum(Sales, Category = 1)" would return the sum of all values in the "Sales" field for products in category 1. "Count(*, Sales > 10000)" would return the number of sales over $10,000. 118 · C1Report Task-Based Help See report "13: Subtotals and other Aggregates" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Add Page Headers to Subreports C1Report ignores page header and page footer sections in subreports. Instead, it uses the page header and page footer sections defined in the main report. This is the same behavior as in Microsoft Access. In many cases, however, you would like your subreports to include header information across page breaks. To do this, place the headers in a group header section and set the section's Repeat property to true. If your subreport doesn't have any groups, add an empty one. See report "14: Page Headers in Subreports" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Retrieve Values from Subreports In some cases you may want to pass data from the subreport back to the main report. Script variables can't be used for this because each report has its own script scope (this avoids the possibility of conflicting variable names). To pass data from a subreport back to the main report, you have to store values in subreport fields or in the subreport's Tag property, then have the main report read those values. In this sample, the subreport calculates the average unit price per product category and stores that value in its Tag property. The main report retrieves and displays that value. See report "15: Retrieve Values from Subreports" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Add Conditional Formatting to reports In some cases you may want to change a field's appearance depending on the data it represents. For example, you may want to highlight items that are expensive, or low in stock. To do this, attach some script to the OnFormat property of the section that contains the fields of interest. For example, the script below changes the detail section's BackColor property depending on the value of the fields UnitsInStock, UnitsOnOrder, ReorderLevel, and Discontinued: ' VBScript: Detail.OnFormat If UnitsInStock + UnitsOnOrder < ReorderLevel And _ Discontinued = False Then Detail.BackColor = rgb(255,190,190) Else Detail.BackColor = vbWhite Endif See report "16: Conditional Formatting" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Add Running Sums to reports C1Report Field objects have a RunningSum property that makes it easy to maintain running sums over groups or over the entire report. To keep running sums over pages, you need to use script. For example, you could add a "pageSum" field to the report and update it with script as shown below: ' VBScript: Report.OnPage event pageSum = 0 Add a "Continued" label to headers on page breaks · 119 ' VBScript: Detail.OnPrint event pageSum = pageSum + UnitsInStock See report "17: Running Sums" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Add a "Continued" label to headers on page breaks Group header sections are repeated across page breaks if their Repeat property is set to true. This makes the report easier to read, but it can be hard to tell if a group header on a page marks the beginning of a group or is just a continuation. One way to address this is to add a field with a "Continued" label to the group header and control its visibility with script. For example, if the field with the label is called "fContinued" and is initially invisible, then the following script would show the label only on continued page headers: VBScript: Detail.OnPrint fContinued.Visible = true VBScript: GroupFooter.OnPrint fContinued.Visible = false This script ensures that the "fContinued" field is visible within the group. Any page breaks created after the group footer and before the next detail section will not show the label. See report "18: Continued Headers" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Sort report Data There are two ways to sort data in reports. You can sort the data source object itself (e.g. using a SQL statement with an ORDER BY clause), or you can add groups to the report and specify how each group should be sorted using the group's GroupBy and Sort properties. Group sorting is done using the DataView.Sort property, which takes a list of column names only (not expressions on column names). So if your grouping expression is DatePart("yyyy", dateColumn), the control will actually sort on the dates in the dateColumn field, not on the years of those dates as most would expect. To sort based on the dates, add a calculated column to the data table (by changing the SQL statement), and then group/sort on the calculated column instead. See the Sort property for an XML discussion of this, including a sample. 120 · C1Report Task-Based Help This is what the group editor looks like in the C1Report Designer. Note the fields where you can specify group sorting: If you use both approaches, the sorting set in the report groups will prevail (it is applied after the data has been retrieved from the database). See report "19: Sorting" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Create Cross-tab reports Cross-tab reports group data in two dimensions (down and across). They are useful for summarizing large amounts of data in a format that cross-references information. To create cross-tab reports, you will typically start with a GROUP BY query to summarize the data into rows, then use a transformation (pivot) service to create the grouped columns. The transformation service can be provided by the database server itself, it can be a custom program, or you can use C1Report's built-in domain aggregates. In all cases, the most important element in the cross-tab report is the original summarized view of the data. For example, a typical summarized view would look like this: Year Quarter Amount 1990 1 1.1 1990 2 1.2 1990 3 1.3 1990 4 1.4 1991 1 2.1 1991 2 2.2 1991 3 2.3 1991 4 2.4 Suppress or Force the display of Zeros · 121 This data would then be transformed by adding columns for each quarter and consolidating the values into the new columns: Year Total Q1 Q2 Q3 Q4 1990 5 1.1 1.2 1.3 1.4 1991 9 2.1 2.2 2.3 2.4 You can do this using C1Report aggregate functions. The report would be grouped by year. The detail section would be invisible, and the group header would contain the following aggregates: Year Total Q1 Q2 Q3 Q4 [Year] Sum(Amount) Sum(Amount, Quarter=1) Sum(Amount, Quarter=2) Sum(Amount, Quarter=3) Sum(Amount, Quarter=4) The first aggregate would calculate the total amount sold in the current year. The quarter-specific aggregates specify a domain to restrict the aggregate to the specified quarter. See report "20: Cross-tab Reports" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. Suppress or Force the display of Zeros To suppress the display of fields with value zero, set their Format property to "#". The pound sign is a formatting symbol that displays only significant digits (no leading or trailing zeros). To force the display of a certain number of digits, use a format like "0000". The zero forces the display of a digit, including leading and trailing zeros. Each format string can have up to three sections separated by semi-colons. If two sections are provided, the first is used for positive values and zero, the second for negative values. If three sections are provided, the first is used for positive values, the second for negative values, and the third for zero. For example: "#;(#);ZERO". See report "21: Suppress or Force Zeros" in CommonTasks.xml, which is available for download from the ComponentOne HelpCentral Sample page. C1.Win.C1Report.2 Assembly · 123 C1.Win.C1Report.2 Assembly Namespaces C1.Win.C1Report C1.Win.C1Report Namespace · 125 C1.Win.C1Report Namespace C1.Win.C1Report Hierarchy Classes Class Description C1Report The C1Report component generates Access-style, databased banded reports that can be rendered directly to a printer, exported to various portable formats (including HTML, PDF, and text), or rendered into preview controls such as the Microsoft PrintPreview or ComponentOne C1PrintPreview controls. DataAccessException System.Exception that is thrown when a data access error occurs. DataSource Provides data for reports. DialogEventArgs Provides data for InitializeParametersDialog event. ExportFilter Base class for all export filters, used with the RenderToFilter method to render reports into different formats. Field Displays individual data items in a report. FieldCollection FieldCollection class represents a collection of the Field objects. Group Object used to sort and group report data. GroupCollection GroupCollection class represents a collection of the Group objects. HtmlFilter Used with the RenderToFilter method to render reports into HTML streams or files. Layout The Layout object controls how the report is rendered on pages. PdfFilter Used with the RenderToFilter method to render reports into PDF (portable document format) streams or files. ReportEventArgs Provides data for StartPage, EndPage, StartSection, PrintSection, EndSection, ReportError, and AddOutlineEntry events. ReportInfo Class that contains report metadata. RtfFilter Used with the RenderToFilter method to render reports into RTF (rich text format) streams or files. RtfLabelFilter Class is used with the RenderToFilter method to render reports into RTF (rich text format) streams or files. Section Represents a report band. SectionCollection Collection of the Section objects. 126 · C1.Win.C1Report Namespace Class Description TextFilter Used with the RenderToFilter method to render reports into plain text streams or files. TiffFilter Used with the RenderToFilter method to render reports into TIFF streams or files. XlsFilter Class used with the RenderToFiltermethod to render reports into Microsoft Excel (XLS) files. Interfaces Interface Description IC1ReportRecordset Interface used to access report data from data source objects. Delegates Delegate Description AddOutlineEntryHandler Represents the method that will handle the AddOutlineEntry event. DialogEventHandler Represents the method that will handle the InitializeParametersDialog event. ReportEventHandler Represents the method that will handle StartPage, EndPage, StartSection, PrintSection, EndSection, ReportError, and AddOutlineEntry events. Enumerations Enumeration Description AnchorEnum Determines how the field is positioned with respect to its containing section when the section grows or shrinks as a result of the section's CanGrow and CanShrink properties. BackStyleEnum Determines whether the field will be rendered with an opaque or transparent background. BarCodeEnum Determines what type of barcode will be used in the field. BorderStyleEnum Specifies the Field’s border style. CheckBoxEnum Specifies how Boolean values are translated into checkboxes. ColumnLayoutEnum Specifies the layout for the columns (down or across). FieldAlignEnum Specifies the alignment of text within the field's rectangle. FileFormatEnum Specifies the format of the export file. ForcePageBreakEnum Determines whether page breaks should be inserted before or after a field or section. GrowShrinkModeEnum Specifies the logic for handling CanGrow/CanShrink fields. C1.Win.C1Report Namespace · 127 Enumeration Description HdrFtrEnum Specifies where the Page Footer and Page Header sections are displayed. KeepTogetherEnum Specifies whether the group should be kept together on a page. LineSlantEnum Determines whether/how a line should be drawn across the field (as opposed to a box around the field). OrientationEnum Specifies the page orientation. PictureAlignEnum Specifies the alignment of images within the field's rectangle. PictureScaleEnum Specifies the scaling of images within the field's rectangle. PictureShowEnum Specifies where the background picture is displayed. RtfTargetEnum Specifies the format of the export file. RunningSumEnum Determines whether to calculate a running sum. SectionTypeEnum Specifies the section type, which is equivalent to a the index of a Section object in the control's Sections collection. SortEnum Specifies how groups should be sorted. TextDirectionEnum Specifies the direction of the text in the field. See Also C1.Win.C1Report.2 Assembly C1.Win.C1Report Hierarchy System.Object System.MarshalByRefObject System.ComponentModel.Component C1.Win.C1Report.C1Report ---- fq, System.ComponentModel.ISupportInitialize, jr System.Exception System.ApplicationException C1.Win.C1Report.DataAccessException C1.Win.C1Report.DataSource System.EventArgs C1.Win.C1Report.DialogEventArgs C1.Win.C1Report.ReportEventArgs C1.Win.C1Report.ExportFilter ---- System.IDisposable C1.Win.C1Report.HtmlFilter ---- System.IDisposable C1.Win.C1Report.PdfFilter C1.Win.C1Report.RtfFilter ---- System.IDisposable 128 · C1.Win.C1Report Namespace C1.Win.C1Report.RtfLabelFilter C1.Win.C1Report.TextFilter ---- System.IDisposable C1.Win.C1Report.TiffFilter C1.Win.C1Report.XlsFilter ---- System.IDisposable C1.Win.C1Report.Field ---- System.ICloneable, jr C1.Win.C1Report.FieldCollection ---- System.Collections.ICollection, System.Collections.IEnumerable C1.Win.C1Report.Group C1.Win.C1Report.GroupCollection ---- System.Collections.ICollection, System.Collections.IEnumerable C1.Win.C1Report.Layout C1.Win.C1Report.ReportInfo C1.Win.C1Report.Section C1.Win.C1Report.SectionCollection ---- System.Collections.ICollection, System.Collections.IEnumerable System.ValueType System.[Enum] C1.Win.C1Report.AnchorEnum C1.Win.C1Report.BackStyleEnum C1.Win.C1Report.BarCodeEnum C1.Win.C1Report.BorderStyleEnum C1.Win.C1Report.CheckBoxEnum C1.Win.C1Report.ColumnLayoutEnum C1.Win.C1Report.FieldAlignEnum C1.Win.C1Report.FileFormatEnum C1.Win.C1Report.ForcePageBreakEnum C1.Win.C1Report.GrowShrinkModeEnum C1.Win.C1Report.HdrFtrEnum C1.Win.C1Report.KeepTogetherEnum C1.Win.C1Report.LineSlantEnum C1.Win.C1Report.OrientationEnum C1.Win.C1Report.PictureAlignEnum C1.Win.C1Report.PictureScaleEnum C1.Win.C1Report.PictureShowEnum C1.Win.C1Report.RtfTargetEnum C1.Win.C1Report.RunningSumEnum C1.Win.C1Report.SectionTypeEnum C1.Win.C1Report.SortEnum C1.Win.C1Report.TextDirectionEnum System.[Delegate] AddOutlineEntryHandler Delegate · 129 System.MulticastDelegate C1.Win.C1Report.AddOutlineEntryHandler C1.Win.C1Report.DialogEventHandler C1.Win.C1Report.ReportEventHandler See Also C1.Win.C1Report Namespace AddOutlineEntryHandler Delegate Represents the method that will handle the AddOutlineEntry event. [Visual Basic] Public Delegate Sub AddOutlineEntryHandler( _ ByVal sender As Object, _ ByVal e As ReportEventArgs _ ) [C#] public delegate void AddOutlineEntryHandler( object sender, ReportEventArgs e ); [Delphi] type AddOutlineEntryHandler = procedure ( sender: Object; e: ReportEventArgs ) of object; Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also C1.Win.C1Report Namespace AnchorEnum Enumeration Determines how the field is positioned with respect to its containing section when the section grows or shrinks as a result of the section's CanGrow and CanShrink properties. [Visual Basic] Public Enum AnchorEnum [C#] public enum AnchorEnum [Delphi] type AnchorEnum = (Bottom, Top, TopAndBottom); Namespace: C1.Win.C1Report 130 · C1.Win.C1Report Namespace Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the Anchor property in the Field class. Members Member name Description Bottom The field moves vertically. The space between the bottom of the field and the bottom of the section remains the same. Top The field does not move. The space between the top of the field and the top of the section remains the same. TopAndBottom The field grows or shrinks. The space between field and the section remains the same (above and below). Example The following code sets the Anchor property to Top: • Visual Basic Me.C1Report1.Fields(0).Anchor = C1.Win.C1Report.AnchorEnum.Top • C# this.C1Report1.Fields[0].Anchor = C1.Win.C1Report.AnchorEnum.Top; • Delphi Self.C1Report1.Fields[0].Anchor := C1.Win.C1Report.AnchorEnum.Top; See Also C1.Win.C1Report Namespace BackStyleEnum Enumeration Determines whether the field will be rendered with an opaque or transparent background. [Visual Basic] Public Enum BackStyleEnum [C#] public enum BackStyleEnum [Delphi] type BackStyleEnum = (Opaque, Transparent); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Members Member name Description Opaque Opaque background. Transparent Transparent background. BarCodeEnum Enumeration · 131 See Also C1.Win.C1Report Namespace BarCodeEnum Enumeration Determines what type of barcode will be used in the field. [Visual Basic] Public Enum BarCodeEnum [C#] public enum BarCodeEnum [Delphi] type BarCodeEnum = (Codabar, Code128, Code39, Code93, CodeI2of5, Ean13, Ean8, None, PostNet); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the BarCode property in the Field class. Members Member name Description Codabar Numeric only, slightly denser than Code39. Code128 Alpha-numeric, denser than Code39 and required at least 6 characters. Code39 Alpha-numeric, (Code 3 of 9). Code93 Alpha-numeric. CodeI2of5 Numeric only. Ean13 EAN-13 barcode. EAN-13 encodes 12-digit article codes (plus one check digit created by the control). Ean8 EAN-8 barcode. EAN-8 encodes 7-digit article codes (plus one check digit created by the control). None No barcode. PostNet Numeric only, US Postal Service. Example The following code sets the BarCode property to Code93: • Visual Basic Me.C1Report1.Fields(0).BarCode = C1.Win.C1Report.BarCodeEnum.Code93 • C# this.C1Report1.Fields[0].BarCode = C1.Win.C1Report.BarCodeEnum.Code93; • Delphi Self.C1Report1.Fields[0].BarCode := C1.Win.C1Report.BarCodeEnum.Code93; 132 · C1.Win.C1Report Namespace See Also C1.Win.C1Report Namespace BorderStyleEnum Enumeration Specifies the Field’s border style. [Visual Basic] Public Enum BorderStyleEnum [C#] public enum BorderStyleEnum [Delphi] type BorderStyleEnum = (Dash, DashDot, DashDotDot, Dot, Solid, Transparent); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the BorderStyle property in the Field class. Members Member name Description Dash Dashed border. DashDot Dash-dot border. DashDotDot Dash-dot-dot border. Dot Dotted border. Solid Solid border. Transparent No border. See Also C1.Win.C1Report Namespace C1Report Class The C1Report component generates Access-style, data-based banded reports that can be rendered directly to a printer, exported to various portable formats (including HTML, PDF, and text), or rendered into preview controls such as the Microsoft PrintPreview or ComponentOne C1PrintPreview controls. For a list of all members of this type, see C1Report Members. System.Object System.MarshalByRefObject System.ComponentModel.Component C1.Win.C1Report.C1Report C1Report Members · 133 [Visual Basic] Public Class C1Report Inherits Component Implements fq, ISupportInitialize, jr [C#] public class C1Report : Component , fq, ISupportInitialize, jr [Delphi] type C1Report = class (Component,(Component, fq, ISupportInitialize, jr); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also C1Report Members | C1.Win.C1Report Namespace C1Report Members C1Report overview Public Constructors C1Report Constructor Initializes a new instance of the C1Report component. Public Properties Cancel Gets or sets whether to cancel generation of the current report. DataSource Gets a reference to the report's DataSource object. Document Gets a System.Drawing.Printing.PrintDocument object that can be used to render the report to a printer or into a print preview control. DoEvents Gets or sets whether the control should handle Windows messages while rendering reports. Fields Gets the collection of Field objects in the report definition. Font Gets or sets the default font for new fields. Groups Gets a collection with all the groups in the report. GrowShrinkMode Gets or sets the method used to process CanGrow/CanShrink fields. IsBusy Gets a value that determines whether a report is currently being generated. LabelOffset Gets or sets the position of the first label on a partially used sheet. Layout Gets a reference to the report's Layout object. MaxPages Gets or sets the maximum number of pages allowed for a report. 134 · C1.Win.C1Report Namespace OnClose Gets or sets the VBScript that is executed when the report finishes rendering. OnError Gets or sets the VBScript that is executed when an error occurs. OnNoData Gets or sets the VBScript that is executed when the report starts rendering and its source recordset is empty. OnOpen Gets or sets the VBScript that is executed when the report starts rendering. OnPage Gets or sets the VBScript that is executed when a new page is created. OutlineRootLevel Gets or sets the starting outline level for the groups in this report. Page Gets or sets the current page number. PageImages Gets a list of System.Drawing.Imaging.Metafile objects that correspond to the pages in the report. ParentReport Gets the main report that contains this subreport (Null for main reports). ReportDefinition Gets or sets an XML string containing the complete report definition. ReportInfo Gets or sets a ReportInfo object containing report metadata. ReportName Gets or sets the name of the report (used with the Load method). Sections Gets the collection of Section objects in the report definition. Tag Gets or sets extra data needed by the calling program. Public Methods AddScriptObject Adds an object to the report's script context. BeginInit Signals the object that initialization is starting. Clear Clears the current report. CopyFrom Copies a report definition from another C1Report component. EndInit Signals the object that initialization is complete. Evaluate Evaluates a VBScript expression in the current report context. Execute Executes a VBScript statement in the current report context. GetReportInfo Overloaded. Gets a list of reports available in an XML report definition file. GetReportList Overloaded. Gets a list of reports available in an XML report definition file. C1Report Members · 135 Load Overloaded. Loads a report from an XML report definition file. ParseExpression Parses a VBScript expression in the current report context. ParseStatement Parses a VBScript statement in the current report context. Render Renders the report into an internal collection of images. RenderToFile Renders the report into a file. RenderToFilter Renders the report into an ExportFilter object. RenderToStream Overloaded. Renders the report into a System.IO.Stream object. Save Overloaded. Saves the current report definition to a file. Public Events AddOutlineEntry Fired before the control adds an outline entry to the report. EndPage Fired when the control finishes rendering each page. EndReport Fired when the control finishes rendering the report. EndSection Fired when the control finishes rendering each Section. InitializeParametersDialog Fired before the control displays the Report Parameters dialog. NoData Fired when the control starts rendering a report and the data source is empty. PrintSection Fired before each Section is printed (after it has been formatted.) ReportError Fired when an error occurs while rendering a report. StartPage Fired when the control starts rendering each page. StartReport Fired when the control starts rendering the report, before it opens the source recordset. StartSection Fired before each Section is formatted. Protected Methods Dispose Overloaded. Overriden. Releases the resources used by the component. OnEndPage Raises the EndPage event. OnEndReport Raises the EndReport event. OnEndSection Raises the EndSection event. OnNoReportData Raises the NoData event. OnPrintSection Raises the PrintSection event. OnReportError Raises the ReportError event. OnStartPage Raises the StartPage event. 136 · C1.Win.C1Report Namespace OnStartReport Raises the StartReport event. OnStartSection Raises the StartSection event. See Also C1Report Class | C1.Win.C1Report Namespace C1Report Constructor Initializes a new instance of the C1Report component. [Visual Basic] Public Function New() [C#] public C1Report() [Delphi] public constructor Create(); See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report Properties The properties of the C1Report class are listed here. For a complete list of C1Report class members, see the C1Report Members topic. Public Properties Cancel Gets or sets whether to cancel generation of the current report. DataSource Gets a reference to the report's DataSource object. Document Gets a System.Drawing.Printing.PrintDocument object that can be used to render the report to a printer or into a print preview control. DoEvents Gets or sets whether the control should handle Windows messages while rendering reports. Fields Gets the collection of Field objects in the report definition. Font Gets or sets the default font for new fields. Groups Gets a collection with all the groups in the report. GrowShrinkMode Gets or sets the method used to process CanGrow/CanShrink fields. IsBusy Gets a value that determines whether a report is currently being generated. LabelOffset Gets or sets the position of the first label on a partially used sheet. Layout Gets a reference to the report's Layout object. C1Report.Cancel Property · 137 MaxPages Gets or sets the maximum number of pages allowed for a report. OnClose Gets or sets the VBScript that is executed when the report finishes rendering. OnError Gets or sets the VBScript that is executed when an error occurs. OnNoData Gets or sets the VBScript that is executed when the report starts rendering and its source recordset is empty. OnOpen Gets or sets the VBScript that is executed when the report starts rendering. OnPage Gets or sets the VBScript that is executed when a new page is created. OutlineRootLevel Gets or sets the starting outline level for the groups in this report. Page Gets or sets the current page number. PageImages Gets a list of System.Drawing.Imaging.Metafile objects that correspond to the pages in the report. ParentReport Gets the main report that contains this subreport (Null for main reports). ReportDefinition Gets or sets an XML string containing the complete report definition. ReportInfo Gets or sets a ReportInfo object containing report metadata. ReportName Gets or sets the name of the report (used with the Load method). Sections Gets the collection of Section objects in the report definition. Tag Gets or sets extra data needed by the calling program. See Also C1Report Class | C1.Win.C1Report Namespace C1Report.Cancel Property Gets or sets whether to cancel generation of the current report. [Visual Basic] Public Property Cancel As Boolean [C#] public bool Cancel {get;set;} [Delphi] public property Cancel: Boolean read get_Cancel write set_Cancel; 138 · C1.Win.C1Report Namespace Remarks Setting this property to True while a report is being generated stops the report generation process. Any pages already created are kept in the document and can be previewed or printed by an attached print preview control. Example The following code implements a Cancel button: • Visual Basic Private Sub Cancel_Click() If C1Report1.IsBusy Then Debug.Write "Cancelling Report" C1Report1.Cancel = True Else Debug.Write "No report to cancel" End If End Sub • C# private void Cancel_Click() { if ( C1Report1.IsBusy ) { Debug.Write "Cancelling Report"; C1Report1.Cancel = true; } else { Debug.Write "No report to cancel"; } } • Delphi procedure Cancel_Click; begin if C1Report1.IsBusy then begin Debug.Write('Cancelling Report'); C1Report1.Cancel := True; end else Debug.Write('No report to cancel'); end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.DataSource Property Gets a reference to the report's DataSource object. [Visual Basic] Public ReadOnly Property DataSource As DataSource [C#] public DataSource DataSource {get;} [Delphi] public property DataSource: DataSource read get_DataSource; C1Report.Document Property · 139 See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Document Property Gets a System.Drawing.Printing.PrintDocument object that can be used to render the report to a printer or into a print preview control. [Visual Basic] Public ReadOnly Property Document As PrintDocument [C#] public PrintDocument Document {get;} [Delphi] public property Document: PrintDocument read get_Document; Example The examples below show how you can use the Document property to print the report or show it in a System.Windows.Forms.PrintPreviewDialog control. • Visual Basic ' print the report to the default printer _c1r.Document.Print() ' show the report in a PrintPreviewDialog Dim p As New PrintPreviewDialog() p.Document = _c1r.Document p.ShowDialog() • C# // print the report to the default printer _c1r.Document.Print(); // show the report in a PrintPreviewDialog PrintPreviewDialog p = new PrintPreviewDialog(); p.Document = _c1r.Document; p.ShowDialog(); • Delphi // print the report to the default printer _c1r.Document.Print; // show the report in a PrintPreviewDialog p := PrintPreviewDialog.Create; p.Document := _c1r.Document; p.ShowDialog; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.DoEvents Property Gets or sets whether the control should handle Windows messages while rendering reports. [Visual Basic] Public Property DoEvents As Boolean 140 · C1.Win.C1Report Namespace [C#] public bool DoEvents {get;set;} [Delphi] public property DoEvents: Boolean read get_DoEvents write set_DoEvents; Remarks Setting this property to True allows users to resize forms, click buttons, etc. while reports are being generated. This makes applications more responsive, and is necessary if you want to provide a Cancel Report button (otherwise users wouldn't be able to click the button until the report was done). Setting this property to False will cause reports to render slightly faster. Example The code belows implements Render and a Cancel buttons attached to a C1Report component. The Render button checks whether the C1Report component is busy before starting to render a report. This is necessary because the user could click the Render button several times in a row, before the component got a chance to finish rendering the report. (Calling the Render method while the component is busy throws an System.Exception). The Cancel button checks whether the component is rendering a report and sets the Cancel property to True. • Visual Basic _c1r.DoEvents = True Private Sub Render_Click(sender As Object, e As EventArgs) If _c1r.IsBusy Then Console.WriteLine("Cannot render now, component is busy") Else ppv.Document = c1r.Document End If End Sub Private Sub Cancel_Click(sender As Object, e As EventArgs) If _c1r.IsBusy Then _c1r.Cancel = True Else Console.WriteLine("No report to cancel") End If End Sub • C# _c1r.DoEvents = true; private void Render_Click(object sender, EventArgs e) { if (_c1r.IsBusy) { Console.WriteLine("Cannot render now, component is busy"); } else { ppv.Document = c1r.Document; } } private void Cancel_Click(object sender, EventArgs e) C1Report.Fields Property · 141 { } • if (_c1r.IsBusy) { _c1r.Cancel = true; } else { Console.WriteLine("No report to cancel"); } Delphi _c1r.DoEvents := True; procedure Render_Click(sender: object; e: System.EventArgs); begin if _c1r.IsBusy then Console.WriteLine('Cannot render now, component is busy') else ppv.Document := c1r.Document; end; procedure Cancel_Click(sender: object; e: System.EventArgs); begin if _c1r.IsBusy then _c1r.Cancel := True else Console.WriteLine('No report to cancel'); end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Fields Property Gets the collection of Field objects in the report definition. [Visual Basic] Public ReadOnly Property Fields As FieldCollection [C#] public FieldCollection Fields {get;} [Delphi] public property Fields: FieldCollection read get_Fields; Remarks The Section object also contains a collection of fields in that section. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Font Property Gets or sets the default font for new fields. 142 · C1.Win.C1Report Namespace [Visual Basic] Public Property Font As FontHolder [C#] public FontHolder Font {get;set;} [Delphi] public property Font: FontHolder read get_Font write set_Font; Remarks This property is not used directly when rendering the report. It is used as the default font for new fields. Example The following code adds four fields to the report. The first two fields in 9pt Arial font and the last two in 12pt Tahoma font: • • • Visual Basic c1r.Font.Name = "Arial" c1r.Font.Size = 9 c1r.Fields.Add("New1", "Hello", c1r.Fields.Add("New2", "World", c1r.Font.Name = "Tahoma" c1r.Font.Size = 12 c1r.Fields.Add("New3", "Hello", c1r.Fields.Add("New4", "World", C# c1r.Font.Name = "Arial"; c1r.Font.Size = 9; c1r.Fields.Add("New1", "Hello", c1r.Fields.Add("New2", "World", c1r.Font.Name = "Tahoma"; c1r.Font.Size = 12; c1r.Fields.Add("New3", "Hello", c1r.Fields.Add("New4", "World", 0, 0, 1000, 300) 1000, 0, 1000, 300) 0, 3000, 1000, 300) 1000, 3000, 1000, 300) 0, 0, 1000, 300); 1000, 0, 1000, 300); 0, 3000, 1000, 300); 1000, 3000, 1000, 300); Delphi begin c1r.Font.Name := 'Arial'; c1r.Font.Size := 9; c1r.Fields.Add('New1', 'Hello', c1r.Fields.Add('New2', 'World', c1r.Font.Name := 'Tahoma'; c1r.Font.Size := 12; c1r.Fields.Add('New3', 'Hello', c1r.Fields.Add('New4', 'World', end; 0, 0, 1000, 300); 1000, 0, 1000, 300); 0, 3000, 1000, 300); 1000, 3000, 1000, 300); See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Groups Property Gets a collection with all the groups in the report. [Visual Basic] Public ReadOnly Property Groups As GroupCollection C1Report.GrowShrinkMode Property · 143 [C#] public GroupCollection Groups {get;} [Delphi] public property Groups: GroupCollection read get_Groups; Remarks The Groups collection contains all Group objects defined in the current report. Removing a Group from the collection also removes its associated header and footer sections, as well as any fields in those sections. Adding a Group to the collection adds the corresponding group header and footer sections to the report. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.GrowShrinkMode Property Gets or sets the method used to process CanGrow/CanShrink fields. [Visual Basic] Public Property GrowShrinkMode As GrowShrinkModeEnum [C#] public GrowShrinkModeEnum GrowShrinkMode {get;set;} [Delphi] public property GrowShrinkMode: GrowShrinkModeEnum read get_GrowShrinkMode write set_GrowShrinkMode; Remarks If this property is set to GrowShrinkModeEnum.C1Report, fields with CanGrow or CanShrink properties set to True will move fields directly below them when they grow or shrink. Fields located below but off to the side are not moved. If this property is set to GrowShrinkModeEnum.Access, fields that grow or shrink will affect all fields below, even those which are not directly under the field that was modified as a result of CanGrow/CanShrink. (This is the Microsoft Access behavior). For example, if fields are arranged in a grid layout and GrowShrinkMode is set to GrowShrinkModeEnum.Access, fields within each row will remain vertically aligned when fields above them grow or shrink. If GrowShrinkMode is set to GrowShrinkModeEnum.C1Report, fields within each column will move independently of fields in other columns, and fields within each row will not remain vertically aligned. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.IsBusy Property Gets a value that determines whether a report is currently being generated. [Visual Basic] Public ReadOnly Property IsBusy As Boolean 144 · C1.Win.C1Report Namespace [C#] public bool IsBusy {get;} [Delphi] public property IsBusy: Boolean read get_IsBusy; Remarks Use this property to determine whether the control is currently busy generating a report. This property is especially useful when the DoEvents property is set to True. In this case, the application continues to process user input while the control generates reports, and there is a change that the user might try to start another report before the current one is done. Example The following code shows a typical application of the IsBusy property: • Visual Basic ' prevent reentrant calls If c1r.IsBusy Then Beep() : Exit Sub • C# // prevent reentrant calls if ( c1r.IsBusy ) return; • Delphi // prevent reentrant calls begin if c1r.IsBusy then begin Beep; Exit; end; end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.LabelOffset Property Gets or sets the position of the first label on a partially used sheet. [Visual Basic] Public Property LabelOffset As Integer [C#] public int LabelOffset {get;set;} [Delphi] public property LabelOffset: Int32 read get_LabelOffset write set_LabelOffset; Remarks This property allows you to print labels on partially used label sheets. For example, if you have a sheet with 12 labels and have already used 5, set the LabelOffset property to 6 in order to skip the labels that have already been used. C1Report.Layout Property · 145 See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Layout Property Gets a reference to the report's Layout object. [Visual Basic] Public ReadOnly Property Layout As Layout [C#] public Layout Layout {get;} [Delphi] public property Layout: Layout read get_Layout; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.MaxPages Property Gets or sets the maximum number of pages allowed for a report. [Visual Basic] Public Property MaxPages As Integer [C#] public int MaxPages {get;set;} [Delphi] public property MaxPages: Int32 read get_MaxPages write set_MaxPages; Remarks This property is useful if you want to limit the maximum number of pages in a report. For example, you may write a report designer with a preview window that shows only the first five pages of a report. Setting this property to zero allows reports of any length. You can also limit the size of reports by setting the MaxRecords property. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnClose Property Gets or sets the VBScript that is executed when the report finishes rendering. [Visual Basic] Public Property OnClose As String [C#] public string OnClose {get;set;} 146 · C1.Win.C1Report Namespace [Delphi] public property OnClose: String read get_OnClose write set_OnClose; Remarks The control also Fired the EndReport event at this time. The difference between the regular event and the VBScript property is that the handler for the regular event belongs to the application, and should thus be used to support tasks that are independent of the report. For example, to display a message on the main window when rendering finishes. The VBScript handler in the property belongs to the report, and will be executed regardless of the application. For example, a report might contain a VBScript handler that resets global variables in the VBScript context when a report starts rendering. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnError Property Gets or sets the VBScript that is executed when an error occurs. [Visual Basic] Public Property OnError As String [C#] public string OnError {get;set;} [Delphi] public property OnError: String read get_OnError write set_OnError; Remarks The control also Fired the ReportError event at this time. The difference between the regular event and the VBScript property is that the handler for the regular event belongs to the application, and should thus be used to support tasks that are independent of the report. For example, to display a an application dialog box when an error occurs. The VBScript handler in the property belongs to the report, and will be executed regardless of the application. For example, a report might contain a VBScript handler that changes the value of a field when an error occurs. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnNoData Property Gets or sets the VBScript that is executed when the report starts rendering and its source recordset is empty. [Visual Basic] Public Property OnNoData As String [C#] public string OnNoData {get;set;} [Delphi] public property OnNoData: String read get_OnNoData write set_OnNoData; C1Report.OnOpen Property · 147 Remarks The control also Fired the NoData event at this time. The difference between the regular event and the VBScript property is that the handler for the regular event belongs to the application, and should thus be used to support tasks that are independent of the report. For example, to cancel rendering reports with no data. The VBScript handler in the property belongs to the report, and will be executed regardless of the application. For example, a report might contain a VBScript handler that changes the value of a field when the source recordset is empty. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnOpen Property Gets or sets the VBScript that is executed when the report starts rendering. [Visual Basic] Public Property OnOpen As String [C#] public string OnOpen {get;set;} [Delphi] public property OnOpen: String read get_OnOpen write set_OnOpen; Remarks The control also Fired the StartReport event at this time. The difference between the regular event and the VBScript property is that the handler for the regular event belongs to the application, and should thus be used to support tasks that are independent of the report. For example, to display a message on the main window when rendering starts. The VBScript handler in the property belongs to the report, and will be executed regardless of the application. For example, a report might contain a VBScript handler that resets global variables in the VBScript context when a report starts rendering. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnPage Property Gets or sets the VBScript that is executed when a new page is created. [Visual Basic] Public Property OnPage As String [C#] public string OnPage {get;set;} [Delphi] public property OnPage: String read get_OnPage write set_OnPage; Remarks The control also Fired the StartPage event at this time. 148 · C1.Win.C1Report Namespace The difference between the regular event and the VBScript property is that the handler for the regular event belongs to the application, and should thus be used to support tasks that are independent of the report. For example, to update a label showing how many pages have been rendered so far. The VBScript handler in the property belongs to the report, and will be executed regardless of the application. For example, a report might contain a VBScript handler that updates a variable at every page break. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OutlineRootLevel Property Gets or sets the starting outline level for the groups in this report. [Visual Basic] Public Property OutlineRootLevel As Integer [C#] public int OutlineRootLevel {get;set;} [Delphi] public property OutlineRootLevel: Int32 read get_OutlineRootLevel write set_OutlineRootLevel; Remarks By default, C1Report creates an outline based on the report groups. The outline starts at level zero, and is visible in PDF versions of the report. This property allows you to start the report at a custom level, which can be useful if you are rendering multiple reports into a larger document (using C1PrintDocument for example). You can set this property to -1 to suppress the outline. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Page Property Gets or sets the current page number. [Visual Basic] Public Property Page As Integer [C#] public int Page {get;set;} [Delphi] public property Page: Int32 read get_Page write set_Page; Remarks This property is a global variable available to VBScript expressions. It is automatically initialized by the control with the value 1 when a report starts rendering, and it is automatically incremented after each page break. This property is read-write, so you can reset it using scripts. For example, you can reset the current page to 1 whenever a new group starts rendering. C1Report.PageImages Property · 149 See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.PageImages Property Gets a list of System.Drawing.Imaging.Metafile objects that correspond to the pages in the report. [Visual Basic] Public ReadOnly Property PageImages As ArrayList [C#] public ArrayList PageImages {get;} [Delphi] public property PageImages: ArrayList read get_PageImages; Remarks Use the Render method to create or refresh the page images. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.ParentReport Property Gets the main report that contains this subreport (Null for main reports). [Visual Basic] Public ReadOnly Property ParentReport As C1Report [C#] public C1Report ParentReport {get;} [Delphi] public property ParentReport: C1Report read get_ParentReport; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.ReportDefinition Property Gets or sets an XML string containing the complete report definition. [Visual Basic] Public Property ReportDefinition As String [C#] public string ReportDefinition {get;set;} [Delphi] public property ReportDefinition: String read get_ReportDefinition write set_ReportDefinition; 150 · C1.Win.C1Report Namespace Remarks This property can be used to store report definitions into databases, to place them in the clipboard, or to copy reports from one C1Report component to another. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.ReportInfo Property Gets or sets a ReportInfo object containing report metadata. [Visual Basic] Public Property ReportInfo As ReportInfo [C#] public ReportInfo ReportInfo {get;set;} [Delphi] public property ReportInfo: ReportInfo read get_ReportInfo write set_ReportInfo; Remarks Reports may include general information such as a title, author, and keywords. Such global information about the document itself (as opposed to its content or structure) is called metadata, and is intended to assist in cataloguing and searching for reports and report definitions in external databases. Example The report metadata is automatically included in export formats that suppor it, such as PDF and RTF, for example: • Visual Basic ' set report metadata Dim info As ReportInfo = c1r.ReportInfo info.Creator = "The Musical Report Generator" info.Author = "John S. Bach" info.Title = "Fugues, Sonatas, and Offerings" info.Subject = "Electronic/Baroque Titles" info.Keywords = "Baroque, Strings, Clavier, Harpsichord" ' render report to pdf c1r.RenderToFile("c:\temp\test.pdf", FileFormatEnum.Pdf) • C# // set report metadata ReportInfo info = c1r.ReportInfo; info.Creator = "The Musical Report Generator"; info.Author = "John S. Bach"; info.Title = "Fugues, Sonatas, and Offerings"; info.Subject = "Electronic/Baroque Titles"; info.Keywords = "Baroque, Strings, Clavier, Harpsichord"; // render report to pdf c1r.RenderToFile("c:\temp\test.pdf", FileFormatEnum.Pdf); C1Report.ReportName Property · 151 • Delphi // set report metadata info := c1r.ReportInfo; info.Creator := 'The Musical Report info.Author := 'John S. Bach'; info.Title := 'Fugues, Sonatas, and info.Subject := 'Electronic/Baroque info.Keywords := 'Baroque, Strings, Generator'; Offerings'; Titles'; Clavier, Harpsichord'; // render report to pdf c1r.RenderToFile('c:\temp\test.pdf', FileFormatEnum.Pdf); See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.ReportName Property Gets or sets the name of the report (used with the Load method). [Visual Basic] Public Property ReportName As String [C#] public string ReportName {get;set;} [Delphi] public property ReportName: String read get_ReportName write set_ReportName; Remarks This property identifies the report when it is saved in a report definition file. To retrieve a report from a report definition file, use the Load (String, String) method and pass this name as a parameter. Example The following code provides an example of the ReportName property: • Visual Basic ' load report from XML file c1r.Load(DataFileName, "Employees") ' show report name Console.WriteLine(c1r.ReportName) Employees • C# // load report from XML file c1r.Load(DataFileName, "Employees"); // show report name Console.WriteLine(c1r.ReportName); Employees 152 · C1.Win.C1Report Namespace • Delphi begin // load report from XML file c1r.Load(DataFileName, 'Employees'); // show report name Console.WriteLine(c1r.ReportName); end; Employees See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Sections Property Gets the collection of Section objects in the report definition. [Visual Basic] Public ReadOnly Property Sections As SectionCollection [C#] public SectionCollection Sections {get;} [Delphi] public property Sections: SectionCollection read get_Sections; Remarks This collection always contains at least five items, which correspond to the standard report sections that are always present: Detail, Header, Footer, PageHeader, and PageFooter. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Tag Property Gets or sets extra data needed by the calling program. [Visual Basic] Public Property Tag As Object [C#] public object Tag {get;set;} [Delphi] public property Tag: Object read get_Tag write set_Tag; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report Methods The methods of the C1Report class are listed here. For a complete list of C1Report class members, see the C1Report Members topic. C1Report Methods · 153 Public Methods AddScriptObject Adds an object to the report's script context. BeginInit Signals the object that initialization is starting. Clear Clears the current report. CopyFrom Copies a report definition from another C1Report component. EndInit Signals the object that initialization is complete. Evaluate Evaluates a VBScript expression in the current report context. Execute Executes a VBScript statement in the current report context. GetReportInfo Overloaded. Gets a list of reports available in an XML report definition file. GetReportList Overloaded. Gets a list of reports available in an XML report definition file. Load Overloaded. Loads a report from an XML report definition file. ParseExpression Parses a VBScript expression in the current report context. ParseStatement Parses a VBScript statement in the current report context. Render Renders the report into an internal collection of images. RenderToFile Renders the report into a file. RenderToFilter Renders the report into an ExportFilter object. RenderToStream Overloaded. Renders the report into a System.IO.Stream object. Save Overloaded. Saves the current report definition to a file. Protected Methods Dispose Overloaded. Overriden. Releases the resources used by the component. OnEndPage Raises the EndPage event. OnEndReport Raises the EndReport event. OnEndSection Raises the EndSection event. OnNoReportData Raises the NoData event. OnPrintSection Raises the PrintSection event. OnReportError Raises the ReportError event. OnStartPage Raises the StartPage event. OnStartReport Raises the StartReport event. OnStartSection Raises the StartSection event. 154 · C1.Win.C1Report Namespace See Also C1Report Class | C1.Win.C1Report Namespace C1Report.AddScriptObject Method Adds an object to the report's script context. [Visual Basic] Public Sub AddScriptObject( _ ByVal name As String, _ ByVal value As Object _ ) [C#] public void AddScriptObject( string name, object value ); [Delphi] public procedure AddScriptObject( name: String; value: Object ); Parameters name Name of the new object (case-insensitive). value Value of the new object. Remarks This method allows you to add custom objects to the context of the C1Report script interpreter. The script interpreter context is cleared whenever a report starts rendering, so this method should always be called from the StartReport event handler. Example The code below uses the StartReport event to add a variable called "mainForm" to the script context. It then attaches some script to the report's OnOpen event to show the caption of the form when the report starts rendering. • Visual Basic Private Sub _c1r_StartReport(sender As Object, e As System.EventArgs) _c1r.AddScriptObject("mainForm", Me) End Sub Private Sub button1_Click(sender As Object, e As System.EventArgs) _c1r.OnOpen = "msgbox(mainForm.Text)" _c1r.Render() End Sub • C# private void _c1r_StartReport(object sender, System.EventArgs e) { C1Report.BeginInit Method · 155 } _c1r.AddScriptObject("mainForm", this); private void button1_Click(object sender, System.EventArgs e) { _c1r.OnOpen = "msgbox(mainForm.Text)"; _c1r.Render(); } • Delphi procedure _c1r_StartReport(sender: object; e: System.EventArgs); begin _c1r.AddScriptObject('mainForm', Self); end; procedure button1_Click(sender: object; e: System.EventArgs); begin _c1r.OnOpen := 'msgbox(mainForm.Text)'; _c1r.Render; end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.BeginInit Method Signals the object that initialization is starting. [Visual Basic] Overridable Public Sub BeginInit() Implements ISupportInitialize.BeginInit [C#] virtual public void BeginInit() [Delphi] public procedure BeginInit(); virtual; Implements ISupportInitialize.BeginInit See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Clear Method Clears the current report. [Visual Basic] Public Sub Clear() [C#] public void Clear() [Delphi] public procedure Clear(); 156 · C1.Win.C1Report Namespace Remarks This method removes all groups, group sections, and fields from the current report. It also resets the DataSource and Layout objects, and clears (but does not remove) the fixed sections that all reports have: Detail, Header, Footer, PageHeader, and PageFooter. Use this method when you want to clear a report and start creating a new one from scratch. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.CopyFrom Method Copies a report definition from another C1Report component. [Visual Basic] Public Sub CopyFrom( _ ByVal sourceReport As C1Report _ ) [C#] public void CopyFrom( C1Report sourceReport ); [Delphi] public procedure CopyFrom( sourceReport: C1Report ); Parameters sourceReport C1Report that contains the report to be copied. Remarks This method is equivalent to copying the ReportDefinition property from one C1Report to another, but is substantially faster. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Dispose Method Releases the resources used by the component. [Visual Basic] Overrides Protected Sub Dispose( _ ByVal disposing As Boolean _ ) [C#] override protected void Dispose( bool disposing ); C1Report.EndInit Method · 157 [Delphi] strict protected procedure Dispose( disposing: Boolean ); overload; override; Parameters disposing If True, managed resources as well as unmanaged resources are released; if False, only unmanaged resources are disposed. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.EndInit Method Signals the object that initialization is complete. [Visual Basic] Overridable Public Sub EndInit() Implements ISupportInitialize.EndInit [C#] virtual public void EndInit() [Delphi] public procedure EndInit(); virtual; Implements ISupportInitialize.EndInit See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Evaluate Method Evaluates a VBScript expression in the current report context. [Visual Basic] Public Function Evaluate( _ ByVal expression As String _ ) As Object [C#] public object Evaluate( string expression ); [Delphi] public function Evaluate( expression: String ): Object; Parameters expression A string with a VBScript expression to be evaluated. 158 · C1.Win.C1Report Namespace Return Value The value of the expression. Remarks Use this method to evaluate expressions as they would be evaluated while generating a report. This can be useful in designer-type applications, to provide an "Immediate Window" where users can test expressions. If the expression string contains invalid syntax or causes an evaluation error, the control raises the ReportError event. In this case, the Handled parameter of the event is set to True, so the exception is ignored by default. Example Expressions may contain simple VBScript expressions such as: Console.WriteLine(_c1r.Evaluate("2+2")); Console.WriteLine(_c1r.Evaluate(" \"A\" & \"B\" "); 4AB Expressions may also contain references to the Report object and all its sub-objects. For example: Console.WriteLine(_c1r.Evaluate("Report.DataSource.RecordSource")); Console.WriteLine(_c1r.Evaluate("Report.DataSource.Recordset.Fields.Count" )); Console.WriteLine(_c1r.Evaluate("Report.Fields(0).Name")); SELECT * FROM Employees7FirstNameField Finally, data fields, Field, and Section objects may be referenced directly by name. Console.WriteLine(_c1r.Evaluate("FirstNameField.Value")); Console.WriteLine(_c1r.Evaluate("CategoryName")); AndrewBeverages See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Execute Method Executes a VBScript statement in the current report context. [Visual Basic] Public Sub Execute( _ ByVal statement As String _ ) [C#] public void Execute( string statement ); [Delphi] public procedure Execute( statement: String ); Parameters statement A string with VBScript instructions to be executed. C1Report.GetReportInfo Method · 159 Remarks This method is similar to the Evaluate method, except it does not return a value. If the expression string contains invalid syntax or causes an evaluation error, the control raises the ReportError event. In this case, the Handled parameter of the event is set to True, so the exception is ignored by default. Example The following code moves the field Line106 one inch to the left: • Visual Basic c1r.Execute("Line106.Left = Line106.Left + 1440") • C# c1r.Execute("Line106.Left = Line106.Left + 1440"); • Delphi begin c1r.Execute('Line106.Left = Line106.Left + 1440'); end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.GetReportInfo Method Overload List Gets a list of reports available in an XML report definition file. [Visual Basic] Overloads Public Function GetReportInfo(String) As String [C#] public string[] GetReportInfo(string); [Delphi] public function GetReportInfo(String) : String[]; overload; Gets a list of reports available in an System.Xml.XmlDocument. [Visual Basic] Overloads Public Function GetReportInfo(XmlDocument) As String [C#] public string[] GetReportInfo(XmlDocument); [Delphi] public function GetReportInfo(XmlDocument) : String[]; overload; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.GetReportInfo Method (String) Gets a list of reports available in an XML report definition file. [Visual Basic] Overloads Public Function GetReportInfo( _ ByVal fileName As String _ ) As String [C#] public string GetReportInfo( string fileName ); 160 · C1.Win.C1Report Namespace [Delphi] public function GetReportInfo( fileName: String ): String; overload; Parameters fileName Contains the full name of the XML report definition file. Return Value A string array containing the names of all reports in the XML file. Example The following code populates a ComboBox control with all the reports in a file: • Visual Basic ' get application path Dim path As String = Application.StartupPath Dim i As Integer = path.IndexOf("\bin") If i > -1 Then path = path.Substring(0, i) path = path & "\" ' get names of reports in the report definition file m_File = appPath & DataFileName Dim reports As String() = c1r.GetReportInfo(m_File) ' populate list box cmbReport.Items.Clear() Dim report As String For Each report In reports cmbReport.Items.Add(report) Next • C# // get application path string path = Application.StartupPath; int i = path.IndexOf("\bin"); if ( i > -1 ) { path = path.Substring(0, i) path = path + "@\"; // get names of reports in the report definition file m_File = appPath + DataFileName; string[] reports = c1r.GetReportInfo(m_File); // populate list box cmbReport.Items.Clear(); foreach (string report In reports cmbReport.Items.Add(report); } • Delphi var reports: array of string; path: string; i: Integer; begin C1Report.GetReportList Method · 161 // get application path path := Application.StartupPath; i := path.IndexOf('\bin'); if i > -1 Then path = path.Substring(0, i); path := path +'\'; // get names of reports in the report definition file m_File := appPath + DataFileName; reports := c1r.GetReportInfo(m_File); // populate list box cmbReport.Items.Clear; for i := 0 to High(reports) do cmbReport.Items.Add(reports[i]); end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.GetReportInfo Overload List C1Report.GetReportInfo Method (XmlDocument) Gets a list of reports available in an System.Xml.XmlDocument. [Visual Basic] Overloads Public Function GetReportInfo( _ ByVal doc As XmlDocument _ ) As String [C#] public string GetReportInfo( XmlDocument doc ); [Delphi] public function GetReportInfo( doc: XmlDocument ): String; overload; Parameters doc Reference to the System.Xml.XmlDocument that contains the reports. Return Value A string array containing the names of all reports in the XmlDocument. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.GetReportInfo Overload List C1Report.GetReportList Method Overload List Gets a list of reports available in an XML report definition file. 162 · C1.Win.C1Report Namespace [Visual Basic] Overloads Public Shared Function GetReportList(String) As String [C#] public static string[] GetReportList(string); [Delphi] public class function GetReportList(String) : String[]; overload; Gets a list of reports available in an System.Xml.XmlDocument. [Visual Basic] Overloads Public Shared Function GetReportList(XmlDocument) As String [C#] public static string[] GetReportList(XmlDocument); [Delphi] public class function GetReportList(XmlDocument) : String[]; overload; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.GetReportList Method (String) Gets a list of reports available in an XML report definition file. [Visual Basic] Overloads Public Shared Function GetReportList( _ ByVal fileName As String _ ) As String [C#] public static string GetReportList( string fileName ); [Delphi] public class function GetReportList( fileName: String ): String; overload; Parameters fileName Contains the full name of the XML report definition file. Return Value A string array containing the names of all reports in the XML file. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.GetReportList Overload List C1Report.GetReportList Method (XmlDocument) Gets a list of reports available in an System.Xml.XmlDocument. [Visual Basic] Overloads Public Shared Function GetReportList( _ ByVal doc As XmlDocument _ ) As String C1Report.Load Method · 163 [C#] public static string GetReportList( XmlDocument doc ); [Delphi] public class function GetReportList( doc: XmlDocument ): String; overload; Parameters doc Reference to System.Xml.XmlDocument object. Return Value A string array containing the names of all reports in the XmlDocument. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.GetReportList Overload List C1Report.Load Method Overload List Loads a report from an XML report definition file. [Visual Basic] Overloads Public Sub Load(String, String) [C#] public void Load(string, string); [Delphi] public procedure Load(String; String); overload; Loads a report from an System.Xml.XmlDocument. [Visual Basic] Overloads Public Sub Load(XmlDocument, String) [C#] public void Load(XmlDocument, string); [Delphi] public procedure Load(XmlDocument; String); overload; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Load Method (String, String) Loads a report from an XML report definition file. [Visual Basic] Overloads Public Sub Load( _ ByVal fileName As String, _ ByVal reportName As String _ ) [C#] public void Load( string fileName, string reportName ); 164 · C1.Win.C1Report Namespace [Delphi] public procedure Load( fileName: String; reportName: String ); overload; Parameters fileName Full name of the XML report definition file. reportName Name of the report to retrieve from the file (case-insensitive). Remarks You can get a list of reports available in the file using the GetReportInfo (String) method. Example The following code loads and renders a report when the user picks it from the list: • Visual Basic Private Sub cmbReport_SelectedIndexChanged(_ ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles cmbReport.SelectedIndexChanged Try Cursor = Cursors.WaitCursor ' load report status.Text = "Loading " & cmbReport.Text c1r.Load(m_ReportDefinitionFile, cmbReport.Text) ' render into print preview control status.Text = "Rendering " & cmbReport.Text ppv.Document = c1r.Document ' give focus to print preview control ppv.StartPage = 0 ppv.Focus() Finally Cursor = Cursors.Default End Try End Sub • C# private void cmbReport_SelectedIndexChanged(_ System.object sender, System.EventArgs e) cmbReport.SelectedIndexChanged; { try { Cursor = Cursors.WaitCursor; // load report status.Text = "Loading " + cmbReport.Text; c1r.Load(m_ReportDefinitionFile, cmbReport.Text); C1Report.Load Method · 165 // render into print preview control status.Text = "Rendering " + cmbReport.Text; ppv.Document = c1r.Document; // give focus to print preview control ppv.StartPage = 0; ppv.Focus(); } • } finally { Cursor = Cursors.Default; } Delphi Include(Self.cmbReport.SelectedIndexChanged, Self.cmbReport_SelectedIndexChanged); procedure cmbReport_SelectedIndexChanged(sender: System.Object; e: System.EventArgs); begin Cursor := Cursors.WaitCursor; try // load report status.Text := 'Loading '+ cmbReport.Text; c1r.Load(m_ReportDefinitionFile, cmbReport.Text); // render into print preview control status.Text := 'Rendering '+ cmbReport.Text; ppv.Document := c1r.Document; // give focus to print preview control ppv.StartPage := 0; ppv.Focus; finally; Cursor := Cursors.Default; end; end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Load Overload List C1Report.Load Method (XmlDocument, String) Loads a report from an System.Xml.XmlDocument. [Visual Basic] Overloads Public Sub Load( _ ByVal doc As XmlDocument, _ ByVal reportName As String _ ) [C#] public void Load( XmlDocument doc, string reportName ); 166 · C1.Win.C1Report Namespace [Delphi] public procedure Load( doc: XmlDocument; reportName: String ); overload; Parameters doc Reference to the System.Xml.XmlDocument that contains the reports. reportName Name of the report to retrieve from the file (case-insensitive). Remarks You can get a list of reports available in the file using the GetReportInfo (String) method. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Load Overload List C1Report.OnEndPage Method Raises the EndPage event. [Visual Basic] Protected Sub OnEndPage( _ ByVal e As ReportEventArgs _ ) [C#] protected void OnEndPage( ReportEventArgs e ); [Delphi] strict protected procedure OnEndPage( e: ReportEventArgs ); Parameters e ReportEventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnEndReport Method Raises the EndReport event. [Visual Basic] Protected Sub OnEndReport( _ ByVal e As EventArgs _ ) C1Report.OnEndSection Method · 167 [C#] protected void OnEndReport( EventArgs e ); [Delphi] strict protected procedure OnEndReport( e: EventArgs ); Parameters e System.EventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnEndSection Method Raises the EndSection event. [Visual Basic] Protected Sub OnEndSection( _ ByVal e As ReportEventArgs _ ) [C#] protected void OnEndSection( ReportEventArgs e ); [Delphi] strict protected procedure OnEndSection( e: ReportEventArgs ); Parameters e ReportEventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnNoReportData Method Raises the NoData event. [Visual Basic] Protected Sub OnNoReportData( _ ByVal e As EventArgs _ ) 168 · C1.Win.C1Report Namespace [C#] protected void OnNoReportData( EventArgs e ); [Delphi] strict protected procedure OnNoReportData( e: EventArgs ); Parameters e System.EventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnPrintSection Method Raises the PrintSection event. [Visual Basic] Protected Sub OnPrintSection( _ ByVal e As ReportEventArgs _ ) [C#] protected void OnPrintSection( ReportEventArgs e ); [Delphi] strict protected procedure OnPrintSection( e: ReportEventArgs ); Parameters e ReportEventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnReportError Method Raises the ReportError event. [Visual Basic] Protected Sub OnReportError( _ ByVal e As ReportEventArgs _ ) C1Report.OnStartPage Method · 169 [C#] protected void OnReportError( ReportEventArgs e ); [Delphi] strict protected procedure OnReportError( e: ReportEventArgs ); Parameters e ReportEventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnStartPage Method Raises the StartPage event. [Visual Basic] Protected Sub OnStartPage( _ ByVal e As ReportEventArgs _ ) [C#] protected void OnStartPage( ReportEventArgs e ); [Delphi] strict protected procedure OnStartPage( e: ReportEventArgs ); Parameters e ReportEventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnStartReport Method Raises the StartReport event. [Visual Basic] Protected Sub OnStartReport( _ ByVal e As EventArgs _ ) 170 · C1.Win.C1Report Namespace [C#] protected void OnStartReport( EventArgs e ); [Delphi] strict protected procedure OnStartReport( e: EventArgs ); Parameters e System.EventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.OnStartSection Method Raises the StartSection event. [Visual Basic] Protected Sub OnStartSection( _ ByVal e As ReportEventArgs _ ) [C#] protected void OnStartSection( ReportEventArgs e ); [Delphi] strict protected procedure OnStartSection( e: ReportEventArgs ); Parameters e ReportEventArgs that contains event data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.ParseExpression Method Parses a VBScript expression in the current report context. [Visual Basic] Public Function ParseExpression( _ ByVal expression As String _ ) As Exception C1Report.ParseStatement Method · 171 [C#] public Exception ParseExpression( string expression ); [Delphi] public function ParseExpression( expression: String ): Exception; Parameters expression A string with a VBScript expression to be parsed. Return Value An System.Exception if the expression is invalid, or null if no errors were detected. Remarks This method is useful for providing VBScript syntax-checking in designer applications. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.ParseStatement Method Parses a VBScript statement in the current report context. [Visual Basic] Public Function ParseStatement( _ ByVal statement As String _ ) As Exception [C#] public Exception ParseStatement( string statement ); [Delphi] public function ParseStatement( statement: String ): Exception; Parameters statement A string with a VBScript statement to be parsed. Return Value An System.Exception if the statement is invalid, or null if no errors were detected. Remarks This method is useful for providing VBScript syntax-checking in designer applications. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace 172 · C1.Win.C1Report Namespace C1Report.Render Method Renders the report into an internal collection of images. [Visual Basic] Public Sub Render() [C#] public void Render() [Delphi] public procedure Render(); Remarks This method is called implicitly when other classes access the Document property, so you rarely have to call Render directly from your code. In some cases, you may want to access the report as a collection of pages, exposed by the PageImages property. To ensure that the image collection is available and up-to-date, call the Render method directly. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.RenderToFile Method Renders the report into a file. [Visual Basic] Public Sub RenderToFile( _ ByVal fileName As String, _ ByVal fmt As FileFormatEnum _ ) [C#] public void RenderToFile( string fileName, FileFormatEnum fmt ); [Delphi] public procedure RenderToFile( fileName: String; fmt: FileFormatEnum ); Parameters fileName Name of the file that will contain the report. fmt Type of file to create. Remarks This method causes the control to render the current report into a file. It is especially useful in server applications that create several reports in batch mode, and don't have a user interface. C1Report.RenderToFilter Method · 173 Example The following code provides an example of the RenderToFile method: • Visual Basic c1r1.RenderToFile(outFile + ".pdf", FileFormatEnum.PDF) c1r1.RenderToFile(outFile + ".xls", FileFormatEnum.Excel) • C# c1r1.RenderToFile(outFile + ".pdf", FileFormatEnum.PDF); c1r1.RenderToFile(outFile + ".xls", FileFormatEnum.Excel); • Delphi c1r1.RenderToFile(outFile +'.pdf', FileFormatEnum.PDF); c1r1.RenderToFile(outFile +'.xls', FileFormatEnum.Excel); See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.RenderToFilter Method Renders the report into an ExportFilter object. [Visual Basic] Public Sub RenderToFilter( _ ByVal filter As ExportFilter _ ) [C#] public void RenderToFilter( ExportFilter filter ); [Delphi] public procedure RenderToFilter( filter: ExportFilter ); Parameters filter Export filter that will render the report. Remarks C1Report includes several built-in export filters that allow you to export reports to HTML, PDF, RTF, Excel, and other formats. You may create your own filters by creating classes that derive from any of these base filters. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.RenderToStream Method Overload List Renders the report into a System.IO.Stream object. [Visual Basic] Overloads Public Sub RenderToStream(Stream, FileFormatEnum) 174 · C1.Win.C1Report Namespace [C#] public void RenderToStream(Stream, FileFormatEnum); [Delphi] public procedure RenderToStream(Stream; FileFormatEnum); overload; Renders the report into an HTML System.IO.Stream. [Visual Basic] Overloads Public Sub RenderToStream(Stream, FileFormatEnum, String, String) [C#] public void RenderToStream(Stream, FileFormatEnum, string, string); [Delphi] public procedure RenderToStream(Stream; FileFormatEnum; String; String); overload; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.RenderToStream Method (Stream, FileFormatEnum) Renders the report into a System.IO.Stream object. [Visual Basic] Overloads Public Sub RenderToStream( _ ByVal stream As Stream, _ ByVal fmt As FileFormatEnum _ ) [C#] public void RenderToStream( Stream stream, FileFormatEnum fmt ); [Delphi] public procedure RenderToStream( stream: Stream; fmt: FileFormatEnum ); overload; Parameters stream Stream that will contain the report. fmt Report format to insert into the output stream. Remarks This method is especially useful in ASP.NET scenarios where you want to render reports into HTML or PDF streams, without creating temporary files. Not all types of report can be rendered into streams. The Excel format requires OLE compound files and can only be rendered into files. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.RenderToStream Overload List C1Report.RenderToStream Method (Stream, FileFormatEnum, String, String) Renders the report into an HTML System.IO.Stream. C1Report.Save Method · 175 [Visual Basic] Overloads Public Sub RenderToStream( _ ByVal stream As Stream, _ ByVal fmt As FileFormatEnum, _ ByVal idPrefix As String, _ ByVal fileName As String _ ) [C#] public void RenderToStream( Stream stream, FileFormatEnum fmt, string idPrefix, string fileName ); [Delphi] public procedure RenderToStream( stream: Stream; fmt: FileFormatEnum; idPrefix: String; fileName: String ); overload; Parameters stream Stream that will contain the report. fmt Report format to insert into the output stream. idPrefix Unique ID used to differentiate multiple reports stored in the same stream. fileName Base file name used to build temporary image files. Remarks This method is used by the C1WebReport control to generate HTML reports in ASP.NET pages. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.RenderToStream Overload List C1Report.Save Method Overload List Saves the current report definition to a file. [Visual Basic] Overloads Public Sub Save(String) [C#] public void Save(string); [Delphi] public procedure Save(String); overload; 176 · C1.Win.C1Report Namespace Saves the current report definition to an System.Xml.XmlTextWriter object. [Visual Basic] Overloads Public Sub Save(XmlTextWriter) [C#] public void Save(XmlTextWriter); [Delphi] public procedure Save(XmlTextWriter); overload; Saves the current report definition to a file. [Visual Basic] Overloads Public Sub Save(String, Boolean) [C#] public void Save(string, bool); [Delphi] public procedure Save(String; Boolean); overload; Saves the current report definition to an XmlTextWriter object. [Visual Basic] Overloads Public Sub Save(XmlTextWriter, Boolean) [C#] public void Save(XmlTextWriter, bool); [Delphi] public procedure Save(XmlTextWriter; Boolean); overload; Saves the current report definition to a file. [Visual Basic] Overloads Public Sub Save(String, Boolean, Boolean) [C#] public void Save(string, bool, bool); [Delphi] public procedure Save(String; Boolean; Boolean); overload; Saves the current report definition to an XmlTextWriter object. [Visual Basic] Overloads Public Sub Save(XmlTextWriter, Boolean, Boolean) [C#] public void Save(XmlTextWriter, bool, bool); [Delphi] public procedure Save(XmlTextWriter; Boolean; Boolean); overload; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.Save Method (String) Saves the current report definition to a file. [Visual Basic] Overloads Public Sub Save( _ ByVal fileName As String _ ) [C#] public void Save( string fileName ); [Delphi] public procedure Save( fileName: String ); overload; C1Report.Save Method · 177 Parameters fileName Full name of the file to be created (if the file already exists, it will be overwritten). Remarks This method does not embed pictures and subreports into the output file. It only saves subreport names and saves images in external files. Example The following code saves the file MyReport.xml: • Visual Basic c1r.Save(path & "MyReport.xml") • C# c1r.Save(path + "MyReport.xml"); • Delphi c1r.Save(path + 'MyReport.xml'); See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Save Overload List C1Report.Save Method (XmlTextWriter) Saves the current report definition to an System.Xml.XmlTextWriter object. [Visual Basic] Overloads Public Sub Save( _ ByVal writer As XmlTextWriter _ ) [C#] public void Save( XmlTextWriter writer ); [Delphi] public procedure Save( writer: XmlTextWriter ); overload; Parameters writer An System.Xml.XmlTextWriter object where the report definition will be saved. Remarks This method does not embed pictures and subreports into the output file. It only saves subreport names and saves images in external files. Example The following code saves the file MyReports.xml: • Visual Basic Private Sub btnSave_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ 178 · C1.Win.C1Report Namespace Handles btnSave.Click ' open xml file Dim fileName As String = _ Path.GetDirectoryName(Application.ExecutablePath) + _ "\MyReports.xml" Dim writer As XmlTextWriter = _ New XmlTextWriter(fileName, System.Text.Encoding.Default) ' initialize xml file writer.Formatting = Formatting.Indented writer.Indentation = 2 writer.WriteStartDocument() writer.WriteStartElement("Reports") ' save Customers report RenderCustomers() c1r.ReportName = "Customers" c1r.Save(writer) ' save Employees report RenderEmployees() c1r.ReportName = "Employees" c1r.Save(writer) ' close xml file writer.WriteEndElement() writer.Close() End Sub • C# private void btnSave_Click( System.object sender, btnSave.Click { System.EventArgs e) // open xml file string fileName = Path.GetDirectoryName(Application.ExecutablePath) + "\MyReports.xml"; XmlTextWriter writer = new XmlTextWriter(fileName, system.Text.Encoding.Default); // initialize xml file writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartDocument(); writer.WriteStartElement("Reports"); // save Customers report RenderCustomers(); c1r.ReportName = "Customers"; c1r.Save(writer); // save Employees report RenderEmployees(); c1r.ReportName = "Employees"; C1Report.Save Method · 179 c1r.Save(writer); // close xml file writer.WriteEndElement(); writer.Close(); } • Delphi Include(Self.btnSave.Click, Self.btnSave_Click); procedure btnSave_Click(sender: System.Object; e: System.EventArgs); var fileName: string; writer: XmlTextWriter; begin // open xml file fileName := Path.GetDirectoryName(Application.ExecutablePath) + '\MyReports.xml'; writer := XmlTextWriter.Create(fileName, System.Text.Encoding.Default); // initialize xml file writer.Formatting := Formatting.Indented; writer.Indentation := 2; writer.WriteStartDocument; writer.WriteStartElement('Reports'); // save Customers report RenderCustomers; c1r.ReportName := 'Customers'; c1r.Save(writer); // save Employees report RenderEmployees; c1r.ReportName := 'Employees'; c1r.Save(writer); // close xml file writer.WriteEndElement; writer.Close; end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Save Overload List C1Report.Save Method (String, Boolean) Saves the current report definition to a file. [Visual Basic] Overloads Public Sub Save( _ ByVal fileName As String, _ ByVal embedAll As Boolean _ ) 180 · C1.Win.C1Report Namespace [C#] public void Save( string fileName, bool embedAll ); [Delphi] public procedure Save( fileName: String; embedAll: Boolean ); overload; Parameters fileName Full name of the file to be created (if the file already exists, it will be overwritten). embedAll Whether to embed images and subreports into the output file. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Save Overload List C1Report.Save Method (XmlTextWriter, Boolean) Saves the current report definition to an XmlTextWriter object. [Visual Basic] Overloads Public Sub Save( _ ByVal writer As XmlTextWriter, _ ByVal embed As Boolean _ ) [C#] public void Save( XmlTextWriter writer, bool embed ); [Delphi] public procedure Save( writer: XmlTextWriter; embed: Boolean ); overload; Parameters writer An System.Xml.XmlTextWriter object where the report definition will be saved. embed Whether to embed images and subreports into the output stream. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Save Overload List C1Report.Save Method · 181 C1Report.Save Method (String, Boolean, Boolean) Saves the current report definition to a file. [Visual Basic] Overloads Public Sub Save( _ ByVal fileName As String, _ ByVal embedPics As Boolean, _ ByVal embedSubs As Boolean _ ) [C#] public void Save( string fileName, bool embedPics, bool embedSubs ); [Delphi] public procedure Save( fileName: String; embedPics: Boolean; embedSubs: Boolean ); overload; Parameters fileName Full name of the file to be created (if the file already exists, it will be overwritten). embedPics Whether to embed images into the output file. embedSubs Whether to embed subreports into the output file. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Save Overload List C1Report.Save Method (XmlTextWriter, Boolean, Boolean) Saves the current report definition to an XmlTextWriter object. [Visual Basic] Overloads Public Sub Save( _ ByVal writer As XmlTextWriter, _ ByVal embedPics As Boolean, _ ByVal embedSubs As Boolean _ ) [C#] public void Save( XmlTextWriter writer, bool embedPics, bool embedSubs ); 182 · C1.Win.C1Report Namespace [Delphi] public procedure Save( writer: XmlTextWriter; embedPics: Boolean; embedSubs: Boolean ); overload; Parameters writer An System.Xml.XmlTextWriter object where the report definition will be saved. embedPics Whether to embed images into the output stream. embedSubs Whether to embed subreports into the output stream. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace | C1Report.Save Overload List C1Report Events The events of the C1Report class are listed here. For a complete list of C1Report class members, see the C1Report Members topic. Public Events AddOutlineEntry Fired before the control adds an outline entry to the report. EndPage Fired when the control finishes rendering each page. EndReport Fired when the control finishes rendering the report. EndSection Fired when the control finishes rendering each Section. InitializeParametersDialog Fired before the control displays the Report Parameters dialog. NoData Fired when the control starts rendering a report and the data source is empty. PrintSection Fired before each Section is printed (after it has been formatted.) ReportError Fired when an error occurs while rendering a report. StartPage Fired when the control starts rendering each page. StartReport Fired when the control starts rendering the report, before it opens the source recordset. StartSection Fired before each Section is formatted. See Also C1Report Class | C1.Win.C1Report Namespace C1Report.AddOutlineEntry Event Fired before the control adds an outline entry to the report. C1Report.EndPage Event · 183 [Visual Basic] Public Event AddOutlineEntry As AddOutlineEntryHandler [C#] public event AddOutlineEntryHandler AddOutlineEntry [Delphi] public property AddOutlineEntry: AddOutlineEntryHandler read remove_AddOutlineEntry write add_AddOutlineEntry; Remarks Some report output formats include an outline that is built based on the report groups. For example, PDF reports show this outline on the left pane of the reader application. The outline contains one entry for each group header, and the entry text is based on the value of the GroupBy expression for the group. This event allows you to change or suppress the text that appears on the outline. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.EndPage Event Fired when the control finishes rendering each page. [Visual Basic] Public Event EndPage As ReportEventHandler [C#] public event ReportEventHandler EndPage [Delphi] public property EndPage: ReportEventHandler read remove_EndPage write add_EndPage; Remarks This event is useful for updating the user interface to show how many pages have been printed so far. You can use the Cancel property while handling this event to cancel rendering the report. To limit the number of pages that can be printed, use the MaxPages property instead. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.EndReport Event Fired when the control finishes rendering the report. [Visual Basic] Public Event EndReport As EventHandler [C#] public event EventHandler EndReport 184 · C1.Win.C1Report Namespace [Delphi] public property EndReport: EventHandler read remove_EndReport write add_EndReport; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.EndSection Event Fired when the control finishes rendering each Section. [Visual Basic] Public Event EndSection As ReportEventHandler [C#] public event ReportEventHandler EndSection [Delphi] public property EndSection: ReportEventHandler read remove_EndSection write add_EndSection; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.InitializeParametersDialog Event Fired before the control displays the Report Parameters dialog. [Visual Basic] Public Event InitializeParametersDialog As DialogEventHandler [C#] public event DialogEventHandler InitializeParametersDialog [Delphi] public property InitializeParametersDialog: DialogEventHandler read remove_InitializeParametersDialog write add_InitializeParametersDialog; Remarks Reports that have a PARAMETERS clause in their DataSource.RecordSource property show a dialog where the user can enter report parameters. This event Fired before the dialog is displayed and allows you to customize the dialog by changing its caption, font, colors, etc. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.NoData Event Fired when the control starts rendering a report and the data source is empty. [Visual Basic] Public Event NoData As EventHandler C1Report.PrintSection Event · 185 [C#] public event EventHandler NoData [Delphi] public property NoData: EventHandler read remove_NoData write add_NoData; Remarks You can use this event to cancel rendering a report when the source recordset is empty. If you don't cancel the report, it will be rendered as an unbound report (a self-contained report with no underlying data). Example The code below cancels a report when it has no data: • Visual Basic Private Sub c1r_NoData(sender As Object, e As EventArgs) _c1r.Cancel = True End Sub • C# private void c1r_NoData(object sender, EventArgs e) { _c1r.Cancel = true; } • Delphi procedure c1r_NoData(sender: object; e: System.EventArgs); begin _c1r.Cancel := True; end; See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.PrintSection Event Fired before each Section is printed (after it has been formatted.) [Visual Basic] Public Event PrintSection As ReportEventHandler [C#] public event ReportEventHandler PrintSection [Delphi] public property PrintSection: ReportEventHandler read remove_PrintSection write add_PrintSection; Remarks When this event fires, the field values and sizes have been set by the control. You may still make changes, but they will not affect the field layout. For example, changing a field's Text property at this point will not cause it to grow or shrink. This event is equivalent to the OnPrint script property. 186 · C1.Win.C1Report Namespace See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.ReportError Event Fired when an error occurs while rendering a report. [Visual Basic] Public Event ReportError As ReportEventHandler [C#] public event ReportEventHandler ReportError [Delphi] public property ReportError: ReportEventHandler read remove_ReportError write add_ReportError; Remarks The most common types of errors found when rendering reports are: 1) Invalid ConnectionString or RecordSource parameters. This usually indicates that the system could not open the specified database (a server may be off line, or a database file may be in a different location than what was specified) or that the SQL syntax used for the RecordSource property contains errors. 2) Error executing scripts or evaluating expressions. This usually indicates that the VBScript expression used contains a syntax error. In these cases, make sure you look at the exception message. It usually contains a good explanation of what caused the error. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.StartPage Event Fired when the control starts rendering each page. [Visual Basic] Public Event StartPage As ReportEventHandler [C#] public event ReportEventHandler StartPage [Delphi] public property StartPage: ReportEventHandler read remove_StartPage write add_StartPage; Remarks This event is useful for updating the user interface to show how many pages have been printed so far. You can use the Cancel property while handling this event to cancel rendering the report. To limit the number of pages that can be printed, use the MaxPages property instead. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.StartReport Event · 187 C1Report.StartReport Event Fired when the control starts rendering the report, before it opens the source recordset. [Visual Basic] Public Event StartReport As EventHandler [C#] public event EventHandler StartReport [Delphi] public property StartReport: EventHandler read remove_StartReport write add_StartReport; Remarks You can use this event to provide user feedback or to make changes to the ConnectionString and RecordSource properties. For example, you may implement your own version of parameterized queries by asking the user to provide some information and changing the RecordSource property accordingly. You may also use this event to assign a System.Data.DataTable object directly to the report's Recordset property. Applications that already have the report data should do this to save time by preventing C1Report from loading its own copy of the data. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace C1Report.StartSection Event Fired before each Section is formatted. [Visual Basic] Public Event StartSection As ReportEventHandler [C#] public event ReportEventHandler StartSection [Delphi] public property StartSection: ReportEventHandler read remove_StartSection write add_StartSection; Remarks When this event fires, the report fields have not been updated with the current values or sizes. This is a good point to set field formatting parameters and visibility based on the current data values. This event is equivalent to the OnFormat script property. See Also C1Report Class | C1Report Members | C1.Win.C1Report Namespace CheckBoxEnum Enumeration Specifies how Boolean values are translated into checkboxes. 188 · C1.Win.C1Report Namespace [Visual Basic] Public Enum CheckBoxEnum [C#] public enum CheckBoxEnum [Delphi] type CheckBoxEnum = (CheckBox, CrossBox, NoCheckBox, RadioButton); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the CheckBox property in the Field class. This property is useful when you wish to display Boolean values graphically, rather than using text. Members Member name Description CheckBox Checkbox. CrossBox Crossbox. NoCheckBox No checkbox (display as text). RadioButton Radio button. See Also C1.Win.C1Report Namespace ColumnLayoutEnum Enumeration Specifies the layout for the columns (down or across). [Visual Basic] Public Enum ColumnLayoutEnum [C#] public enum ColumnLayoutEnum [Delphi] type ColumnLayoutEnum = (Across, Down, Labels); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the ColumnLayout property in the Layout class. Members Member name Description Across Columns are laid out across the page, then down. Down Columns are laid out down the page, then across. DataAccessException Class · 189 Member name Description Labels Causes the report designer to discount label spacing in the design surface, hide header/footer sections, disable grouping button, and disable automatic section resizing when fields are moved or dragged. See Also C1.Win.C1Report Namespace DataAccessException Class System.Exception that is thrown when a data access error occurs. For a list of all members of this type, see DataAccessException Members. System.Object System.Exception System.ApplicationException C1.Win.C1Report.DataAccessException [Visual Basic] Public Class DataAccessException Inherits ApplicationException [C#] public class DataAccessException : ApplicationException [Delphi] type DataAccessException = class (ApplicationException); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also DataAccessException Members | C1.Win.C1Report Namespace DataAccessException Members DataAccessException overview Public Constructors DataAccessException Constructor Initializes a new instance of the DataAccessException class. Protected Constructors DataAccessException Constructor Initializes a new instance of the DataAccessException class with serialized data. See Also DataAccessException Class | C1.Win.C1Report Namespace 190 · C1.Win.C1Report Namespace DataAccessException Constructor Overload List Initializes a new instance of the DataAccessException class. [Visual Basic] Public Function New() [C#] public DataAccessException(); [Delphi] public constructor Create(); overload; Initializes a new instance of the DataAccessException class with a specified error message. [Visual Basic] Public Function New(String) [C#] public DataAccessException(string); [Delphi] public constructor Create(String); overload; Initializes a new instance of the DataAccessException class with serialized data. [Visual Basic] Protected Function New(SerializationInfo, StreamingContext) [C#] protected DataAccessException(SerializationInfo, StreamingContext); [Delphi] strict protected constructor Create(SerializationInfo; StreamingContext); overload; Initializes a new instance of the DataAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception. [Visual Basic] Public Function New(String, Exception) [C#] public DataAccessException(string, Exception); [Delphi] public constructor Create(String; Exception); overload; See Also DataAccessException Class | DataAccessException Members | C1.Win.C1Report Namespace DataAccessException Constructor () Initializes a new instance of the DataAccessException class. [Visual Basic] Public Function New() [C#] public DataAccessException() [Delphi] public constructor Create(); overload; See Also DataAccessException Class | DataAccessException Members | C1.Win.C1Report Namespace | DataAccessException Constructor Overload List DataAccessException Constructor (String) Initializes a new instance of the DataAccessException class with a specified error message. DataAccessException Constructor · 191 [Visual Basic] Public Function New( _ ByVal msg As String _ ) [C#] public DataAccessException( string msg ); [Delphi] public constructor Create( msg: String ); overload; Parameters msg A message that describes the error. See Also DataAccessException Class | DataAccessException Members | C1.Win.C1Report Namespace | DataAccessException Constructor Overload List DataAccessException Constructor (SerializationInfo, StreamingContext) Initializes a new instance of the DataAccessException class with serialized data. [Visual Basic] Protected Function New( _ ByVal si As SerializationInfo, _ ByVal sc As StreamingContext _ ) [C#] protected DataAccessException( SerializationInfo si, StreamingContext sc ); [Delphi] strict protected constructor Create( si: SerializationInfo; sc: StreamingContext ); overload; Parameters si The object that holds the serialized object data. sc The contextual information about the source or destination. 192 · C1.Win.C1Report Namespace See Also DataAccessException Class | DataAccessException Members | C1.Win.C1Report Namespace | DataAccessException Constructor Overload List DataAccessException Constructor (String, Exception) Initializes a new instance of the DataAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception. [Visual Basic] Public Function New( _ ByVal msg As String, _ ByVal x As Exception _ ) [C#] public DataAccessException( string msg, Exception x ); [Delphi] public constructor Create( msg: String; x: Exception ); overload; Parameters msg The error message that explains the reason for the exception. x The exception that is the cause of the current exception. See Also DataAccessException Class | DataAccessException Members | C1.Win.C1Report Namespace | DataAccessException Constructor Overload List DataSource Class Provides data for reports. For a list of all members of this type, see DataSource Members. System.Object C1.Win.C1Report.DataSource [Visual Basic] Public Class DataSource [C#] public class DataSource DataSource Members · 193 [Delphi] type DataSource = class; Remarks Most reports specify their data sources by setting the ConnectionString and RecordSource properties. The DataSource object uses these values to connect to a database and retrieve the report data. Alternatively, you can assign data objects directly to the Recordset property. This approach is more efficient in scenarios where the data has already been loaded by the application for other purposes, and can be used in the report directly instead of loading a copy. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also DataSource Members | C1.Win.C1Report Namespace DataSource Members DataSource overview Public Properties CommandTimeOut Gets or sets the number of seconds to wait before the data connection times out (set to -1 to use the default value, usually 30s). ConnectionString Gets or sets the string used to open a database. Filter Gets or sets the expression used to filter which data rows are included in the report. MaxRecords Gets or sets the maximum number of data rows to be included in the report (set to zero to include all rows). ParentReport Gets the report that contains this DataSource. Recordset Sets or gets the data source object that provides data to the report. RecordSource Gets or sets a string that specifies which table, stored procedure, or SQL command to use for retrieving the report data. Public Methods BOF Returns True if the cursor is pointing at the first record in the data source. EOF Returns True if the cursor is pointing at the last record in the data source. GetBookmark Returns the current cursor position. GetFieldValue Gets the value of the given field, at the cursor position. GetRecordSource Processes the PARAMETERS clause in the RecordSource string and returns the result. MoveFirst Moves the cursor to the first record in the data source. MoveLast Moves the cursor to the last record in the data source. 194 · C1.Win.C1Report Namespace MoveNext Moves the cursor to the next record in the data source. MovePrevious Moves the cursor to the previous record in the data source. SetBookmark Sets the current cursor position to supplied value. ToString Overriden. Returns a string representation of DataSource object. See Also DataSource Class | C1.Win.C1Report Namespace DataSource Properties The properties of the DataSource class are listed here. For a complete list of DataSource class members, see the DataSource Members topic. Public Properties CommandTimeOut Gets or sets the number of seconds to wait before the data connection times out (set to -1 to use the default value, usually 30s). ConnectionString Gets or sets the string used to open a database. Filter Gets or sets the expression used to filter which data rows are included in the report. MaxRecords Gets or sets the maximum number of data rows to be included in the report (set to zero to include all rows). ParentReport Gets the report that contains this DataSource. Recordset Sets or gets the data source object that provides data to the report. RecordSource Gets or sets a string that specifies which table, stored procedure, or SQL command to use for retrieving the report data. See Also DataSource Class | C1.Win.C1Report Namespace DataSource.CommandTimeOut Property Gets or sets the number of seconds to wait before the data connection times out (set to -1 to use the default value, usually 30s). [Visual Basic] Public Property CommandTimeOut As Integer [C#] public int CommandTimeOut {get;set;} [Delphi] public property CommandTimeOut: Int32 read get_CommandTimeOut write set_CommandTimeOut; DataSource.ConnectionString Property · 195 See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.ConnectionString Property Gets or sets the string used to open a database. [Visual Basic] Public Property ConnectionString As String [C#] public string ConnectionString {get;set;} [Delphi] public property ConnectionString: String read get_ConnectionString write set_ConnectionString; Remarks The ConnectionString is used by the DataSource class to load the report data. The DataSource class uses an System.Data.OleDb.OleDbConnection object to retrieve the data, so the syntax for the ConnectionString is the one used OleDb connection strings. For details on the syntax, see the documentation for the System.Data.OleDb.OleDbConnection class. The ConnectionString specifies the database that contains the report data. The RecordSource property specifies which table, stored procedure, or SQL command to use for retrieveing the data. If you want to use a different type of connection (e.g. a System.Data.SqlClient.SqlConnection, or if your application already has the data available in a System.Data.DataTable object), you can assign the data directly to the Recordset property. See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.Filter Property Gets or sets the expression used to filter which data rows are included in the report. [Visual Basic] Public Property Filter As String [C#] public string Filter {get;set;} [Delphi] public property Filter: String read get_Filter write set_Filter; Remarks Use the Filter property to restrict the records that you want to include in a report without modifying the RecordSource property. Using a filter is similar to specifying a WHERE clause in the SQL statement assigned to the RecordSource property. Both techniques will filter the data according to the condidtion specified. The difference is that the Filter property is applied to a table that has already been loaded in memory, while the WHERE statement causes only the filtered records to be loaded from the database into memory. 196 · C1.Win.C1Report Namespace When creating reports that include only small subsets large tables, the WHERE statement is a better option, because it doesn't require the entire table to be loaded into memory. On the other hand, if the table has already been loaded in memory, the Filter property is a better option, since it does not require any additional data to be loaded. The syntax for the filter expression is the same used to specify the System.Data.DataView.RowFilter property for System.Data.DataView objects. The expressions consist of conditions in the form ColumnNameOperatorValue, where ColumnName is the name of a column in the data source (optionally enclosed in square brackets), Operator is one of the regular Visual Basic comparison operators, and Value is a literal enclosed in single quotes. Conditions may be concatenated using AND and OR operators. Example The code below shows how to apply a filter to a data source using the Filter property and using a WHERE clause in a SQL statement: • Visual Basic If useFilterProperty Then ' load all records, filter in memory _c1r.DataSource.RecordSource = "SELECT * from Employees" _c1r.DataSource.Filter = "HireDate >= '1/1/1993' AND Country = 'UK'" Else ' load selected records only _c1r.DataSource.RecordSource = "SELECT * from Employees " + "WHERE HireDate >= #1/1/1993# AND Country = 'UK'" End If • C# if (useFilterProperty) { // load all records, filter in memory _c1r.DataSource.RecordSource = "SELECT * from Employees"; _c1r.DataSource.Filter = "HireDate >= '1/1/1993' AND Country = 'UK'"; } else { // load selected records only _c1r.DataSource.RecordSource = "SELECT * from Employees " + "WHERE HireDate >= #1/1/1993# AND Country = 'UK'"; } • Delphi if useFilterProperty then begin // load all records, filter in memory _c1r.DataSource.RecordSource := 'SELECT * from Employees'; _c1r.DataSource.Filter := 'HireDate >= ''1/1/1993'' AND Country = ''UK'''; end else // load selected records only _c1r.DataSource.RecordSource := ('SELECT * from Employees ' + 'WHERE HireDate >= #1/1/1993# AND Country = ''UK'''); See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.MaxRecords Property · 197 DataSource.MaxRecords Property Gets or sets the maximum number of data rows to be included in the report (set to zero to include all rows). [Visual Basic] Public Property MaxRecords As Integer [C#] public int MaxRecords {get;set;} [Delphi] public property MaxRecords: Int32 read get_MaxRecords write set_MaxRecords; Remarks This property is useful if you want to limit the size of a report. For example, you may write a report designer with a preview window that shows only the first 500 records from the database. Setting this property to zero causes the control to retrieve all records. You can also limit the size of reports by setting the MaxPages property. See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.ParentReport Property Gets the report that contains this DataSource. [Visual Basic] Public ReadOnly Property ParentReport As C1Report [C#] public C1Report ParentReport {get;} [Delphi] public property ParentReport: C1Report read get_ParentReport; See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.Recordset Property Sets or gets the data source object that provides data to the report. [Visual Basic] Public Property Recordset As Object [C#] public object Recordset {get;set;} [Delphi] public property Recordset: Object read get_Recordset write set_Recordset; 198 · C1.Win.C1Report Namespace Property Value You can assign objects of the following types to the Recordset property: (1) System.Data.DataTable objects, (2) System.Data.DataView objects, or (3) any object that implements the IC1ReportRecordset interface. Remarks Usually, the control creates a System.Data.DataTable object based on the value of the ConnectionString and RecordSource properties, and uses that object as the report data source. Alternatively, you may want to create the data source object yourself, and assign it to the control. You can do that by assigning your data source object to the Recordset property. When a DataTable or DataView object is assigned to the Recordset property, C1Report automatically creates an internal wrapper class that implements the IC1ReportRecordset interface. Because of this, you can't get the original DataTable or DataView objects back by reading the property value. Instead, you must cast the wrapper object to an System.ComponentModel.IListSource and use the System.ComponentModel.IListSource.GetList method instead, as shown in the example below.You can assign objects of the following types to the Recordset property: (1) System.Data.DataTable objects, (2) System.Data.DataView objects, or (3) any object that implements the IC1ReportRecordset interface. Example The following code provides an example of the Recordset property: • Visual Basic ' create a DataTable Dim dt As DataTable = New DataTable("my table") ' assign it to c1report ' automatically creates IC1ReportRecordset wrapper c1r.DataSource.Recordset = dt ' 1) this doesn't work (dbBad == null) Dim wrapper As Object = c1Report1.DataSource.Recordset Dim dtBad As DataTable = wrapper as DataTable ' 2) this does (dtGood == dt) Dim dv As DataView = (CType(wrapper, IListSource)).GetList() as DataView Dim dtGood As DataTable = dv.Table • C# // create a DataTable DataTable dt = new DataTable("my table"); // assign it to c1report // automatically creates IC1ReportRecordset wrapper c1r.DataSource.Recordset = dt; // 1) this doesn't work (dbBad == null) object wrapper = c1Report1.DataSource.Recordset; DataTable dtBad = wrapper as DataTable; // 2) this does (dtGood == dt) DataView dv = ((IListSource)wrapper).GetList() as DataView; DataTable dtGood = dv.Table; • Delphi -- N/A DataSource.RecordSource Property · 199 See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.RecordSource Property Gets or sets a string that specifies which table, stored procedure, or SQL command to use for retrieving the report data. [Visual Basic] Public Property RecordSource As String [C#] public string RecordSource {get;set;} [Delphi] public property RecordSource: String read get_RecordSource write set_RecordSource; Remarks The ConnectionString specifies the database that contains the report data. The RecordSource property specifies which table, stored procedure, or SQL command to use for retrieveing the data. If you want to use a different type of connection (e.g. a System.Data.SqlClient.SqlConnection, or if your application already has the data available in a System.Data.DataTable object), you can assign the data directly to the Recordset property. See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource Methods The methods of the DataSource class are listed here. For a complete list of DataSource class members, see the DataSource Members topic. Public Methods BOF Returns True if the cursor is pointing at the first record in the data source. EOF Returns True if the cursor is pointing at the last record in the data source. GetBookmark Returns the current cursor position. GetFieldValue Gets the value of the given field, at the cursor position. GetRecordSource Processes the PARAMETERS clause in the RecordSource string and returns the result. MoveFirst Moves the cursor to the first record in the data source. MoveLast Moves the cursor to the last record in the data source. MoveNext Moves the cursor to the next record in the data source. MovePrevious Moves the cursor to the previous record in the data source. SetBookmark Sets the current cursor position to supplied value. 200 · C1.Win.C1Report Namespace ToString Overriden. Returns a string representation of DataSource object. See Also DataSource Class | C1.Win.C1Report Namespace DataSource.BOF Method Returns True if the cursor is pointing at the first record in the data source. [Visual Basic] Public Function BOF() As Boolean [C#] public bool BOF() [Delphi] public function BOF(): Boolean; See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.EOF Method Returns True if the cursor is pointing at the last record in the data source. [Visual Basic] Public Function EOF() As Boolean [C#] public bool EOF() [Delphi] public function EOF(): Boolean; See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.GetBookmark Method Returns the current cursor position. [Visual Basic] Public Function GetBookmark() As Integer [C#] public int GetBookmark() [Delphi] public function GetBookmark(): Int32; Return Value Index of current record. DataSource.GetFieldValue Method · 201 See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.GetFieldValue Method Gets the value of the given field, at the cursor position. [Visual Basic] Public Function GetFieldValue( _ ByVal fieldIndex As Integer _ ) As Object [C#] public object GetFieldValue( int fieldIndex ); [Delphi] public function GetFieldValue( fieldIndex: Int32 ): Object; Parameters fieldIndex Index of the field. Return Value Value of the field. See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.GetRecordSource Method Processes the PARAMETERS clause in the RecordSource string and returns the result. [Visual Basic] Public Function GetRecordSource( _ ByVal prompt As Boolean _ ) As String [C#] public string GetRecordSource( bool prompt ); [Delphi] public function GetRecordSource( prompt: Boolean ): String; 202 · C1.Win.C1Report Namespace Parameters prompt If set to True, user will be prompted for the parameters before the method returns. If set to False, the default values will be used. Return Value The string (SQL statement or table name) that can be used to open a recordset. Remarks This property is related to the RecordSource property. The RecordSource property sets or returns a string that specifies the source dataset for the report, and it may contain a PARAMETERS clause that causes C1Report to prompt the user for information. If you wanted to use the value of the RecordSource property to open a dataset directly from your program, you would have to parse the PARAMETERS clause yourself. See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.MoveFirst Method Moves the cursor to the first record in the data source. [Visual Basic] Public Sub MoveFirst() [C#] public void MoveFirst() [Delphi] public procedure MoveFirst(); See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.MoveLast Method Moves the cursor to the last record in the data source. [Visual Basic] Public Sub MoveLast() [C#] public void MoveLast() [Delphi] public procedure MoveLast(); See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.MoveNext Method Moves the cursor to the next record in the data source. DataSource.MovePrevious Method · 203 [Visual Basic] Public Sub MoveNext() [C#] public void MoveNext() [Delphi] public procedure MoveNext(); See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.MovePrevious Method Moves the cursor to the previous record in the data source. [Visual Basic] Public Sub MovePrevious() [C#] public void MovePrevious() [Delphi] public procedure MovePrevious(); See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DataSource.SetBookmark Method Sets the current cursor position to supplied value. [Visual Basic] Public Sub SetBookmark( _ ByVal bkmk As Integer _ ) [C#] public void SetBookmark( int bkmk ); [Delphi] public procedure SetBookmark( bkmk: Int32 ); Parameters bkmk Index of record. See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace 204 · C1.Win.C1Report Namespace DataSource.ToString Method Returns a string representation of DataSource object. [Visual Basic] Overrides Public Function ToString() As String [C#] override public string ToString() [Delphi] public function ToString(): String; override; Return Value The value of RecordSource property if supplied by the user, or (none) otherwise. See Also DataSource Class | DataSource Members | C1.Win.C1Report Namespace DialogEventArgs Class Provides data for InitializeParametersDialog event. For a list of all members of this type, see DialogEventArgs Members. System.Object System.EventArgs C1.Win.C1Report.DialogEventArgs [Visual Basic] Public Class DialogEventArgs Inherits EventArgs [C#] public class DialogEventArgs : EventArgs [Delphi] type DialogEventArgs = class (EventArgs); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also DialogEventArgs Members | C1.Win.C1Report Namespace DialogEventArgs Members DialogEventArgs overview Public Fields Dialog Reference to a System.Windows.Forms.Form that is about to be displayed. DialogEventArgs Fields · 205 See Also DialogEventArgs Class | C1.Win.C1Report Namespace DialogEventArgs Fields The fields of the DialogEventArgs class are listed here. For a complete list of DialogEventArgs class members, see the DialogEventArgs Members topic. Public Fields Dialog Reference to a System.Windows.Forms.Form that is about to be displayed. See Also DialogEventArgs Class | C1.Win.C1Report Namespace DialogEventArgs.Dialog Field Reference to a System.Windows.Forms.Form that is about to be displayed. [Visual Basic] Public ReadOnly Dialog As Form [C#] public readonly Form Dialog [Delphi] public Dialog: Form; See Also DialogEventArgs Class | DialogEventArgs Members | C1.Win.C1Report Namespace DialogEventHandler Delegate Represents the method that will handle the InitializeParametersDialog event. [Visual Basic] Public Delegate Sub DialogEventHandler( _ ByVal sender As Object, _ ByVal e As DialogEventArgs _ ) [C#] public delegate void DialogEventHandler( object sender, DialogEventArgs e ); [Delphi] type DialogEventHandler = procedure ( sender: Object; e: DialogEventArgs ) of object; 206 · C1.Win.C1Report Namespace Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also C1.Win.C1Report Namespace ExportFilter Class Base class for all export filters, used with the RenderToFilter method to render reports into different formats. For a list of all members of this type, see ExportFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.HtmlFilter C1.Win.C1Report.PdfFilter C1.Win.C1Report.RtfFilter C1.Win.C1Report.TextFilter C1.Win.C1Report.TiffFilter C1.Win.C1Report.XlsFilter [Visual Basic] MustInherit Public Class ExportFilter Implements IDisposable [C#] public abstract class ExportFilter : IDisposable [Delphi] type ExportFilter = class abstract (TObject, IDisposable); Remarks ExportFilter is an abstract class used as a base class for all the built-in export filter classes, HtmlFilter, PdfFilter, RtfFilter, XlsFilter, TextFilter, and TiffFilter. You can write your own export filters by deriving from ExportFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also ExportFilter Members | C1.Win.C1Report Namespace ExportFilter Members ExportFilter overview Public Constructors ExportFilter Constructor Initializes a new instance of the ExportFilter class. ExportFilter Constructor · 207 Public Methods AddOutlineEntry Called when the component renders the beginning of a report group. Dispose Releases the resources used by the filter. EndReport Called when the component finishes rendering a report. EndSection Called when the component finishes rendering each Section. IsPaged Determines whether this filter generates single or multipage reports. NewPage Called after each page break on paged reports (see the IsPaged property). RenderField Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Called when the component starts rendering a report. StartSection Called when the component starts rendering a section. UsesImages Returns a value that determines whether the filter requires page images to be generated. See Also ExportFilter Class | C1.Win.C1Report Namespace ExportFilter Constructor Initializes a new instance of the ExportFilter class. [Visual Basic] Public Function New() [C#] public ExportFilter() [Delphi] public constructor Create(); See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter Methods The methods of the ExportFilter class are listed here. For a complete list of ExportFilter class members, see the ExportFilter Members topic. 208 · C1.Win.C1Report Namespace Public Methods AddOutlineEntry Called when the component renders the beginning of a report group. Dispose Releases the resources used by the filter. EndReport Called when the component finishes rendering a report. EndSection Called when the component finishes rendering each Section. IsPaged Determines whether this filter generates single or multipage reports. NewPage Called after each page break on paged reports (see the IsPaged property). RenderField Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Called when the component starts rendering a report. StartSection Called when the component starts rendering a section. UsesImages Returns a value that determines whether the filter requires page images to be generated. See Also ExportFilter Class | C1.Win.C1Report Namespace ExportFilter.AddOutlineEntry Method Called when the component renders the beginning of a report group. [Visual Basic] Overridable Public Sub AddOutlineEntry( _ ByVal heading As String, _ ByVal level As Integer, _ ByVal x As Double, _ ByVal y As Double _ ) [C#] virtual public void AddOutlineEntry( string heading, int level, double x, double y ); ExportFilter.Dispose Method · 209 [Delphi] public procedure AddOutlineEntry( heading: String; level: Int32; x: Double; y: Double ); virtual; Parameters heading Outline header. level Outline level. x Left position of the outline, in twips. y Top position of the outline, in twips. Remarks This method allows the filter to build a report outline. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.Dispose Method Releases the resources used by the filter. [Visual Basic] Overridable Public Sub Dispose() Implements IDisposable.Dispose [C#] virtual public void Dispose() [Delphi] public procedure Dispose(); virtual; Implements IDisposable.Dispose Remarks Override this method in derived classes to free any disposable objects used by the filter. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.EndReport Method Called when the component finishes rendering a report. [Visual Basic] Overridable Public Sub EndReport() 210 · C1.Win.C1Report Namespace [C#] virtual public void EndReport() [Delphi] public procedure EndReport(); virtual; See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.EndSection Method Called when the component finishes rendering each Section. [Visual Basic] Overridable Public Sub EndSection( _ ByVal section As Section _ ) [C#] virtual public void EndSection( Section section ); [Delphi] public procedure EndSection( section: Section ); virtual; Parameters section Section that was rendered. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.IsPaged Method Determines whether this filter generates single or multi-page reports. [Visual Basic] Overridable Public Function IsPaged() As Boolean [C#] virtual public bool IsPaged() [Delphi] public function IsPaged(): Boolean; virtual; Return Value True if report is paged. ExportFilter.NewPage Method · 211 Remarks When generating paged reports, the component calls the filter's NewPage method on page breaks and updates the value of the Page property. When generating non-paged (continuous) reports, only one long page is generated. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.NewPage Method Called after each page break on paged reports (see the IsPaged property). [Visual Basic] Overridable Public Sub NewPage() [C#] virtual public void NewPage() [Delphi] public procedure NewPage(); virtual; See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.RenderField Method Called when the component needs to render a report field with specific content at a specific position on the current page. [Visual Basic] Overridable Public Sub RenderField( _ ByVal field As Field, _ ByVal rc As Rectangle, _ ByVal text As String, _ ByVal img As Image _ ) [C#] virtual public void RenderField( Field field, Rectangle rc, string text, Image img ); [Delphi] public procedure RenderField( field: Field; rc: Rectangle; text: String; img: Image ); virtual; 212 · C1.Win.C1Report Namespace Parameters field Field object to render. rc Rectangle that determines the field position on the page, in twips. text Field text to render. img Field image to render. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.StartOverlays Method Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. [Visual Basic] Overridable Public Sub StartOverlays() [C#] virtual public void StartOverlays() [Delphi] public procedure StartOverlays(); virtual; Remarks Overlay fields are used only in reports that contain calculated fields which use the Pages property. This value is not known until the report has been generated, and is therefore rendered on a second pass. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.StartReport Method Called when the component starts rendering a report. [Visual Basic] Overridable Public Sub StartReport( _ ByVal report As C1Report _ ) [C#] virtual public void StartReport( C1Report report ); ExportFilter.StartSection Method · 213 [Delphi] public procedure StartReport( report: C1Report ); virtual; Parameters report Owner report. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.StartSection Method Called when the component starts rendering a section. [Visual Basic] Overridable Public Sub StartSection( _ ByVal section As Section, _ ByVal x As Double, _ ByVal y As Double _ ) [C#] virtual public void StartSection( Section section, double x, double y ); [Delphi] public procedure StartSection( section: Section; x: Double; y: Double ); virtual; Parameters section The Section to render. x Left position of the section, in twips. y Top position of the section, in twips. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace ExportFilter.UsesImages Method Returns a value that determines whether the filter requires page images to be generated. 214 · C1.Win.C1Report Namespace [Visual Basic] Overridable Public Function UsesImages() As Boolean [C#] virtual public bool UsesImages() [Delphi] public function UsesImages(): Boolean; virtual; Return Value True if the filter requires page images. Remarks By default, C1Report will render the report into the filter and also into its own PageImages collection. Some filters use these images to generate their output (e.g. PDF, TIFF). Other filters don't need the images (e.g. HTML, RTF) and therefore this method returns False, which saves some resources while rendering long reports. See Also ExportFilter Class | ExportFilter Members | C1.Win.C1Report Namespace Field Class Displays individual data items in a report. For a list of all members of this type, see Field Members. System.Object C1.Win.C1Report.Field [Visual Basic] Public Class Field Implements ICloneable, jr [C#] public class Field : ICloneable, jr [Delphi] type Field = class (TObject,(TObject, ICloneable, jr); Remarks Every element visible in a report is represented by a Field object. Fields can display text, images, expressions, lines, rectangles, or subreports. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also Field Members | C1.Win.C1Report Namespace Field Members Field overview Field Members · 215 Public Constructors Field Constructor Initializes a new instance of the Field class. Public Properties Align Gets or sets how text is aligned within the field. Anchor Gets or sets the field's vertical position relative to its containing Section. BackColor Gets or sets the field's background color. BarCode Allows fields to be rendered in barcode format. BorderColor Gets or sets the field's border color. BorderStyle Gets or sets the field's border style. Bounds Gets or sets the field's size and location within the section, in twips. Calculated Gets or sets whether the Text property should be interpreted as a literal value or as a calculated expression. CanGrow Gets or sets whether the field height should be automatically increased to fit the field's contents. CanShrink Gets or sets whether the field height should be automatically reduced to fit the field's contents. CheckBox Gets or sets whether the field should be displayed as a checkbox. Font Gets or sets the field's font. ForcePageBreak Gets or sets whether to insert page breaks before or after the field. ForeColor Gets or sets the field's foreground color. Format Gets or sets a string used to format the field value. Height Gets or sets the height of the field in twips. HideDuplicates Gets or sets whether duplicate values in consecutive records should be suppressed. Index Returns the position of the field in the parent report's Fields collection. KeepTogether Gets or sets whether the field should be kept together on a page. Left Gets or sets the x-coordinate of the field's left edge in twips. LineSlant Gets or sets whether a line should be drawn across the field (as opposed to a box around the field). LineSpacing Gets or sets the line spacing between text lines in the field, in twips. LineWidth Gets or sets the width of the field's border or line. LinkTarget Gets or sets an expression that evaluates to a URL to be visited when the field is clicked. 216 · C1.Win.C1Report Namespace LinkValue Returns the value of the LinkTarget expression. Location Gets or sets the field's location within the section, in twips. MarginBottom Gets or sets the spacing between the bottom edge of the field and its content, in twips. MarginLeft Gets or sets the spacing between the left edge of the field and its content, in twips. MarginRight Gets or sets the spacing between the right edge of the field and its content, in twips. MarginTop Gets or sets the spacing between the top edge of the field and its content, in twips. Name Gets or sets the field name. ParentReport Gets the C1Report that contains this field. ParentSection Gets the Section that contains this field. Picture Gets or sets a picture to display on the field. PictureAlign Gets or sets how field pictures should be the aligned. PictureScale Gets or sets how images should be the scaled to fit within the field area. RenderHeight Gets the height of the field in twips after the CanGrow and CanShrink properties have been applied to the field. RenderTop Gets or sets the y-coordinate of the field's top edge in twips after the CanGrow and CanShrink properties have been applied to the containing Section. RTF Gets or sets whether the field should render string enclosed in curly brackets as RTF. RunningSum Gets or sets whether to show a running sum for the field. Section Gets or sets the section to which the field belongs. Size Gets or sets the field's size, in twips. Subreport Gets or sets a reference to another report to be rendered within the field (a subreport). SubreportHasData Returns whether a subreport has data and suppresses rendering if it doesn't. Tag Gets or sets extra data needed by the calling program. Text Gets or sets the field's text. TextDirection Gets or sets the direction of the text within the field. Top Gets or sets the y-coordinate of the field's top edge in twips. Value Gets or sets the field's calculated value. Visible Gets or sets whether the Field will be rendered in the report. Field Constructor · 217 Width Gets or sets the width of the field in twips. WordWrap Gets or sets whether the field's contents should be allowed to wrap within the field rectangle. ZOrder Gets or sets the ZOrder for the field. Public Methods Clone Creates a new object that is a copy of the current Field object. SetZOrder Brings a field to the front or sends it to the back of the ZOrder. ToString Overriden. Returns a description of the field (name, location, size). Protected Methods GetRenderContent Selects the text or image that will be rendered by the field. See Also Field Class | C1.Win.C1Report Namespace Field Constructor Initializes a new instance of the Field class. [Visual Basic] Public Function New() [C#] public Field() [Delphi] public constructor Create(); overload; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field Properties The properties of the Field class are listed here. For a complete list of Field class members, see the Field Members topic. Public Properties Align Gets or sets how text is aligned within the field. Anchor Gets or sets the field's vertical position relative to its containing Section. BackColor Gets or sets the field's background color. BarCode Allows fields to be rendered in barcode format. BorderColor Gets or sets the field's border color. BorderStyle Gets or sets the field's border style. 218 · C1.Win.C1Report Namespace Bounds Gets or sets the field's size and location within the section, in twips. Calculated Gets or sets whether the Text property should be interpreted as a literal value or as a calculated expression. CanGrow Gets or sets whether the field height should be automatically increased to fit the field's contents. CanShrink Gets or sets whether the field height should be automatically reduced to fit the field's contents. CheckBox Gets or sets whether the field should be displayed as a checkbox. Font Gets or sets the field's font. ForcePageBreak Gets or sets whether to insert page breaks before or after the field. ForeColor Gets or sets the field's foreground color. Format Gets or sets a string used to format the field value. Height Gets or sets the height of the field in twips. HideDuplicates Gets or sets whether duplicate values in consecutive records should be suppressed. Index Returns the position of the field in the parent report's Fields collection. KeepTogether Gets or sets whether the field should be kept together on a page. Left Gets or sets the x-coordinate of the field's left edge in twips. LineSlant Gets or sets whether a line should be drawn across the field (as opposed to a box around the field). LineSpacing Gets or sets the line spacing between text lines in the field, in twips. LineWidth Gets or sets the width of the field's border or line. LinkTarget Gets or sets an expression that evaluates to a URL to be visited when the field is clicked. LinkValue Returns the value of the LinkTarget expression. Location Gets or sets the field's location within the section, in twips. MarginBottom Gets or sets the spacing between the bottom edge of the field and its content, in twips. MarginLeft Gets or sets the spacing between the left edge of the field and its content, in twips. MarginRight Gets or sets the spacing between the right edge of the field and its content, in twips. MarginTop Gets or sets the spacing between the top edge of the field and its content, in twips. Field.Align Property · 219 Name Gets or sets the field name. ParentReport Gets the C1Report that contains this field. ParentSection Gets the Section that contains this field. Picture Gets or sets a picture to display on the field. PictureAlign Gets or sets how field pictures should be the aligned. PictureScale Gets or sets how images should be the scaled to fit within the field area. RenderHeight Gets the height of the field in twips after the CanGrow and CanShrink properties have been applied to the field. RenderTop Gets or sets the y-coordinate of the field's top edge in twips after the CanGrow and CanShrink properties have been applied to the containing Section. RTF Gets or sets whether the field should render string enclosed in curly brackets as RTF. RunningSum Gets or sets whether to show a running sum for the field. Section Gets or sets the section to which the field belongs. Size Gets or sets the field's size, in twips. Subreport Gets or sets a reference to another report to be rendered within the field (a subreport). SubreportHasData Returns whether a subreport has data and suppresses rendering if it doesn't. Tag Gets or sets extra data needed by the calling program. Text Gets or sets the field's text. TextDirection Gets or sets the direction of the text within the field. Top Gets or sets the y-coordinate of the field's top edge in twips. Value Gets or sets the field's calculated value. Visible Gets or sets whether the Field will be rendered in the report. Width Gets or sets the width of the field in twips. WordWrap Gets or sets whether the field's contents should be allowed to wrap within the field rectangle. ZOrder Gets or sets the ZOrder for the field. See Also Field Class | C1.Win.C1Report Namespace Field.Align Property Gets or sets how text is aligned within the field. 220 · C1.Win.C1Report Namespace [Visual Basic] Public Property Align As FieldAlignEnum [C#] public FieldAlignEnum Align {get;set;} [Delphi] public property Align: FieldAlignEnum read get_Align write set_Align; Remarks This property determines how text is aligned within the field. To control picture alignment, use the PictureAlign property. See Also Field Class | Field Members | C1.Win.C1Report Namespace | FieldAlignEnum Enumeration Field.Anchor Property Gets or sets the field's vertical position relative to its containing Section. [Visual Basic] Public Property Anchor As AnchorEnum [C#] public AnchorEnum Anchor {get;set;} [Delphi] public property Anchor: AnchorEnum read get_Anchor write set_Anchor; Remarks Normally, fields do not move when sections grow or shrink. In some cases, however, you may want fields to grow with the section or to stay in the same position relative to the bottom of the section. This is especially common for fields used to create vertical lines that should extend the entire height of the section. Example The following code sets the Anchor property to Top: • Visual Basic Me.C1Report1.Fields(0).Anchor = C1.Win.C1Report.AnchorEnum.Top • C# this.C1Report1.Fields[0].Anchor = C1.Win.C1Report.AnchorEnum.Top; • Delphi Self.C1Report1.Fields[0].Anchor := C1.Win.C1Report.AnchorEnum.Top; See Also Field Class | Field Members | C1.Win.C1Report Namespace | AnchorEnum Enumeration Field.BackColor Property Gets or sets the field's background color. Field.BarCode Property · 221 [Visual Basic] Public Property BackColor As Color [C#] public Color BackColor {get;set;} [Delphi] public property BackColor: Color read get_BackColor write set_BackColor; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.BarCode Property Allows fields to be rendered in barcode format. [Visual Basic] Public Property BarCode As BarCodeEnum [C#] public BarCodeEnum BarCode {get;set;} [Delphi] public property BarCode: BarCodeEnum read get_BarCode write set_BarCode; Example The following code sets the BarCode property to Code93 (alpha-numeric): • Visual Basic Me.C1Report1.Fields(0).BarCode = C1.Win.C1Report.BarCodeEnum.Code93 • C# this.C1Report1.Fields[0].BarCode = C1.Win.C1Report.BarCodeEnum.Code93; • Delphi Self.C1Report1.Fields[0].BarCode := C1.Win.C1Report.BarCodeEnum.Code93; See Also Field Class | Field Members | C1.Win.C1Report Namespace | BarCodeEnum Enumeration Field.BorderColor Property Gets or sets the field's border color. [Visual Basic] Public Property BorderColor As Color [C#] public Color BorderColor {get;set;} [Delphi] public property BorderColor: Color read get_BorderColor write set_BorderColor; Remarks To draw a border around a field, set the following properties: 222 · C1.Win.C1Report Namespace BorderColor to define the border color. BorderStyle to define the border style (e.g., solid, dashed, etc.). LineWidth to define the border width (in twips). See Also Field Class | Field Members | C1.Win.C1Report Namespace | Field.BorderStyle Field.BorderStyle Property Gets or sets the field's border style. [Visual Basic] Public Property BorderStyle As BorderStyleEnum [C#] public BorderStyleEnum BorderStyle {get;set;} [Delphi] public property BorderStyle: BorderStyleEnum read get_BorderStyle write set_BorderStyle; Remarks To draw a border around a field, set the following properties: BorderColor to define the border color. BorderStyle to define the border style (e.g., solid, dashed, etc.). LineWidth to define the border width (in twips). When you create fields with text and a border, text will be positioned very close to the border. You can control the distance between the text and the border using the MarginLeft, MarginRight, MarginTop, and MarginBottom properties. To draw lines, see the LineSlant property. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Bounds Property Gets or sets the field's size and location within the section, in twips. [Visual Basic] Public Property Bounds As RectangleF [C#] public RectangleF Bounds {get;set;} [Delphi] public property Bounds: RectangleF read get_Bounds write set_Bounds; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Calculated Property · 223 Field.Calculated Property Gets or sets whether the Text property should be interpreted as a literal value or as a calculated expression. [Visual Basic] Public Property Calculated As Boolean [C#] public bool Calculated {get;set;} [Delphi] public property Calculated: Boolean read get_Calculated write set_Calculated; Remarks If this property is set to False, the value of the Text property is rendered on the report without any further processing. If it is set to True, the value of the Text property is evaluated as a VBScript expression and the result of the expression is rendered on the report. Example The code below creates two fields. One displays the label "Sales Tax", the other displays the tax value by multiplying a database field ("Sales") by a constant. • Visual Basic ' display literal Text _c1r.Field(0).Text = "Sales Tax" _c1r.Field(0).Calculated = False ' display a calculated value _c1r.Field(1).Text = "Sales * 0.085" _c1r.Field(1).Calculated = True • C# // display literal Text _c1r.Field[0].Text = "Sales Tax"; _c1r.Field[0].Calculated = false; // display a calculated value _c1r.Field[1].Text = "Sales * 0.085"; _c1r.Field[1].Calculated = true; • Delphi // display literal Text _c1r.Field[0].Text := 'Sales Tax'; _c1r.Field[0].Calculated := False; // display a calculated value _c1r.Field[1].Text := 'Sales * 0.085'; _c1r.Field[1].Calculated = True; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.CanGrow Property Gets or sets whether the field height should be automatically increased to fit the field's contents. 224 · C1.Win.C1Report Namespace [Visual Basic] Public Property CanGrow As Boolean [C#] public bool CanGrow {get;set;} [Delphi] public property CanGrow: Boolean read get_CanGrow write set_CanGrow; Remarks You can use the CanGrow and CanShrink properties to control the appearance of report fields and sections. When you set both properties to True, the field or section automatically adjusts so any amount of data can be printed. When a field grows or shrinks, the fields below it move down or up the page. If you set a field's CanGrow property to True, the control automatically sets the CanGrow property of the containing section to True. (However, if you set a control's CanShrink property to True, the control doesn't set the section's CanShrink property to True.) When you use the CanGrow and CanShrink properties, remember that: 1. The property settings don't affect the horizontal spacing between fields; they affect only the vertical space the fields occupy. 2. The height of a large field can prevent fields beside it from shrinking. For example, if several short controls are on the left side of a report's detail section and one tall control, such as an unbound object frame, is on the right side, the controls on the left won't shrink, even if they contain no data. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.CanShrink Property Gets or sets whether the field height should be automatically reduced to fit the field's contents. [Visual Basic] Public Property CanShrink As Boolean [C#] public bool CanShrink {get;set;} [Delphi] public property CanShrink: Boolean read get_CanShrink write set_CanShrink; See Also Field Class | Field Members | C1.Win.C1Report Namespace | Field.CanGrow Field.CheckBox Property Gets or sets whether the field should be displayed as a checkbox. [Visual Basic] Public Property CheckBox As CheckBoxEnum [C#] public CheckBoxEnum CheckBox {get;set;} Field.Font Property · 225 [Delphi] public property CheckBox: CheckBoxEnum read get_CheckBox write set_CheckBox; Remarks This property allows you to display Boolean values graphically, rather than as plain text. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Font Property Gets or sets the field's font. [Visual Basic] Public Property Font As FontHolder [C#] public FontHolder Font {get;set;} [Delphi] public property Font: FontHolder read get_Font write set_Font; Remarks If you set a field's font FontHolder.Size property to a value that is too large to fit the field box (defined by the Height property), no text will appear in the field. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.ForcePageBreak Property Gets or sets whether to insert page breaks before or after the field. [Visual Basic] Public Property ForcePageBreak As ForcePageBreakEnum [C#] public ForcePageBreakEnum ForcePageBreak {get;set;} [Delphi] public property ForcePageBreak: ForcePageBreakEnum read get_ForcePageBreak write set_ForcePageBreak; See Also Field Class | Field Members | C1.Win.C1Report Namespace | ForcePageBreakEnum Enumeration Field.ForeColor Property Gets or sets the field's foreground color. [Visual Basic] Public Property ForeColor As Color 226 · C1.Win.C1Report Namespace [C#] public Color ForeColor {get;set;} [Delphi] public property ForeColor: Color read get_ForeColor write set_ForeColor; Remarks Use the ForeColor property to specify the color for text in a field. You can use this property to make fields easy to read or to convey a special meaning. Example The code below uses script to change the color of the text in the UnitsInStock field when its value falls below the reorder level. • Visual Basic ' build script Dim script As String = "UnitsInStock.ForeColor = " + "IIF(UnitsInStock < ReorderLevel, vbRed, vbBlack)" ' assign script to detail section _c1r.Sections.Detail.OnPrint = script • C# // build script string script = "UnitsInStock.ForeColor = " + "IIF(UnitsInStock < ReorderLevel, vbRed, vbBlack)"; // assign script to detail section _c1r.Sections.Detail.OnPrint = script; • Delphi var script: string begin // build script script := ('UnitsInStock.ForeColor = ' + 'IIF(UnitsInStock < ReorderLevel, vbRed, vbBlack)'); // assign script to detail section _c1r.Sections.Detail.OnPrint := script; end; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Format Property Gets or sets a string used to format the field value. [Visual Basic] Public Property Format As String [C#] public string Format {get;set;} [Delphi] public property Format: String read get_Format write set_Format; Field.Height Property · 227 Remarks You can use the Format property to customize the way numbers, dates, times, and text are displayed and printed. For example, if you've created a Price field, you can set its Format property to "Currency". If the field value is set to "4321.678", it would be rendered as $4,321.68. You can use the Format property to format numbers (including currency and percentage values), dates, Boolean values, and strings. The syntax for the format string is the same used with the .NET System.String.Format(System.String,System.Object) method. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Height Property Gets or sets the height of the field in twips. [Visual Basic] Public Property Height As Double [C#] public double Height {get;set;} [Delphi] public property Height: Double read get_Height write set_Height; Remarks Every Field object has a rectangle, or "field box", where the field contents are rendered. The field box is defined by the Left, Top, Width, and Height properties. These properties are expressed in twips, and the position is relative to the field's containing section. The field's Height property should be set to a value larger than or equal to the height of the field's Font, or no text will appear in the field. If the field's CanGrow or CanShrink properties are set to True, the control will automatically adjust the RenderHeight property to fit the field's contents and the RenderTop property of fields below the current field to preserve the vertical distance between fields. The value of the Top and Height properties is not affected. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.HideDuplicates Property Gets or sets whether duplicate values in consecutive records should be suppressed. [Visual Basic] Public Property HideDuplicates As Boolean [C#] public bool HideDuplicates {get;set;} 228 · C1.Win.C1Report Namespace [Delphi] public property HideDuplicates: Boolean read get_HideDuplicates write set_HideDuplicates; Remarks You can use the HideDuplicates property to hide a field on a report when its value is the same as in the preceding record. For example, on a report listing suppliers and their products, each supplier's name can appear once for each group of products, rather than once for each product. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Index Property Returns the position of the field in the parent report's Fields collection. [Visual Basic] Public ReadOnly Property Index As Integer [C#] public int Index {get;} [Delphi] public property Index: Int32 read get_Index; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.KeepTogether Property Gets or sets whether the field should be kept together on a page. [Visual Basic] Public Property KeepTogether As Boolean [C#] public bool KeepTogether {get;set;} [Delphi] public property KeepTogether: Boolean read get_KeepTogether write set_KeepTogether; Remarks If this property is set to True, the control will insert page breaks in order to keep the field contents toghether on a page. If it is set to False, and the containing Section also has its KeepTogether property set to False, then the field may be rendered across two or more pages. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Left Property · 229 Field.Left Property Gets or sets the x-coordinate of the field's left edge in twips. [Visual Basic] Public Property Left As Double [C#] public double Left {get;set;} [Delphi] public property Left: Double read get_Left write set_Left; Remarks A field's location is the distance from its upper left corner to the upper left corner of its containing Section. Setting the Left or Top property to zero places the field at the very left or top of its containing section. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.LineSlant Property Gets or sets whether a line should be drawn across the field (as opposed to a box around the field). [Visual Basic] Public Property LineSlant As LineSlantEnum [C#] public LineSlantEnum LineSlant {get;set;} [Delphi] public property LineSlant: LineSlantEnum read get_LineSlant write set_LineSlant; Remarks The color, style, and thickness of the line are determined by the BorderColor, BorderStyle, and LineWidth properties. See Also Field Class | Field Members | C1.Win.C1Report Namespace | LineSlantEnum Enumeration Field.LineSpacing Property Gets or sets the line spacing between text lines in the field, in twips. [Visual Basic] Public Property LineSpacing As Double [C#] public double LineSpacing {get;set;} [Delphi] public property LineSpacing: Double read get_LineSpacing write set_LineSpacing; 230 · C1.Win.C1Report Namespace Remarks Setting this property to zero causes the control to use the default line spacing, which corresponds to the height of the field's font. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.LineWidth Property Gets or sets the width of the field's border or line. [Visual Basic] Public Property LineWidth As Double [C#] public double LineWidth {get;set;} [Delphi] public property LineWidth: Double read get_LineWidth write set_LineWidth; Remarks To draw a border around a field, set the following properties: BorderColor to define the border color. BorderStyle to define the border style (e.g., solid, dashed, etc.). LineWidth to define the border width (in twips). To draw lines, see the LineSlant property. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.LinkTarget Property Gets or sets an expression that evaluates to a URL to be visited when the field is clicked. [Visual Basic] Public Property LinkTarget As String [C#] public string LinkTarget {get;set;} [Delphi] public property LinkTarget: String read get_LinkTarget write set_LinkTarget; Remarks If not empty, this should be an expression that evaluates to a URL. After the report is generated, clicking on the field will cause the report viewer to navigate to the URL. The report viewer can be a web browser (for HTML reports), Adobe Acrobat (for PDF reports), or other viewer applications. Not all report viewers support hyperlinks. The PrintPreview control that ships with .NET, for example, does not. The field will be displayed as usual, based on the contents of its Text and Picture properties. Field.LinkValue Property · 231 The LinkTarget expression is always evaluated, regardless of the setting of the Calculated property (which only applies to the display text). This allows you to bind the LinkTarget to a field in the data source, as show in the example below. Example The code below creates two hyperlink fields, one with a static value and one based on a database value. • Visual Basic ' set up a static link Dim f As Field = c1r.Fields("companyInfoLink") f.Calculated = False f.Text = "click here for more info on our company" f.LinkTarget = "http://myrealty.com" ' set up a databound link Dim f As Field = c1r.Fields("propertyInfoLink") f.Calculated = False f.Text = "click here for more info on this property" f.LinkTarget = "\"http://myrealty.com/moreinfo?id=\" & propertyID" • C# // set up a static link Field f = c1r.Fields["companyInfoLink"]; f.Calculated = false; f.Text = "click here for more info on our company"; f.LinkTarget = "http://myrealty.com"; // set up a databound link Field f = c1r.Fields["propertyInfoLink"]; f.Calculated = false; f.Text = "click here for more info on this property"; f.LinkTarget = "\"http://myrealty.com/moreinfo?id=\" & propertyID"; • Delphi // set up a static link f := c1r.Fields['companyInfoLink']; f.Calculated := False; f.Text := 'click here for more info on our company'; f.LinkTarget := 'http://myrealty.com'; // set up a databound link f := c1r.Fields['propertyInfoLink']; f.Calculated := False; f.Text := 'click here for more info on this property'; f.LinkTarget := '"http://myrealty.com/moreinfo?id=" & propertyID'; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.LinkValue Property Returns the value of the LinkTarget expression. [Visual Basic] Public ReadOnly Property LinkValue As String 232 · C1.Win.C1Report Namespace [C#] public string LinkValue {get;} [Delphi] public property LinkValue: String read get_LinkValue; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Location Property Gets or sets the field's location within the section, in twips. [Visual Basic] Public Property Location As PointF [C#] public PointF Location {get;set;} [Delphi] public property Location: PointF read get_Location write set_Location; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.MarginBottom Property Gets or sets the spacing between the bottom edge of the field and its content, in twips. [Visual Basic] Public Property MarginBottom As Double [C#] public double MarginBottom {get;set;} [Delphi] public property MarginBottom: Double read get_MarginBottom write set_MarginBottom; Remarks This property is useful for rendering fields with borders or solid backgrounds, to add some space between the borders and the field content. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.MarginLeft Property Gets or sets the spacing between the left edge of the field and its content, in twips. [Visual Basic] Public Property MarginLeft As Double Field.MarginRight Property · 233 [C#] public double MarginLeft {get;set;} [Delphi] public property MarginLeft: Double read get_MarginLeft write set_MarginLeft; Remarks This property is useful for rendering fields with borders or solid backgrounds, to add some space between the borders and the field content. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.MarginRight Property Gets or sets the spacing between the right edge of the field and its content, in twips. [Visual Basic] Public Property MarginRight As Double [C#] public double MarginRight {get;set;} [Delphi] public property MarginRight: Double read get_MarginRight write set_MarginRight; Remarks This property is useful for rendering fields with borders or solid backgrounds, to add some space between the borders and the field content. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.MarginTop Property Gets or sets the spacing between the top edge of the field and its content, in twips. [Visual Basic] Public Property MarginTop As Double [C#] public double MarginTop {get;set;} [Delphi] public property MarginTop: Double read get_MarginTop write set_MarginTop; Remarks This property is useful for rendering fields with borders or solid backgrounds, to add some space between the borders and the field content. See Also Field Class | Field Members | C1.Win.C1Report Namespace 234 · C1.Win.C1Report Namespace Field.Name Property Gets or sets the field name. [Visual Basic] Public Property Name As String [C#] public string Name {get;set;} [Delphi] public property Name: String read get_Name write set_Name; Remarks The field name can be used as an index into the control's Fields collection. Field names are also used to identify fields in VBScript expressions, as shown in the example below. Duplicate and empty field names are allowed, but should be avoided if you plan to use the field names in scripts or as indexers. Example The code below assigns a script to the report's SectionTypeEnum.Detail section. The script changes a field's ForeColor property depending on a value. • Visual Basic _c1r.Sections.Fields("sampleField").ForeColor = Color.Black _c1r.Sections.Detail.OnFormat = "sampleField.ForeColor = iif(someValue < 5, vbRed, vbBlack)" • C# _c1r.Sections.Fields["sampleField"].ForeColor = Color.Black; _c1r.Sections.Detail.OnFormat = "sampleField.ForeColor = iif(someValue < 5, vbRed, vbBlack)"; • Delphi _c1r.Sections.Fields['sampleField'].ForeColor := Color.Black; _c1r.Sections.Detail.OnFormat := 'sampleField.ForeColor = iif(someValue < 5, vbRed, vbBlack)'; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.ParentReport Property Gets the C1Report that contains this field. [Visual Basic] Public ReadOnly Property ParentReport As C1Report [C#] public C1Report ParentReport {get;} [Delphi] public property ParentReport: C1Report read get_ParentReport; Field.ParentSection Property · 235 See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.ParentSection Property Gets the Section that contains this field. [Visual Basic] Public ReadOnly Property ParentSection As Section [C#] public Section ParentSection {get;} [Delphi] public property ParentSection: Section read get_ParentSection; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Picture Property Gets or sets a picture to display on the field. [Visual Basic] Public Property Picture As Object [C#] public object Picture {get;set;} [Delphi] public property Picture: Object read get_Picture write set_Picture; Remarks You may set this property to three types of object: 1) Regular .NET System.Drawing.Image objects. 2) Strings containing image file names or urls. 3) Strings containing names of image fields in the report data source. Options 1 and 2 are used to create unbound images, such as logos. These images do not depend on the report data. Option 3 is used to create bound images, such as product or employee pictures. These are images stored with the report data. Example The following code creates an unbound image: • Visual Basic theField.Picture = PictureBoxLogo.Image theField.Picture = "c:\mycorp\pictures\logo.gif" • C# theField.Picture = PictureBoxLogo.Image; theField.Picture = "c:\mycorp\pictures\logo.gif"; 236 · C1.Win.C1Report Namespace • Delphi begin theField.Picture := PictureBoxLogo.Image; theField.Picture := 'c:\mycorp\pictures\logo.gif'; end; The following code creates a bound image: • Visual Basic c1r.DataSource.ConnectionString = "dsn=NorthWind" c1r.DataSource.RecordSource = "Employees" theField.Picture = "Photo" • C# c1r.DataSource.ConnectionString = "dsn=NorthWind"; c1r.DataSource.RecordSource = "Employees"; theField.Picture = "Photo"; • Delphi begin c1r.DataSource.ConnectionString := 'dsn=NorthWind'; c1r.DataSource.RecordSource := 'Employees'; theField.Picture := 'Photo'; end; See Also Field Class | Field Members | C1.Win.C1Report Namespace | Field.PictureAlign | Field.PictureScale Field.PictureAlign Property Gets or sets how field pictures should be the aligned. [Visual Basic] Public Property PictureAlign As PictureAlignEnum [C#] public PictureAlignEnum PictureAlign {get;set;} [Delphi] public property PictureAlign: PictureAlignEnum read get_PictureAlign write set_PictureAlign; See Also Field Class | Field Members | C1.Win.C1Report Namespace | Field.Picture | Field.PictureScale | PictureAlignEnum Enumeration Field.PictureScale Property Gets or sets how images should be the scaled to fit within the field area. [Visual Basic] Public Property PictureScale As PictureScaleEnum [C#] public PictureScaleEnum PictureScale {get;set;} Field.RenderHeight Property · 237 [Delphi] public property PictureScale: PictureScaleEnum read get_PictureScale write set_PictureScale; Remarks Depending on the setting of this property, images may be clipped, stretched, scaled (which preserves the image's aspect ratio), tiled, or hidden. PictureScale works with the PictureAlign property so you can control image scaling and alignment independently. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.RenderHeight Property Gets the height of the field in twips after the CanGrow and CanShrink properties have been applied to the field. [Visual Basic] Public ReadOnly Property RenderHeight As Double [C#] public double RenderHeight {get;} [Delphi] public property RenderHeight: Double read get_RenderHeight; Remarks If the field's CanGrow or CanShrink properties are set to True, the control will automatically adjust the RenderHeight property to fit the field's contents and the RenderTop property of fields below the current field to preserve the vertical distance between fields. The value of the Top and Height properties is not affected. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.RenderTop Property Gets or sets the y-coordinate of the field's top edge in twips after the CanGrow and CanShrink properties have been applied to the containing Section. [Visual Basic] Public ReadOnly Property RenderTop As Double [C#] public double RenderTop {get;} [Delphi] public property RenderTop: Double read get_RenderTop; Remarks If the field's CanGrow or CanShrink properties are set to True, the control will automatically adjust the RenderHeight property to fit the field's contents and the RenderTop property of fields below the current field to preserve the vertical distance between fields. The value of the Top and Height properties is not affected. 238 · C1.Win.C1Report Namespace See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.RTF Property Gets or sets whether the field should render string enclosed in curly brackets as RTF. [Visual Basic] Public Property RTF As Boolean [C#] public bool RTF {get;set;} [Delphi] public property RTF: Boolean read get_RTF write set_RTF; Remarks If you set this property to True, any fields containing text enclosed in curly brackets will be rendered as RTF. This allows you to add complex formatting within a field. Example The following code creates a field with bold and italic characters: • Visual Basic myField.RTF = True myField.Text = "{This is \b Really \b0\i Really \i0 important}" • C# myField.RTF = true; myField.Text = "{This is \b Really \b0\i Really \i0 important}"; • Delphi begin myField.RTF := True; myField.Text := '{This is \b Really \b0\i Really \i0 important}'; end; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.RunningSum Property Gets or sets whether to show a running sum for the field. [Visual Basic] Public Property RunningSum As RunningSumEnum [C#] public RunningSumEnum RunningSum {get;set;} [Delphi] public property RunningSum: RunningSumEnum read get_RunningSum write set_RunningSum; Remarks You can use the RunningSum property to calculate record-by-record or group-by-group totals in a report. Field.Section Property · 239 The RunningSum property specifies whether a calculated field on a report displays a running total and lets you set the range over which values are accumulated. See Also Field Class | Field Members | C1.Win.C1Report Namespace | RunningSumEnum Enumeration Field.Section Property Gets or sets the section to which the field belongs. [Visual Basic] Public Property Section As SectionTypeEnum [C#] public SectionTypeEnum Section {get;set;} [Delphi] public property Section: SectionTypeEnum read get_Section write set_Section; Remarks To move a field from one section to another, set its Section property to a new value. Example The following code moves all fields on the page header section to the page footer section: • Visual Basic Dim i As Integer For i = 0 To c1r.Fields.Count – 1 If c1r.Fields(i).Section = SectionTypeEnum.PageHeader Then c1r.Fields(i).Section = SectionTypeEnum.PageFooter End If Next • C# for (int i = 0; i <= c1r.Fields.Count – 1; i++) { if ( c1r.Fields[i].Section = SectionTypeEnum.PageHeader ) { c1r.Fields[i].Section = SectionTypeEnum.PageFooter; } } • Delphi var i: Integer; begin for i := 0 to c1r.Fields.Count – 1 do if c1r.Fields[i].Section = SectionTypeEnum.PageHeader then c1r.Fields[i].Section := SectionTypeEnum.PageFooter; end; See Also Field Class | Field Members | C1.Win.C1Report Namespace 240 · C1.Win.C1Report Namespace Field.Size Property Gets or sets the field's size, in twips. [Visual Basic] Public Property Size As SizeF [C#] public SizeF Size {get;set;} [Delphi] public property Size: SizeF read get_Size write set_Size; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Subreport Property Gets or sets a reference to another report to be rendered within the field (a subreport). [Visual Basic] Public Property Subreport As C1Report [C#] public C1Report Subreport {get;set;} [Delphi] public property Subreport: C1Report read get_Subreport write set_Subreport; Remarks A subreport is a report that is inserted in another report. Subreports are useful when you want to combine several reports into one. For example, you may have a main report that integrates several subreports into a single main report. Or you can use the main report to show detailed information and use subreports to show summary data at the beginning of each group. For some real-world examples, check the "Sales By Category" and "Sales By Year" reports in the NWIND.XML sample that ships with the control. To define a field as a subreport, you should start by loading the subreport, then assign the subreport control to the field's Subreport property. Next, link the subreport to the main report using the subreport field's Text property (this is analogous to setting the LinkChildFields/LinkMasterFields properties in a Microsoft Access subreport). The Text property in a subreport field is used as a filter. It specifies which records in the source recordset should be used to render the subreport based on the current record for the main report. When the main report is being rendered and reaches the subreport field, the Text expression is evaluated and the result is uses as a filter condition for the subreport. Building the link expression is not difficult, but it is a little tricky because it requires you to create a string that contains quotes, and these internal quotes must be doubled (written as ""). If you are creating reports using the Report Designer, you don't have to worry about building the link expressions in code. Instead, right-click the subreport field and select the Link Subreport menu. This will show a dialog where you can select the master and detail fields. When you click OK, the Report Designer will build the link expression and assign it to the Text property of the subreport field automatically. Field.SubreportHasData Property · 241 Subreport fields usually have the CanGrow property set to True, so the subreport field can expand to include all its records. Subreports may contain other subreports. There's no set limit for the depth of report nesting you can have. However, there must be no circular references to reports. In other words, a report cannot contain a reference to itself as a subreport. Example • Visual Basic ' load subreport and assign it to a field in the main report Dim sSub As String = "Sales By Category Subreport" c1Sub.Load("NWIND.XML", sSub) c1rMain.Fields(sSub).Subreport = c1Sub ' set up connection between main report and subreport c1rMain.Fields(sSub).Calculated = True c1rMain.Fields(sSub).Text = "\"CategoryName = "\" & [CategoryName] & \""c\"" • C# // load subreport and assign it to a field in the main report string sSub = "Sales By Category Subreport"; c1Sub.Load("NWIND.XML", sSub); c1rMain.Fields[sSub].Subreport = c1Sub; // set up connection between main report and subreport c1rMain.Fields[sSub].Calculated = true; c1rMain.Fields[sSub].Text = "\"CategoryName = '\" & [CategoryName] & \"'\""; • Delphi N/A See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.SubreportHasData Property Returns whether a subreport has data and suppresses rendering if it doesn't. [Visual Basic] Public ReadOnly Property SubreportHasData As Boolean [C#] public bool SubreportHasData {get;} [Delphi] public property SubreportHasData: Boolean read get_SubreportHasData; Remarks This property allows you to check whether a subreport has data and prevent it from rendering if it doesn't. 242 · C1.Win.C1Report Namespace Example The code below uses script to hide sections with empty subreports: _c1r.Sections.Detail.OnPrint = "Detail.Visible = fSubreport.SubreportHasData" The code below uses script to hide a field containing an empty subreport and show another field instead: _c1r.Sections.Detail.OnPrint = "hasData = fSubreport.SubreportHasData\r\n" + "fSubreport.Visible = hasData" + "fNoData.Visible = Not hasData\r\n" + See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Tag Property Gets or sets extra data needed by the calling program. [Visual Basic] Public Property Tag As Object [C#] public object Tag {get;set;} [Delphi] public property Tag: Object read get_Tag write set_Tag; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Text Property Gets or sets the field's text. [Visual Basic] Public Property Text As String [C#] public string Text {get;set;} [Delphi] public property Text: String read get_Text write set_Text; Remarks The Text property contains the text that will be rendered on the report. This value may be rendered literally (without any translation) or it may be evaluated as a VBScript expression, depending on the setting of the Calculated property. Example The code below creates two fields. One displays the label "Sales Tax", the other displays the tax value by multiplying a database field ("Sales") by a constant. • Visual Basic ' display literal Text _c1r.Field(0).Text = "Sales Tax" Field.TextDirection Property · 243 _c1r.Field(0).Calculated = False ' display a calculated value _c1r.Field(1).Text = "Sales * 0.085" _c1r.Field(1).Calculated = True • C# // display literal Text _c1r.Field[0].Text = "Sales Tax"; _c1r.Field[0].Calculated = false; // display a calculated value _c1r.Field[1].Text = "Sales * 0.085"; _c1r.Field[1].Calculated = true; • Delphi // display literal Text _c1r.Field[0].Text := 'Sales Tax'; _c1r.Field[0].Calculated := False; // display a calculated value _c1r.Field[1].Text := 'Sales * 0.085'; _c1r.Field[1].Calculated := True; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.TextDirection Property Gets or sets the direction of the text within the field. [Visual Basic] Public Property TextDirection As TextDirectionEnum [C#] public TextDirectionEnum TextDirection {get;set;} [Delphi] public property TextDirection: TextDirectionEnum read get_TextDirection write set_TextDirection; Remarks Not all output formats support vertical text. The preview, print, PDF, TIFF, and XLS formats do support vertical text. The HTML, RTF, and plain text formats do not. See Also Field Class | Field Members | C1.Win.C1Report Namespace | TextDirectionEnum Enumeration Field.Top Property Gets or sets the y-coordinate of the field's top edge in twips. [Visual Basic] Public Property Top As Double 244 · C1.Win.C1Report Namespace [C#] public double Top {get;set;} [Delphi] public property Top: Double read get_Top write set_Top; Remarks A field's location is the distance from its upper left corner to the upper left corner of its containing Section. If the field's CanGrow or CanShrink properties are set to True, the control will automatically adjust the RenderHeight property to fit the field's contents and the RenderTop property of fields below the current field to preserve the vertical distance between fields. The value of the Top and Height properties is not affected. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Value Property Gets or sets the field's calculated value. [Visual Basic] Public Property Value As Object [C#] public object Value {get;set;} [Delphi] public property Value: Object read get_Value write set_Value; Remarks When a field's Calculated property is set to True, the control evaluates the expression stored in the Text property and stores the result in the Value property, which gets rendered into the report. This is the field's default property, so when you use a field name in a VBScript expression, you are actually referring to the field's Value property. Example The following code provides an example of the Value property: • Visual Basic Dim sScript As String = _ "If MyField > 100 Then " & _ "MyField.ForeColor = RGB(255,0,0)" • C# string sScript = "If MyField > 100 Then MyField.ForeColor = RGB(255,0,0) "; • Delphi sScript := 'if MyField > 100 then MyField.ForeColor = RGB(255,0,0)'; is equivalent to: • Visual Basic Dim sScript As String = _ "If MyField.Value > 100 Then " & _ "MyField.ForeColor = RGB(255,0,0)" Field.Visible Property · 245 • C# string sScript = "If MyField > 100 Then MyField.ForeColor = RGB(255,0,0) "; • Delphi var sScript: string; begin sScript := 'If MyField.Value > 100 Then MyField.ForeColor = RGB(255,0,0)'; end; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Visible Property Gets or sets whether the Field will be rendered in the report. [Visual Basic] Public Property Visible As Boolean [C#] public bool Visible {get;set;} [Delphi] public property Visible: Boolean read get_Visible write set_Visible; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.Width Property Gets or sets the width of the field in twips. [Visual Basic] Public Property Width As Double [C#] public double Width {get;set;} [Delphi] public property Width: Double read get_Width write set_Width; Remarks Every Field object has a rectangle, or "field box", where the field contents are rendered. The field box is defined by the Left, Top, Width, and Height properties. These properties are expressed in twips, and the position is relative to the field's containing section. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.WordWrap Property Gets or sets whether the field's contents should be allowed to wrap within the field rectangle. 246 · C1.Win.C1Report Namespace [Visual Basic] Public Property WordWrap As Boolean [C#] public bool WordWrap {get;set;} [Delphi] public property WordWrap: Boolean read get_WordWrap write set_WordWrap; See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.ZOrder Property Gets or sets the ZOrder for the field. [Visual Basic] Public Property ZOrder As Integer [C#] public int ZOrder {get;set;} [Delphi] public property ZOrder: Int32 read get_ZOrder write set_ZOrder; Remarks The ZOrder of a field determines whether it is rendered in front of or behind other fields that overlap with it. High ZOrder values bring the field to the front, low values send it to the back. Because ZOrder values are relative, it is usually easier to call the SetZOrder method, which ensures the field is rendered in front of or behind all other overlapping fields. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field Methods The methods of the Field class are listed here. For a complete list of Field class members, see the Field Members topic. Public Methods Clone Creates a new object that is a copy of the current Field object. SetZOrder Brings a field to the front or sends it to the back of the ZOrder. ToString Overriden. Returns a description of the field (name, location, size). Protected Methods GetRenderContent Selects the text or image that will be rendered by the field. Field.Clone Method · 247 See Also Field Class | C1.Win.C1Report Namespace Field.Clone Method Creates a new object that is a copy of the current Field object. [Visual Basic] Overridable Public Function Clone() As Object Implements ICloneable.Clone [C#] virtual public object Clone() [Delphi] public function Clone(): Object; virtual; Implements ICloneable.Clone Return Value Copy of the current Field object. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.GetRenderContent Method Selects the text or image that will be rendered by the field. [Visual Basic] Overridable Protected Sub GetRenderContent( _ ByRef value As String, _ ByRef img As Image, _ ByVal designTime As Boolean _ ) [C#] virtual protected void GetRenderContent( ref string value, ref Image img, bool designTime ); [Delphi] strict protected procedure GetRenderContent( var value: String; var img: Image; designTime: Boolean ); virtual; Parameters value Field text. 248 · C1.Win.C1Report Namespace img Chart image. designTime This parameter allows the field to render differently at design time or run time. This is usually needed for bound controls, since no data is available at design time. Remarks Override this method in derived classes to provide custom text or images to be rendered in the report. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.SetZOrder Method Brings a field to the front or sends it to the back of the ZOrder. [Visual Basic] Public Sub SetZOrder( _ ByVal front As Boolean _ ) [C#] public void SetZOrder( bool front ); [Delphi] public procedure SetZOrder( front: Boolean ); Parameters front Determines whether the field is brought to the front or sent to the back of the ZOrder. See Also Field Class | Field Members | C1.Win.C1Report Namespace Field.ToString Method Returns a description of the field (name, location, size). [Visual Basic] Overrides Public Function ToString() As String [C#] override public string ToString() [Delphi] public function ToString(): String; override; Return Value A description of the field (name, location, size). FieldAlignEnum Enumeration · 249 See Also Field Class | Field Members | C1.Win.C1Report Namespace FieldAlignEnum Enumeration Specifies the alignment of text within the field's rectangle. [Visual Basic] Public Enum FieldAlignEnum [C#] public enum FieldAlignEnum [Delphi] type FieldAlignEnum = (CenterBottom, CenterMiddle, CenterTop, General, JustBottom, JustMiddle, JustTop, LeftBottom, LeftMiddle, LeftTop, RightBottom, RightMiddle, RightTop); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the Align property in the Field class. Members Member name Description CenterBottom Align to the center and to the bottom of the field box. CenterMiddle Align to the center and to the middle of the field box. CenterTop Align to the center and to the top of the field box. General Align numbers to the right, other values to the left. JustBottom Justify and align to the bottom of the field box. JustMiddle Justify and align to the middle of the field box. JustTop Justify and align to the top of the field box. LeftBottom Align to the left and to the bottom of the field box. LeftMiddle Align to the left and to the middle of the field box. LeftTop Align to the left and to the top of the field box. RightBottom Align to the right and to the bottom of the field box. RightMiddle Align to the right and to the middle of the field box. RightTop Align to the right and to the top of the field box. See Also C1.Win.C1Report Namespace 250 · C1.Win.C1Report Namespace FieldCollection Class FieldCollection class represents a collection of the Field objects. For a list of all members of this type, see FieldCollection Members. System.Object C1.Win.C1Report.FieldCollection [Visual Basic] Public Class FieldCollection Implements ICollection, IEnumerable [C#] public class FieldCollection : ICollection, IEnumerable [Delphi] type FieldCollection = class (TObject, ICollection, IEnumerable); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also FieldCollection Members | C1.Win.C1Report Namespace FieldCollection Members FieldCollection overview Public Properties Count Returns the number of fields in a Fields collection. Item Overloaded. Returns a field from a Fields collection. Public Methods Add Overloaded. Adds a field or a clone of a field to a Fields collection. Contains Overloaded. Determines whether the collection contains a specific field. CopyTo Copies the elements of the collection to an System.Array, starting at a particular array index. Remove Overloaded. Removes a field from a Fields collection. RemoveAt Removes a field from a Fields collection. See Also FieldCollection Class | C1.Win.C1Report Namespace FieldCollection Properties The properties of the FieldCollection class are listed here. For a complete list of FieldCollection class members, see the FieldCollection Members topic. FieldCollection.Count Property · 251 Public Properties Count Returns the number of fields in a Fields collection. Item Overloaded. Returns a field from a Fields collection. See Also FieldCollection Class | C1.Win.C1Report Namespace FieldCollection.Count Property Returns the number of fields in a Fields collection. [Visual Basic] Overridable Public ReadOnly Property Count As Integer Implements ICollection.Count [C#] virtual public int Count {get;} [Delphi] public property Count: Int32 read get_Count; Implements ICollection.Count See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace FieldCollection.Item Property Overload List Returns a field from a Fields collection. [Visual Basic] Overloads Public Default ReadOnly Property Item(Integer) As Field [C#] public Field this[int]{get;} [Delphi] public property Item[index: Int32]: Field read get_Item; Returns a field from a Fields collection. [Visual Basic] Overloads Public Default ReadOnly Property Item(String) As Field [C#] public Field this[string]{get;} [Delphi] public property Item[name: String]: Field read get_Item; See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace FieldCollection.Item Property (Int32) Returns a field from a Fields collection. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As Field 252 · C1.Win.C1Report Namespace [C#] public Field this[ int index ] {get;} [Delphi] public property Item[ index: Int32 ]: Field read get_Item; Remarks The index parameter may be an integer between zero and Count-1. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Item Overload List FieldCollection.Item Property (String) Returns a field from a Fields collection. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal name As String _ ) As Field [C#] public Field this[ string name ] {get;} [Delphi] public property Item[ name: String ]: Field read get_Item; Remarks The name parameter may be a string containing a field name. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Item Overload List FieldCollection Methods The methods of the FieldCollection class are listed here. For a complete list of FieldCollection class members, see the FieldCollection Members topic. Public Methods Add Overloaded. Adds a field or a clone of a field to a Fields collection. Contains Overloaded. Determines whether the collection contains a specific field. FieldCollection.Add Method · 253 CopyTo Copies the elements of the collection to an System.Array, starting at a particular array index. Remove Overloaded. Removes a field from a Fields collection. RemoveAt Removes a field from a Fields collection. See Also FieldCollection Class | C1.Win.C1Report Namespace FieldCollection.Add Method Overload List Adds a field or a clone of a field to a Fields collection. [Visual Basic] Overloads Public Function Add(Field) As Field [C#] public Field Add(Field); [Delphi] public function Add(Field) : Field; overload; Adds a field to a Fields collection. [Visual Basic] Overloads Public Function Add(String, String, Rectangle) As Field [C#] public Field Add(string, string, Rectangle); [Delphi] public function Add(String; String; Rectangle) : Field; overload; Adds a field to a Fields collection. [Visual Basic] Overloads Public Function Add(String, String, Double, Double, Double, Double) As Field [C#] public Field Add(string, string, double, double, double, double); [Delphi] public function Add(String; String; Double; Double; Double; Double) : Field; overload; See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace FieldCollection.Add Method (Field) Adds a field or a clone of a field to a Fields collection. [Visual Basic] Overloads Public Function Add( _ ByVal field As Field _ ) As Field [C#] public Field Add( Field field ); [Delphi] public function Add( field: Field ): Field; overload; 254 · C1.Win.C1Report Namespace Parameters field A Field object to add to the collection. Return Value A reference to the newly added field. Remarks In the field does not belong to any reports, it is added to the collection. If the field already belongs to a report, a clone is created and added to the collection. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Add Overload List FieldCollection.Add Method (String, String, Rectangle) Adds a field to a Fields collection. [Visual Basic] Overloads Public Function Add( _ ByVal name As String, _ ByVal text As String, _ ByVal rc As Rectangle _ ) As Field [C#] public Field Add( string name, string text, Rectangle rc ); [Delphi] public function Add( name: String; text: String; rc: Rectangle ): Field; overload; Parameters name Contains the name of the new field. You should use a consistent naming scheme for the fields and avoid using duplicate names for report fields and database fields. Using repeated names is legal but will cause VBScript expressions that use repeated field names to yield unexpected results. text Contains the value for the new field's Text property. This value may be treated as a literal or as a VBScript expression, depending on the setting of the field's Calculated property. By default, Calculated is set to False and the text is rendered as-is. rc Defines the position of the field, in twips, with respect to its containing section. FieldCollection.Add Method · 255 Return Value A reference to the newly added field. Remarks If you add a field to a section's Fields collection, the new field is automatically assigned to that section. If you add a field to the control's Fields collection, the new field is not assigned to any sections. In this case, you must set the field's Section property or it will not be rendered in the report. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Add Overload List FieldCollection.Add Method (String, String, Double, Double, Double, Double) Adds a field to a Fields collection. [Visual Basic] Overloads Public Function Add( _ ByVal name As String, _ ByVal text As String, _ ByVal left As Double, _ ByVal top As Double, _ ByVal width As Double, _ ByVal height As Double _ ) As Field [C#] public Field Add( string name, string text, double left, double top, double width, double height ); [Delphi] public function Add( name: String; text: String; left: Double; top: Double; width: Double; height: Double ): Field; overload; Parameters name Contains the name of the new field. You should use a consistent naming scheme for the fields and avoid using duplicate names for report fields and database fields. Using repeated names is legal but will cause VBScript expressions that use repeated field names to yield unexpected results. 256 · C1.Win.C1Report Namespace text Contains the value for the new field's Text property. This value may be treated as a literal or as a VBScript expression, depending on the setting of the field's Calculated property. By default, Calculated is set to False and the text is rendered as-is. left Left coordinate of the new field, in twips, with respect to its containing section. top Top coordinate of the new field, in twips, with respect to its containing section. width Width of the new field, in twips. height Height of the new field, in twips. Return Value A reference to the newly added field. Remarks If you add a field to a section's Fields collection, the new field is automatically assigned to that section. If you add a field to the control's Fields collection, the new field is not assigned to any sections. In this case, you must set the field's Section property or it will not be rendered in the report. Example The following code adds a new field to the report: • Visual Basic C1Report1.Fields.Add("NewField", "Hello World", _ 100, 100, 2000, 300) C1Report1.Fields("NewField").Section = SectionTypeEnum.Detail • C# C1Report1.Fields.Add("NewField", "Hello World", 100, 100, 2000, 300); C1Report1.Fields["NewField"].Section = SectionTypeEnum.Detail; • Delphi begin C1Report1.Fields.Add('NewField', 'Hello World', 100, 100, 2000, 300); C1Report1.Fields['NewField'].Section := SectionTypeEnum.Detail; end; Alternatively, the above code could also be written as: • Visual Basic Dim theField As Field theField = C1Report1.Fields.Add("NewField", "Hello World", _ 100, 100, 2000, 300) theField.Section = SectionTypeEnum.Detail • C# Field theField; theField = C1Report1.Fields.Add("NewField", "Hello World", 100, 100, 2000, 300); theField.Section = SectionTypeEnum.Detail; FieldCollection.Contains Method · 257 • Delphi var theField: Field; begin theField := C1Report1.Fields.Add('NewField','Hello World', 100, 100, 2000, 300); theField.Section := SectionTypeEnum.Detail; end; See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Add Overload List FieldCollection.Contains Method Overload List Determines whether the collection contains a specific field. [Visual Basic] Overloads Public Function Contains(Field) As Boolean [C#] public bool Contains(Field); [Delphi] public function Contains(Field) : Boolean; overload; Determines whether the collection contains a specific field. [Visual Basic] Overloads Public Function Contains(String) As Boolean [C#] public bool Contains(string); [Delphi] public function Contains(String) : Boolean; overload; See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace FieldCollection.Contains Method (Field) Determines whether the collection contains a specific field. [Visual Basic] Overloads Public Function Contains( _ ByVal f As Field _ ) As Boolean [C#] public bool Contains( Field f ); [Delphi] public function Contains( f: Field ): Boolean; overload; Parameters f Reference to the Field object. 258 · C1.Win.C1Report Namespace Return Value True if the collection contains specified field; otherwise, False. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Contains Overload List FieldCollection.Contains Method (String) Determines whether the collection contains a specific field. [Visual Basic] Overloads Public Function Contains( _ ByVal name As String _ ) As Boolean [C#] public bool Contains( string name ); [Delphi] public function Contains( name: String ): Boolean; overload; Parameters name The name of the field. Return Value True if the collection contains a field with the specified name; otherwise, False. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Contains Overload List FieldCollection.CopyTo Method Copies the elements of the collection to an System.Array, starting at a particular array index. [Visual Basic] Public Sub CopyTo( _ ByVal array As Field(), _ ByVal index As Integer _ ) [C#] public void CopyTo( Field[] array, int index ); FieldCollection.Remove Method · 259 [Delphi] public procedure CopyTo( array: Field(); index: Int32 ); Parameters array The one-dimensional System.Array that is the destination of the elements copied from collection. The array must have zero-based indexing. index The zero-based index in array at which copying begins. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace FieldCollection.Remove Method Overload List Removes a field from a Fields collection. [Visual Basic] Overloads Public Sub Remove(Field) [C#] public void Remove(Field); [Delphi] public procedure Remove(Field); overload; Removes a field from a Fields collection. [Visual Basic] Overloads Public Sub Remove(Integer) [C#] public void Remove(int); [Delphi] public procedure Remove(Int32); overload; Removes a field from a Fields collection. [Visual Basic] Overloads Public Sub Remove(String) [C#] public void Remove(string); [Delphi] public procedure Remove(String); overload; See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace FieldCollection.Remove Method (Field) Removes a field from a Fields collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal f As Field _ ) [C#] public void Remove( Field f ); 260 · C1.Win.C1Report Namespace [Delphi] public procedure Remove( f: Field ); overload; Parameters f The field to be removed. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Remove Overload List FieldCollection.Remove Method (Int32) Removes a field from a Fields collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal index As Integer _ ) [C#] public void Remove( int index ); [Delphi] public procedure Remove( index: Int32 ); overload; Parameters index Specifies the field to be removed. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Remove Overload List FieldCollection.Remove Method (String) Removes a field from a Fields collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal name As String _ ) [C#] public void Remove( string name ); FieldCollection.RemoveAt Method · 261 [Delphi] public procedure Remove( name: String ); overload; Parameters name The name of the field to be removed. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace | FieldCollection.Remove Overload List FieldCollection.RemoveAt Method Removes a field from a Fields collection. [Visual Basic] Public Sub RemoveAt( _ ByVal index As Integer _ ) [C#] public void RemoveAt( int index ); [Delphi] public procedure RemoveAt( index: Int32 ); Parameters index Specifies the field to be removed. See Also FieldCollection Class | FieldCollection Members | C1.Win.C1Report Namespace FileFormatEnum Enumeration Specifies the format of the export file. [Visual Basic] Public Enum FileFormatEnum [C#] public enum FileFormatEnum 262 · C1.Win.C1Report Namespace [Delphi] type FileFormatEnum = (Excel, HTML, HTMLDrillDown, HTMLPaged, PDF, PDFEmbedFonts, PDFPrintUtil, PDFProtected, RTF, RTFLabels, Text, TextSinglePage, TIFF); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set parameter of the RenderToFile method in the C1Report class. Members Member name Description Excel Microsoft Excel files. This setting creates a BIFF-8 Excel file that can be opened with Microsoft Excel 97 or later. HTML Plain HTML format. This setting creates a single HTML file that can be viewed in any web browser. HTMLDrillDown Drill-down HTML format. This setting creates a single HTML file with collapsible headings. When viewed in a DHTML-capable browser, clicking group headers causes them to collapse and expand to show the detail. HTMLPaged Paged HTML format. This setting creates one HTML file for each page in the report, with links to navigate between pages. PDF Adobe PDF format. This setting creates a PDF file that can be viewed using Adobe Acrobat software. PDFEmbedFonts Adobe PDF format with embedded fonts. This setting creates a PDF file that can be viewed using Adobe Acrobat software. PDFPrintUtil Deprecated. Use PDF, PDFEmbedFonts, or PDFProcted instead. PDFProtected Protected PDF format. This setting creates a PDF file with a random password. The file can be opened and printed by anyone, but cannot be modified. RTF RTF format. This setting creates an RTF file that can be opened in Microsoft Word, WordPad, or any other RTF-capable text editor. RTFLabels RTF field-based format. This setting creates RTF files with absolutely-positioned fields. This format renders reports more accurately than the plain RTF format, and is recommended for creating label-style reports. However, the files created with this setting are harder to edit than the plan RTF format, and can only be previewed or printed correctly using Microsoft Word (this format doesn't work with WordPad). Text Plain text. This setting creates a plain ASCII file. TextSinglePage Plain text. This setting creates a plain ASCII file as a single page. ForcePageBreakEnum Enumeration · 263 Member name Description TIFF TIFF format. This setting creates multi-page TIFF files. See Also C1.Win.C1Report Namespace ForcePageBreakEnum Enumeration Determines whether page breaks should be inserted before or after a field or section. [Visual Basic] Public Enum ForcePageBreakEnum [C#] public enum ForcePageBreakEnum [Delphi] type ForcePageBreakEnum = (After, Before, BeforeAndAfter, None, PageAfter, PageBefore); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the ForcePageBreak and ForcePageBreak properties in the Field and Section classes. Members Member name Description After A page break is inserted after the field or section. Before A page break is inserted before the field or section. BeforeAndAfter Page breaks are inserted before and after the field or section. None No page breaks. PageAfter In multi-column reports, a page break is inserted after the field or section instead of column break. PageBefore In multi-column reports, a page break is inserted before the field or section instead of column break. See Also C1.Win.C1Report Namespace Group Class Object used to sort and group report data. For a list of all members of this type, see Group Members. 264 · C1.Win.C1Report Namespace System.Object C1.Win.C1Report.Group [Visual Basic] Public Class Group [C#] public class Group [Delphi] type Group = class; Remarks Each Group has a Header section and a Footer section that can be used to display aggregate information for the group. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also Group Members | C1.Win.C1Report Namespace Group Members Group overview Public Properties GroupBy Gets or sets the expression used to break records into groups. KeepTogether Gets or sets whether the group should be kept together on a page. Name Gets or sets the group name. ParentReport Gets the C1Report object that contains this Group. SectionFooter Returns the Section used as this group's footer. SectionHeader Returns the Section used as this group's header. Sort Gets or sets how the group is sorted. Tag Gets or sets extra data needed by the calling program. Public Methods Move Moves a group to a new position in the Groups collection, optionally adjusting its Sections and Fields. See Also Group Class | C1.Win.C1Report Namespace Group Properties The properties of the Group class are listed here. For a complete list of Group class members, see the Group Members topic. Group.GroupBy Property · 265 Public Properties GroupBy Gets or sets the expression used to break records into groups. KeepTogether Gets or sets whether the group should be kept together on a page. Name Gets or sets the group name. ParentReport Gets the C1Report object that contains this Group. SectionFooter Returns the Section used as this group's footer. SectionHeader Returns the Section used as this group's header. Sort Gets or sets how the group is sorted. Tag Gets or sets extra data needed by the calling program. See Also Group Class | C1.Win.C1Report Namespace Group.GroupBy Property Gets or sets the expression used to break records into groups. [Visual Basic] Public Property GroupBy As String [C#] public string GroupBy {get;set;} [Delphi] public property GroupBy: String read get_GroupBy write set_GroupBy; Remarks This property contains a VBScript expression that is evaluated for every record in the source recordset. A new group is started whenever the value of this expression changes. Example The following code groups records by category name, then by product name: • Visual Basic c1r.Groups(0).GroupBy = "CategoryName" c1r.Groups(0).Sort = SortEnum.Ascending c1r.Groups(1).GroupBy = "ProductName" c1r.Groups(1).Sort = SortEnum.Ascending • C# c1r.Groups[0].GroupBy = "CategoryName"; c1r.Groups[0].Sort = SortEnum.Ascending; c1r.Groups[1].GroupBy = "ProductName"; c1r.Groups[1].Sort = SortEnum.Ascending; • Delphi begin c1r.Groups[0].GroupBy := 'CategoryName'; c1r.Groups[0].Sort := SortEnum.Ascending; c1r.Groups[1].GroupBy := 'ProductName'; 266 · C1.Win.C1Report Namespace c1r.Groups[1].Sort := SortEnum.Ascending; end; See Also Group Class | Group Members | C1.Win.C1Report Namespace Group.KeepTogether Property Gets or sets whether the group should be kept together on a page. [Visual Basic] Public Property KeepTogether As KeepTogetherEnum [C#] public KeepTogetherEnum KeepTogether {get;set;} [Delphi] public property KeepTogether: KeepTogetherEnum read get_KeepTogether write set_KeepTogether; See Also Group Class | Group Members | C1.Win.C1Report Namespace | KeepTogetherEnum Enumeration Group.Name Property Gets or sets the group name. [Visual Basic] Public Property Name As String [C#] public string Name {get;set;} [Delphi] public property Name: String read get_Name write set_Name; Remarks The group name can be used as an index into the control's Groups collection. Example The following code provides an example of the Name property: • Visual Basic c1r.Groups("Initial").GroupBy = "Left([ProductName],1)" • C# c1r.Groups["Initial"].GroupBy = "Left([ProductName],1)"; • Delphi begin c1r.Groups['Initial'].GroupBy := 'Left([ProductName],1)'; end; See Also Group Class | Group Members | C1.Win.C1Report Namespace Group.ParentReport Property · 267 Group.ParentReport Property Gets the C1Report object that contains this Group. [Visual Basic] Public ReadOnly Property ParentReport As C1Report [C#] public C1Report ParentReport {get;} [Delphi] public property ParentReport: C1Report read get_ParentReport; See Also Group Class | Group Members | C1.Win.C1Report Namespace Group.SectionFooter Property Returns the Section used as this group's footer. [Visual Basic] Public ReadOnly Property SectionFooter As Section [C#] public Section SectionFooter {get;} [Delphi] public property SectionFooter: Section read get_SectionFooter; See Also Group Class | Group Members | C1.Win.C1Report Namespace Group.SectionHeader Property Returns the Section used as this group's header. [Visual Basic] Public ReadOnly Property SectionHeader As Section [C#] public Section SectionHeader {get;} [Delphi] public property SectionHeader: Section read get_SectionHeader; See Also Group Class | Group Members | C1.Win.C1Report Namespace Group.Sort Property Gets or sets how the group is sorted. [Visual Basic] Public Property Sort As SortEnum 268 · C1.Win.C1Report Namespace [C#] public SortEnum Sort {get;set;} [Delphi] public property Sort: SortEnum read get_Sort write set_Sort; Remarks The specified sorting is applied to the content of the GroupBy property. For example, if GroupBy contains the expression "FirstName" and Sort is set to "Ascending", then the group will be sorted in ascending order based on the content of the "FirstName" column in the data source. Note that the sorting is performed by the data source itself, not by C1Report. Because of this, sorting is always based on column names rather than calculated expressions. If the GroupBy property contains a calculated expression, the component will extract the first column name from the expression and will sort based on that value. For example, if GroupBy is set to "Left(FirstName, 3)", the sorting will be based on the "FirstName" column, not on the first three characters of the first names. This can present problems in a few cases, especially if you want ot sort based on date parts (year, month, quarter). In these cases, the recommended procedure is to add a calculated column to the data source (by changing the SQL statement used to retrieve the data), then set the GroupBy property to the name of the calculated column. Example The code below uses a SQL statement to add a "HireQuarter" column to the data source, then sorts a group based on this new column. The report will show employees sorted by the quarter when they were hired. • Visual Basic string sql = "SELECT *, DATEPART('q', HireDate) AS HireQuarter " + "FROM Employees" c1r.DataSource.RecordSource = sql c1r.Groups(0).GroupBy = "HireQuarter" c1r.Groups(0).Sort = SortEnum.Ascending • C# string sql = "SELECT *, DATEPART('q', HireDate) AS HireQuarter " + "FROM Employees"; c1r.DataSource.RecordSource = sql; c1r.Groups[0].GroupBy = "HireQuarter"; c1r.Groups[0].Sort = SortEnum.Ascending; • Delphi var s: String begin sql := ('SELECT *, DATEPART(''q'', HireDate) AS HireQuarter ' + 'FROM Employees'); c1r.DataSource.RecordSource := sql; c1r.Groups[0].GroupBy := 'HireQuarter'; c1r.Groups[0].Sort := SortEnum.Ascending; end; See Also Group Class | Group Members | C1.Win.C1Report Namespace Group.Tag Property · 269 Group.Tag Property Gets or sets extra data needed by the calling program. [Visual Basic] Public Property Tag As Object [C#] public object Tag {get;set;} [Delphi] public property Tag: Object read get_Tag write set_Tag; See Also Group Class | Group Members | C1.Win.C1Report Namespace Group Methods The methods of the Group class are listed here. For a complete list of Group class members, see the Group Members topic. Public Methods Move Moves a group to a new position in the Groups collection, optionally adjusting its Sections and Fields. See Also Group Class | C1.Win.C1Report Namespace Group.Move Method Moves a group to a new position in the Groups collection, optionally adjusting its Sections and Fields. [Visual Basic] Public Sub Move( _ ByVal newIndex As Integer, _ ByVal adjustSections As Boolean _ ) [C#] public void Move( int newIndex, bool adjustSections ); [Delphi] public procedure Move( newIndex: Int32; adjustSections: Boolean ); Parameters newIndex Contains the new position for the group (index into the Groups collection). 270 · C1.Win.C1Report Namespace adjustSections Determines whether only the group should be moved or whether its header and footer sections, along with all the fields in those sections, should also be moved. Remarks This method is useful in designer applications, when you want to allow users to change the grouping order. See Also Group Class | Group Members | C1.Win.C1Report Namespace GroupCollection Class GroupCollection class represents a collection of the Group objects. For a list of all members of this type, see GroupCollection Members. System.Object C1.Win.C1Report.GroupCollection [Visual Basic] Public Class GroupCollection Implements ICollection, IEnumerable [C#] public class GroupCollection : ICollection, IEnumerable [Delphi] type GroupCollection = class (TObject, ICollection, IEnumerable); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also GroupCollection Members | C1.Win.C1Report Namespace GroupCollection Members GroupCollection overview Public Properties Count Returns the number of groups in a Groups collection. Item Overloaded. Returns a group from a Groups collection. Public Methods Add Adds a new Group to the collection, along with header and footer sections for the new group. Contains Overloaded. Determines whether the collection contains a specific group. CopyTo Copies the elements of the collection to an System.Array, starting at a particular array index. GroupCollection Properties · 271 Remove Overloaded. Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. See Also GroupCollection Class | C1.Win.C1Report Namespace GroupCollection Properties The properties of the GroupCollection class are listed here. For a complete list of GroupCollection class members, see the GroupCollection Members topic. Public Properties Count Returns the number of groups in a Groups collection. Item Overloaded. Returns a group from a Groups collection. See Also GroupCollection Class | C1.Win.C1Report Namespace GroupCollection.Count Property Returns the number of groups in a Groups collection. [Visual Basic] Overridable Public ReadOnly Property Count As Integer Implements ICollection.Count [C#] virtual public int Count {get;} [Delphi] public property Count: Int32 read get_Count; Implements ICollection.Count See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace GroupCollection.Item Property Overload List Returns a group from a Groups collection. [Visual Basic] Overloads Public Default ReadOnly Property Item(Integer) As Group [C#] public Group this[int]{get;} [Delphi] public property Item[index: Int32]: Group read get_Item; Returns a group from a Groups collection. [Visual Basic] Overloads Public Default ReadOnly Property Item(String) As Group [C#] public Group this[string]{get;} [Delphi] public property Item[name: String]: Group read get_Item; 272 · C1.Win.C1Report Namespace See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace GroupCollection.Item Property (Int32) Returns a group from a Groups collection. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As Group [C#] public Group this[ int index ] {get;} [Delphi] public property Item[ index: Int32 ]: Group read get_Item; Remarks The index parameter may be an integer between zero and Count-1. See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace | GroupCollection.Item Overload List GroupCollection.Item Property (String) Returns a group from a Groups collection. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal name As String _ ) As Group [C#] public Group this[ string name ] {get;} [Delphi] public property Item[ name: String ]: Group read get_Item; Remarks The name parameter may be a string containing a group name. See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace | GroupCollection.Item Overload List GroupCollection Methods · 273 GroupCollection Methods The methods of the GroupCollection class are listed here. For a complete list of GroupCollection class members, see the GroupCollection Members topic. Public Methods Add Adds a new Group to the collection, along with header and footer sections for the new group. Contains Overloaded. Determines whether the collection contains a specific group. CopyTo Copies the elements of the collection to an System.Array, starting at a particular array index. Remove Overloaded. Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. See Also GroupCollection Class | C1.Win.C1Report Namespace GroupCollection.Add Method Adds a new Group to the collection, along with header and footer sections for the new group. [Visual Basic] Public Function Add( _ ByVal name As String, _ ByVal groupBy As String, _ ByVal sort As SortEnum _ ) As Group [C#] public Group Add( string name, string groupBy, SortEnum sort ); [Delphi] public function Add( name: String; groupBy: String; sort: SortEnum ): Group; Parameters name Contains the name of the new group. groupBy Contains the value of the GroupBy property for the new group. 274 · C1.Win.C1Report Namespace sort Contains the value of the Sort property for the new group. Return Value A reference to the newly added group. Remarks When a group is added to a report, the control automatically adds two new sections, the group header and group footer sections for the new group. These new sections are invisible by default. Example The following code adds a new group: • Visual Basic C1Report1.Groups.Add("NewGroup", "Left ([ProductName],1)", vsrAscending) • C# C1Report1.Groups.Add("NewGroup", "Left ([ProductName],1)", vsrAscending); • Delphi C1Report1.Groups.Add('NewGroup','Left ([ProductName],1)', vsrAscending); See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace GroupCollection.Contains Method Overload List Determines whether the collection contains a specific group. [Visual Basic] Overloads Public Function Contains(Group) As Boolean [C#] public bool Contains(Group); [Delphi] public function Contains(Group) : Boolean; overload; Determines whether the collection contains a specific group. [Visual Basic] Overloads Public Function Contains(String) As Boolean [C#] public bool Contains(string); [Delphi] public function Contains(String) : Boolean; overload; See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace GroupCollection.Contains Method (Group) Determines whether the collection contains a specific group. [Visual Basic] Overloads Public Function Contains( _ ByVal g As Group _ ) As Boolean GroupCollection.Contains Method · 275 [C#] public bool Contains( Group g ); [Delphi] public function Contains( g: Group ): Boolean; overload; Parameters g Reference to the Group object. Return Value True if the collection contains specified field; otherwise, False. See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace | GroupCollection.Contains Overload List GroupCollection.Contains Method (String) Determines whether the collection contains a specific group. [Visual Basic] Overloads Public Function Contains( _ ByVal name As String _ ) As Boolean [C#] public bool Contains( string name ); [Delphi] public function Contains( name: String ): Boolean; overload; Parameters name The name of the group. Return Value True if the collection contains a group with the specified name; otherwise, False. See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace | GroupCollection.Contains Overload List 276 · C1.Win.C1Report Namespace GroupCollection.CopyTo Method Copies the elements of the collection to an System.Array, starting at a particular array index. [Visual Basic] Public Sub CopyTo( _ ByVal array As Group(), _ ByVal index As Integer _ ) [C#] public void CopyTo( Group[] array, int index ); [Delphi] public procedure CopyTo( array: Group(); index: Int32 ); Parameters array The one-dimensional System.Array that is the destination of the elements copied from the collection. The array must have zero-based indexing. index The zero-based index in array at which copying begins. See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace GroupCollection.Remove Method Overload List Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. [Visual Basic] Overloads Public Sub Remove(Group) [C#] public void Remove(Group); [Delphi] public procedure Remove(Group); overload; Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. [Visual Basic] Overloads Public Sub Remove(Integer) [C#] public void Remove(int); [Delphi] public procedure Remove(Int32); overload; Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. [Visual Basic] Overloads Public Sub Remove(String) [C#] public void Remove(string); [Delphi] public procedure Remove(String); overload; GroupCollection.Remove Method · 277 See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace GroupCollection.Remove Method (Group) Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal group As Group _ ) [C#] public void Remove( Group group ); [Delphi] public procedure Remove( group: Group ); overload; Parameters group The group to be removed. See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace | GroupCollection.Remove Overload List GroupCollection.Remove Method (Int32) Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal index As Integer _ ) [C#] public void Remove( int index ); [Delphi] public procedure Remove( index: Int32 ); overload; Parameters index Specifies the group to be removed. 278 · C1.Win.C1Report Namespace See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace | GroupCollection.Remove Overload List GroupCollection.Remove Method (String) Removes a Group from the Groups collection, and its header/footer sections from the Sections collection. [Visual Basic] Overloads Public Sub Remove( _ ByVal name As String _ ) [C#] public void Remove( string name ); [Delphi] public procedure Remove( name: String ); overload; Parameters name The name of the group to be removed. See Also GroupCollection Class | GroupCollection Members | C1.Win.C1Report Namespace | GroupCollection.Remove Overload List GrowShrinkModeEnum Enumeration Specifies the logic for handling CanGrow/CanShrink fields. [Visual Basic] Public Enum GrowShrinkModeEnum [C#] public enum GrowShrinkModeEnum [Delphi] type GrowShrinkModeEnum = (Access, C1Report); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the GrowShrinkMode property in the GrowShrinkModeEnum.C1Report class. HdrFtrEnum Enumeration · 279 Members Member name Description Access Uses a mode that is similar to MS Access, where fields that grow or shrink affect all fields below, even if they are off to the side of the field that grew or shrank. C1Report Uses the standard C1Report mode, where fields that grow or shrink affect only fields directly below. See Also C1.Win.C1Report Namespace HdrFtrEnum Enumeration Specifies where the Page Footer and Page Header sections are displayed. [Visual Basic] Public Enum HdrFtrEnum [C#] public enum HdrFtrEnum [Delphi] type HdrFtrEnum = (AllPages, NotWithReportFtr, NotWithReportHdr, NotWithReportHdrFtr); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the PageFooter and PageHeader properties in the Layout class. Members Member name Description AllPages The page footer and header are printed on all pages of a report. NotWithReportFtr The page footer isn't printed on the same page as the report footer. NotWithReportHdr The page header isn't printed on the same page as the report header. NotWithReportHdrFtr The page footer and header are not printed on a page that has either a report header or a report footer. See Also C1.Win.C1Report Namespace HtmlFilter Class Used with the RenderToFilter method to render reports into HTML streams or files. 280 · C1.Win.C1Report Namespace For a list of all members of this type, see HtmlFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.HtmlFilter [Visual Basic] Public Class HtmlFilter Inherits ExportFilter Implements IDisposable [C#] public class HtmlFilter : ExportFilter , IDisposable [Delphi] type HtmlFilter = class (ExportFilter, IDisposable); Remarks Creating an HtmlFilter and using it in a call to the RenderToFilter method is similar to using the RenderToFile or RenderToStream (Stream, FileFormatEnum) methods, but offers some extra flexibility because you can set properties on the HtmlFilter object before calling RenderToFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter Members HtmlFilter overview Public Constructors HtmlFilter Constructor Initializes a new instance of the HtmlFilter class attached to a stream. Public Properties DrillDown Gets or sets whether the user should be able to expand and collapse groups by clicking on their header sections. EncodeHtml Gets or sets whether field contents should be encoded or rendered in raw format. This property allows you to render fields that contain HTML formatting. MultiFile Gets or sets whether the built-in HTML filter should break paged reports into multiple HTML files (one per page). Paged Gets or sets whether the filter should produce a continuous report into a single HTML file or a paged report into a set of HTML files. StartCollapsed Gets or sets whether DrillDown reports should be initially displayed in a collapsed state. HtmlFilter Constructor · 281 Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. EndSection Overriden. Called when the component finishes rendering each section. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage Overriden. Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays Overriden. Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. StartSection Overriden. Called when the component starts rendering a section. UsesImages Overriden. Returns a value that determines whether the filter uses page images. See Also HtmlFilter Class | C1.Win.C1Report Namespace HtmlFilter Constructor Overload List Initializes a new instance of the HtmlFilter class attached to a stream. [Visual Basic] Public Function New(Stream) [C#] public HtmlFilter(Stream); [Delphi] public constructor Create(Stream); overload; Initializes a new instance of the HtmlFilter class attached to a file. [Visual Basic] Public Function New(String) [C#] public HtmlFilter(string); [Delphi] public constructor Create(String); overload; Initializes a new instance of the HtmlFilter class attached to a stream. [Visual Basic] Public Function New(Stream, String, String) [C#] public HtmlFilter(Stream, string, string); [Delphi] public constructor Create(Stream; String; String); overload; 282 · C1.Win.C1Report Namespace See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter Constructor (Stream) Initializes a new instance of the HtmlFilter class attached to a stream. [Visual Basic] Public Function New( _ ByVal stream As Stream _ ) [C#] public HtmlFilter( Stream stream ); [Delphi] public constructor Create( stream: Stream ); overload; Parameters stream Output stream where the report will be rendered. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace | HtmlFilter Constructor Overload List HtmlFilter Constructor (String) Initializes a new instance of the HtmlFilter class attached to a file. [Visual Basic] Public Function New( _ ByVal fileName As String _ ) [C#] public HtmlFilter( string fileName ); [Delphi] public constructor Create( fileName: String ); overload; Parameters fileName Contains the name of the file to be created. If the file already exists, it will be overwritten. HtmlFilter Properties · 283 See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace | HtmlFilter Constructor Overload List HtmlFilter Constructor (Stream, String, String) Initializes a new instance of the HtmlFilter class attached to a stream. [Visual Basic] Public Function New( _ ByVal stream As Stream, _ ByVal idPrefix As String, _ ByVal fileName As String _ ) [C#] public HtmlFilter( Stream stream, string idPrefix, string fileName ); [Delphi] public constructor Create( stream: Stream; idPrefix: String; fileName: String ); overload; Parameters stream Output stream where the report will be rendered. idPrefix A unique report identifier used to avoid duplicate style names when adding several reports to the same HTML stream. fileName Path and template of file name for member files (pictures, etc.). See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace | HtmlFilter Constructor Overload List HtmlFilter Properties The properties of the HtmlFilter class are listed here. For a complete list of HtmlFilter class members, see the HtmlFilter Members topic. Public Properties DrillDown Gets or sets whether the user should be able to expand and collapse groups by clicking on their header sections. 284 · C1.Win.C1Report Namespace EncodeHtml Gets or sets whether field contents should be encoded or rendered in raw format. This property allows you to render fields that contain HTML formatting. MultiFile Gets or sets whether the built-in HTML filter should break paged reports into multiple HTML files (one per page). Paged Gets or sets whether the filter should produce a continuous report into a single HTML file or a paged report into a set of HTML files. StartCollapsed Gets or sets whether DrillDown reports should be initially displayed in a collapsed state. See Also HtmlFilter Class | C1.Win.C1Report Namespace HtmlFilter.DrillDown Property Gets or sets whether the user should be able to expand and collapse groups by clicking on their header sections. [Visual Basic] Public Property DrillDown As Boolean [C#] public bool DrillDown {get;set;} [Delphi] public property DrillDown: Boolean read get_DrillDown write set_DrillDown; See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.EncodeHtml Property Gets or sets whether field contents should be encoded or rendered in raw format. This property allows you to render fields that contain HTML formatting. [Visual Basic] Public Property EncodeHtml As Boolean [C#] public bool EncodeHtml {get;set;} [Delphi] public property EncodeHtml: Boolean read get_EncodeHtml write set_EncodeHtml; Remarks By default, field contents are encoded, so a field containing the string "A<B>C" would be rendered as "A<B>C", which would appear as the original string in the browser. If you set EncodeHtml to False, the same string would be rendered in raw format, causing the browser to display it as "A<B>C" (the "C" would be bold). HtmlFilter.MultiFile Property · 285 See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.MultiFile Property Gets or sets whether the built-in HTML filter should break paged reports into multiple HTML files (one per page). [Visual Basic] Public Property MultiFile As Boolean [C#] public bool MultiFile {get;set;} [Delphi] public property MultiFile: Boolean read get_MultiFile write set_MultiFile; Remarks Set this property to False to create a single HTML file containing all pages, with <BR> elements at the page breaks. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.Paged Property Gets or sets whether the filter should produce a continuous report into a single HTML file or a paged report into a set of HTML files. [Visual Basic] Public Property Paged As Boolean [C#] public bool Paged {get;set;} [Delphi] public property Paged: Boolean read get_Paged write set_Paged; See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.StartCollapsed Property Gets or sets whether DrillDown reports should be initially displayed in a collapsed state. [Visual Basic] Public Property StartCollapsed As Boolean [C#] public bool StartCollapsed {get;set;} [Delphi] public property StartCollapsed: Boolean read get_StartCollapsed write set_StartCollapsed; 286 · C1.Win.C1Report Namespace See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter Methods The methods of the HtmlFilter class are listed here. For a complete list of HtmlFilter class members, see the HtmlFilter Members topic. Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. EndSection Overriden. Called when the component finishes rendering each section. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage Overriden. Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays Overriden. Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. StartSection Overriden. Called when the component starts rendering a section. UsesImages Overriden. Returns a value that determines whether the filter uses page images. See Also HtmlFilter Class | C1.Win.C1Report Namespace HtmlFilter.Dispose Method Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. [Visual Basic] Overrides Public Sub Dispose() Implements IDisposable.Dispose [C#] override public void Dispose() [Delphi] public procedure Dispose(); override; HtmlFilter.EndReport Method · 287 Implements IDisposable.Dispose Remarks Use this method to free any disposable objects used by the filter. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.EndReport Method Called when the component finishes rendering a report. [Visual Basic] Overrides Public Sub EndReport() [C#] override public void EndReport() [Delphi] public procedure EndReport(); override; See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.EndSection Method Called when the component finishes rendering each section. [Visual Basic] Overrides Public Sub EndSection( _ ByVal section As Section _ ) [C#] override public void EndSection( Section section ); [Delphi] public procedure EndSection( section: Section ); override; Parameters section Section that was rendered. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.IsPaged Method Determines whether this filter generates single or multi-page reports. 288 · C1.Win.C1Report Namespace [Visual Basic] Overrides Public Function IsPaged() As Boolean [C#] override public bool IsPaged() [Delphi] public function IsPaged(): Boolean; override; Return Value True if report is paged. Remarks When generating paged reports, the component calls the filter's NewPage method on page breaks and updates the value of the Page property. When generating non-paged (continuous) reports, only one long page is generated. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.NewPage Method Called after each page break on paged reports (see the IsPaged property). [Visual Basic] Overrides Public Sub NewPage() [C#] override public void NewPage() [Delphi] public procedure NewPage(); override; See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.RenderField Method Called when the component needs to render a report field with specific content at a specific position on the current page. [Visual Basic] Overrides Public Sub RenderField( _ ByVal field As Field, _ ByVal rc As Rectangle, _ ByVal text As String, _ ByVal img As Image _ ) HtmlFilter.StartOverlays Method · 289 [C#] override public void RenderField( Field field, Rectangle rc, string text, Image img ); [Delphi] public procedure RenderField( field: Field; rc: Rectangle; text: String; img: Image ); override; Parameters field The field to be rendered. rc Rectangle that determines the field position on the current page, in twips. text Field text to render. img Field image to render. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.StartOverlays Method Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. [Visual Basic] Overrides Public Sub StartOverlays() [C#] override public void StartOverlays() [Delphi] public procedure StartOverlays(); override; Remarks Overlay fields are used only in reports that contain calculated fields which use the Pages variable. This value is not known until the report has been generated, and is therefore rendered on a second pass. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace 290 · C1.Win.C1Report Namespace HtmlFilter.StartReport Method Called when the component starts rendering a report. [Visual Basic] Overrides Public Sub StartReport( _ ByVal report As C1Report _ ) [C#] override public void StartReport( C1Report report ); [Delphi] public procedure StartReport( report: C1Report ); override; Parameters report Owner report. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.StartSection Method Called when the component starts rendering a section. [Visual Basic] Overrides Public Sub StartSection( _ ByVal section As Section, _ ByVal x As Double, _ ByVal y As Double _ ) [C#] override public void StartSection( Section section, double x, double y ); [Delphi] public procedure StartSection( section: Section; x: Double; y: Double ); override; Parameters section The section being rendered. HtmlFilter.UsesImages Method · 291 x Left position of the section, in twips. y Top position of the section, in twips. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace HtmlFilter.UsesImages Method Returns a value that determines whether the filter uses page images. [Visual Basic] Overrides Public Function UsesImages() As Boolean [C#] override public bool UsesImages() [Delphi] public function UsesImages(): Boolean; override; Return Value Always returns False. Remarks By default, C1Report will render the report into the filter and also into its own PageImages collection. HtmlFilter doesn't need the images and therefore this method always returns False, which saves some resources while rendering long reports. See Also HtmlFilter Class | HtmlFilter Members | C1.Win.C1Report Namespace IC1ReportRecordset Interface Interface used to access report data from data source objects. For a list of all members of this type, see IC1ReportRecordset Members. [Visual Basic] Public Interface IC1ReportRecordset [C#] public interface IC1ReportRecordset [Delphi] type IC1ReportRecordset = interface; Remarks Any object that can be used as custom data source for reports must implement this interface. The C1Report component provides this implementation for common data sources such as System.Data.DataTable and System.Data.DataView classes. 292 · C1.Win.C1Report Namespace Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset Members IC1ReportRecordset overview Public Methods ApplyFilter Applies a filter string. See the System.Data.DataView.RowFilter property for details. ApplySort Applies a sort string. See the System.Data.DataView.Sort property for details. BOF Returns True if the cursor is pointing at the first record in the data source. EOF Returns True if the cursor is pointing past the last record in the data source. GetBookmark Returns the current cursor position. GetFieldNames Gets a string vector with the names of each field in the data source. GetFieldTypes Gets a vector with the types of each field in the data source. GetFieldValue Gets the value of the given field, at the cursor position. MoveFirst Moves the cursor to the first record in the data source. MoveLast Moves the cursor to the last record in the data source. MoveNext Moves the cursor to the next record in the data source. MovePrevious Moves the cursor to the previous record in the data source. SetBookmark Sets the current cursor position to supplied value. See Also IC1ReportRecordset Interface | C1.Win.C1Report Namespace IC1ReportRecordset Methods The methods of the IC1ReportRecordset interface are listed here. For a complete list of IC1ReportRecordset interface members, see the IC1ReportRecordset Members topic. Public Methods ApplyFilter Applies a filter string. See the System.Data.DataView.RowFilter property for details. ApplySort Applies a sort string. See the System.Data.DataView.Sort property for details. IC1ReportRecordset.ApplyFilter Method · 293 BOF Returns True if the cursor is pointing at the first record in the data source. EOF Returns True if the cursor is pointing past the last record in the data source. GetBookmark Returns the current cursor position. GetFieldNames Gets a string vector with the names of each field in the data source. GetFieldTypes Gets a vector with the types of each field in the data source. GetFieldValue Gets the value of the given field, at the cursor position. MoveFirst Moves the cursor to the first record in the data source. MoveLast Moves the cursor to the last record in the data source. MoveNext Moves the cursor to the next record in the data source. MovePrevious Moves the cursor to the previous record in the data source. SetBookmark Sets the current cursor position to supplied value. See Also IC1ReportRecordset Interface | C1.Win.C1Report Namespace IC1ReportRecordset.ApplyFilter Method Applies a filter string. See the System.Data.DataView.RowFilter property for details. [Visual Basic] Sub ApplyFilter( _ ByVal filter As String _ ) [C#] void ApplyFilter( string filter ); [Delphi] procedure ApplyFilter( filter: String ); Parameters filter Filter string. See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.ApplySort Method Applies a sort string. See the System.Data.DataView.Sort property for details. 294 · C1.Win.C1Report Namespace [Visual Basic] Sub ApplySort( _ ByVal sort As String _ ) [C#] void ApplySort( string sort ); [Delphi] procedure ApplySort( sort: String ); Parameters sort Sort string. See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.BOF Method Returns True if the cursor is pointing at the first record in the data source. [Visual Basic] Function BOF() As Boolean [C#] bool BOF() [Delphi] function BOF(): Boolean; See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.EOF Method Returns True if the cursor is pointing past the last record in the data source. [Visual Basic] Function EOF() As Boolean [C#] bool EOF() [Delphi] function EOF(): Boolean; See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.GetBookmark Method · 295 IC1ReportRecordset.GetBookmark Method Returns the current cursor position. [Visual Basic] Function GetBookmark() As Integer [C#] int GetBookmark() [Delphi] function GetBookmark(): Int32; Return Value Index of current record. See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.GetFieldNames Method Gets a string vector with the names of each field in the data source. [Visual Basic] Function GetFieldNames() As String [C#] string GetFieldNames() [Delphi] function GetFieldNames(): String; Return Value A string vector with the names of each field in the data source. See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.GetFieldTypes Method Gets a vector with the types of each field in the data source. [Visual Basic] Function GetFieldTypes() As Type() [C#] Type[] GetFieldTypes() [Delphi] function GetFieldTypes(): array of Type; Return Value A vector with the types of each field in the data source. 296 · C1.Win.C1Report Namespace See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.GetFieldValue Method Gets the value of the given field, at the cursor position. [Visual Basic] Function GetFieldValue( _ ByVal fieldIndex As Integer _ ) As Object [C#] object GetFieldValue( int fieldIndex ); [Delphi] function GetFieldValue( fieldIndex: Int32 ): Object; Parameters fieldIndex Index of the field. Return Value Value of the field. See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.MoveFirst Method Moves the cursor to the first record in the data source. [Visual Basic] Sub MoveFirst() [C#] void MoveFirst() [Delphi] procedure MoveFirst(); See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.MoveLast Method Moves the cursor to the last record in the data source. [Visual Basic] Sub MoveLast() IC1ReportRecordset.MoveNext Method · 297 [C#] void MoveLast() [Delphi] procedure MoveLast(); See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.MoveNext Method Moves the cursor to the next record in the data source. [Visual Basic] Sub MoveNext() [C#] void MoveNext() [Delphi] procedure MoveNext(); See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.MovePrevious Method Moves the cursor to the previous record in the data source. [Visual Basic] Sub MovePrevious() [C#] void MovePrevious() [Delphi] procedure MovePrevious(); See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace IC1ReportRecordset.SetBookmark Method Sets the current cursor position to supplied value. [Visual Basic] Sub SetBookmark( _ ByVal bkmk As Integer _ ) [C#] void SetBookmark( int bkmk ); 298 · C1.Win.C1Report Namespace [Delphi] procedure SetBookmark( bkmk: Int32 ); Parameters bkmk Index of record. See Also IC1ReportRecordset Interface | IC1ReportRecordset Members | C1.Win.C1Report Namespace KeepTogetherEnum Enumeration Specifies whether the group should be kept together on a page. [Visual Basic] Public Enum KeepTogetherEnum [C#] public enum KeepTogetherEnum [Delphi] type KeepTogetherEnum = (KeepFirstDetail, KeepNothing, KeepWholeGroup); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the KeepTogether and KeepTogether property in the Group and Section classes. Members Member name Description KeepFirstDetail Keep the group header and first detail section together on a page. KeepNothing Do not try to keep the group together. KeepWholeGroup Keep the group header, detail, and footer together on a page. See Also C1.Win.C1Report Namespace Layout Class The Layout object controls how the report is rendered on pages. For a list of all members of this type, see Layout Members. System.Object C1.Win.C1Report.Layout Layout Members · 299 [Visual Basic] Public Class Layout [C#] public class Layout [Delphi] type Layout = class; Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also Layout Members | C1.Win.C1Report Namespace Layout Members Layout overview Public Properties ColumnLayout Gets or sets the layout for the columns (down or across). Columns Gets or sets the number of detail columns. CustomHeight Gets or sets the custom height for the report, in twips. CustomWidth Gets or sets the custom width for the report, in twips. LabelSpacingX Used by the designer to discount horizontal label spacing in the design surface. LabelSpacingY Used by the designer to discount vertical label spacing in the design surface. MarginBottom Gets or sets the bottom margin for each page, in twips. MarginLeft Gets or sets the left margin for each page, in twips. MarginRight Gets or sets the right margin for each page, in twips. MarginTop Gets or sets the top margin for each page, in twips. Orientation Gets or sets the page orientation. PageFooter Gets or sets a value that determines on which pages the Page Footer section should be displayed. PageHeader Gets or sets a value that determines on which pages the Page Header section should be displayed. PaperSize Gets or sets the paper size for the report. ParentReport Gets the C1Report that contains this Layout object. Picture Gets or sets a background picture for the report body. PictureAlign Gets or sets how the background picture is aligned. PictureScale Gets or sets how the background picture is aligned. PictureShow Gets or sets where the background picture is displayed. 300 · C1.Win.C1Report Namespace Width Gets or sets the width of the report's detail section, in twips. Public Methods ToString Overriden. Returns a description of layout to show it in designer. UpdateFromPrintDoc Copies information from C1.Win.C1Report.PrintDoc to Layout object. See Also Layout Class | C1.Win.C1Report Namespace Layout Properties The properties of the Layout class are listed here. For a complete list of Layout class members, see the Layout Members topic. Public Properties ColumnLayout Gets or sets the layout for the columns (down or across). Columns Gets or sets the number of detail columns. CustomHeight Gets or sets the custom height for the report, in twips. CustomWidth Gets or sets the custom width for the report, in twips. LabelSpacingX Used by the designer to discount horizontal label spacing in the design surface. LabelSpacingY Used by the designer to discount vertical label spacing in the design surface. MarginBottom Gets or sets the bottom margin for each page, in twips. MarginLeft Gets or sets the left margin for each page, in twips. MarginRight Gets or sets the right margin for each page, in twips. MarginTop Gets or sets the top margin for each page, in twips. Orientation Gets or sets the page orientation. PageFooter Gets or sets a value that determines on which pages the Page Footer section should be displayed. PageHeader Gets or sets a value that determines on which pages the Page Header section should be displayed. PaperSize Gets or sets the paper size for the report. ParentReport Gets the C1Report that contains this Layout object. Picture Gets or sets a background picture for the report body. PictureAlign Gets or sets how the background picture is aligned. PictureScale Gets or sets how the background picture is aligned. PictureShow Gets or sets where the background picture is displayed. Width Gets or sets the width of the report's detail section, in twips. Layout.ColumnLayout Property · 301 See Also Layout Class | C1.Win.C1Report Namespace Layout.ColumnLayout Property Gets or sets the layout for the columns (down or across). [Visual Basic] Public Property ColumnLayout As ColumnLayoutEnum [C#] public ColumnLayoutEnum ColumnLayout {get;set;} [Delphi] public property ColumnLayout: ColumnLayoutEnum read get_ColumnLayout write set_ColumnLayout; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace | ColumnLayoutEnum Enumeration Layout.Columns Property Gets or sets the number of detail columns. [Visual Basic] Public Property Columns As Integer [C#] public int Columns {get;set;} [Delphi] public property Columns: Int32 read get_Columns write set_Columns; Remarks Use this property to create multi-column reports. In multi-column reports, header and footer sections span the full width of the report. Only the detail section is rendered in multiple columns. Use the Width property to specify the width of each column, and the ColumnLayout property to specify whether columns should be laid out across the page or down the page. Multi-column reports are useful for printing reports on mailing labels and other types of multi-column preprinted forms. They are also useful for creating compact reports where detail information is laid out across the page. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.CustomHeight Property Gets or sets the custom height for the report, in twips. [Visual Basic] Public Property CustomHeight As Double 302 · C1.Win.C1Report Namespace [C#] public double CustomHeight {get;set;} [Delphi] public property CustomHeight: Double read get_CustomHeight write set_CustomHeight; Remarks To create reports using custom paper sizes, set the PaperSize property to System.Drawing.Printing.PaperKind.Custom, then set the CustomWidth and CustomHeight properties to the size of the page measured in twips. If the PaperSize is set to a value other than System.Drawing.Printing.PaperKind.Custom, the paper size is determined by that setting. The CustomWidth and CustomHeight properties are not used in this case. If the PaperSize is set to System.Drawing.Printing.PaperKind.Custom and the CustomWidth or CustomHeight properties are set to zero, the printer's default paper size is used. Example The following code sets the CustomHeight property in twips: • Visual Basic c1r1.Layout.PaperSize = PaperKind.Custom c1r1.Layout.CustomHeight = 25 * 1440 ' in twips c1r1.Layout.CustomWidth = 11 * 1440 • C# c1r1.Layout.PaperSize = PaperKind.Custom; c1r1.Layout.CustomHeight = 25 * 1440; // in twips c1r1.Layout.CustomWidth = 11 * 1440; • Delphi c1r1.Layout.PaperSize := PaperKind.Custom; c1r1.Layout.CustomHeight := 25 * 1440 // in twips c1r1.Layout.CustomWidth := 11 * 1440; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.CustomWidth Property Gets or sets the custom width for the report, in twips. [Visual Basic] Public Property CustomWidth As Double [C#] public double CustomWidth {get;set;} [Delphi] public property CustomWidth: Double read get_CustomWidth write set_CustomWidth; Remarks To create reports using custom paper sizes, set the PaperSize property to System.Drawing.Printing.PaperKind.Custom, then set the CustomWidth and CustomHeight properties to the size of the page measured in twips. Layout.LabelSpacingX Property · 303 If the PaperSize is set to a value other than System.Drawing.Printing.PaperKind.Custom, the paper size is determined by that setting. The CustomWidth and CustomHeight properties are not used in this case. If the PaperSize is set to System.Drawing.Printing.PaperKind.Custom and the CustomWidth or CustomHeight properties are set to zero, the printer's default paper size is used. Example The following code sets the CustomWidth property in twips: • Visual Basic c1r1.Layout.PaperSize = PaperKind.Custom c1r1.Layout.CustomWidth = 11 * 1440 ' in twips • C# c1r1.Layout.PaperSize = PaperKind.Custom; c1r1.Layout.CustomWidth = 11 * 1440; // in twips • Delphi c1r1.Layout.PaperSize = PaperKind.Custom; c1r1.Layout.CustomWidth = 11 * 1440; // in twips See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.LabelSpacingX Property Used by the designer to discount horizontal label spacing in the design surface. [Visual Basic] Public Property LabelSpacingX As Double [C#] public double LabelSpacingX {get;set;} [Delphi] public property LabelSpacingX: Double read get_LabelSpacingX write set_LabelSpacingX; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.LabelSpacingY Property Used by the designer to discount vertical label spacing in the design surface. [Visual Basic] Public Property LabelSpacingY As Double [C#] public double LabelSpacingY {get;set;} [Delphi] public property LabelSpacingY: Double read get_LabelSpacingY write set_LabelSpacingY; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace 304 · C1.Win.C1Report Namespace Layout.MarginBottom Property Gets or sets the bottom margin for each page, in twips. [Visual Basic] Public Property MarginBottom As Double [C#] public double MarginBottom {get;set;} [Delphi] public property MarginBottom: Double read get_MarginBottom write set_MarginBottom; Remarks The margins are measured in twips, from the edges of the paper. You can select the paper size and orientation using the PaperSize and Orientation properties. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.MarginLeft Property Gets or sets the left margin for each page, in twips. [Visual Basic] Public Property MarginLeft As Double [C#] public double MarginLeft {get;set;} [Delphi] public property MarginLeft: Double read get_MarginLeft write set_MarginLeft; Remarks The margins are measured in twips, from the edges of the paper. You can select the paper size and orientation using the PaperSize and Orientation properties. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.MarginRight Property Gets or sets the right margin for each page, in twips. [Visual Basic] Public Property MarginRight As Double [C#] public double MarginRight {get;set;} [Delphi] public property MarginRight: Double read get_MarginRight write set_MarginRight; Layout.MarginTop Property · 305 Remarks The margins are measured in twips, from the edges of the paper. You can select the paper size and orientation using the PaperSize and Orientation properties. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.MarginTop Property Gets or sets the top margin for each page, in twips. [Visual Basic] Public Property MarginTop As Double [C#] public double MarginTop {get;set;} [Delphi] public property MarginTop: Double read get_MarginTop write set_MarginTop; Remarks The margins are measured in twips, from the edges of the paper. You can select the paper size and orientation using the PaperSize and Orientation properties. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.Orientation Property Gets or sets the page orientation. [Visual Basic] Public Property Orientation As OrientationEnum [C#] public OrientationEnum Orientation {get;set;} [Delphi] public property Orientation: OrientationEnum read get_Orientation write set_Orientation; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace | OrientationEnum Enumeration Layout.PageFooter Property Gets or sets a value that determines on which pages the Page Footer section should be displayed. [Visual Basic] Public Property PageFooter As HdrFtrEnum [C#] public HdrFtrEnum PageFooter {get;set;} 306 · C1.Win.C1Report Namespace [Delphi] public property PageFooter: HdrFtrEnum read get_PageFooter write set_PageFooter; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace | HdrFtrEnum Enumeration Layout.PageHeader Property Gets or sets a value that determines on which pages the Page Header section should be displayed. [Visual Basic] Public Property PageHeader As HdrFtrEnum [C#] public HdrFtrEnum PageHeader {get;set;} [Delphi] public property PageHeader: HdrFtrEnum read get_PageHeader write set_PageHeader; Remarks You can use the PageHeader and PageFooter properties to specify whether a report's page header or page footer should be printed on the same page as a report header or report footer. For example, you might not want to print a page header containing the page number on the first page of a report if the report header is a cover sheet. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace | HdrFtrEnum Enumeration Layout.PaperSize Property Gets or sets the paper size for the report. [Visual Basic] Public Property PaperSize As PaperKind [C#] public PaperKind PaperSize {get;set;} [Delphi] public property PaperSize: PaperKind read get_PaperSize write set_PaperSize; Example The following code sets the PaperSize property to Legal: • Visual Basic c1r1.Layout.PaperSize = PaperKind.Legal • C# c1r1.Layout.PaperSize = PaperKind.Legal; • Delphi c1r1.Layout.PaperSize := PaperKind.Legal; Layout.ParentReport Property · 307 See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.ParentReport Property Gets the C1Report that contains this Layout object. [Visual Basic] Public ReadOnly Property ParentReport As C1Report [C#] public C1Report ParentReport {get;} [Delphi] public property ParentReport: C1Report read get_ParentReport; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.Picture Property Gets or sets a background picture for the report body. [Visual Basic] Public Property Picture As Object [C#] public object Picture {get;set;} [Delphi] public property Picture: Object read get_Picture write set_Picture; Remarks Use the Picture property to specify a bitmap or other type of graphic to be displayed as a background picture on a report (watermark-style). Use the PictureShow, PictureAlign, and PictureScale properties to specify which pages should display the picture and how it should be aligned and scaled. Example The following code sets the Picture property: • Visual Basic fEmployeePhoto.Picture = "Photo" • C# fEmployeePhoto.Picture = "Photo"; • Delphi fEmployeePhoto.Picture :='Photo'; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.PictureAlign Property Gets or sets how the background picture is aligned. 308 · C1.Win.C1Report Namespace [Visual Basic] Public Property PictureAlign As PictureAlignEnum [C#] public PictureAlignEnum PictureAlign {get;set;} [Delphi] public property PictureAlign: PictureAlignEnum read get_PictureAlign write set_PictureAlign; Remarks To select the background picture and which pages should display it, use the Picture and PictureShow properties. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.PictureScale Property Gets or sets how the background picture is aligned. [Visual Basic] Public Property PictureScale As PictureScaleEnum [C#] public PictureScaleEnum PictureScale {get;set;} [Delphi] public property PictureScale: PictureScaleEnum read get_PictureScale write set_PictureScale; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.PictureShow Property Gets or sets where the background picture is displayed. [Visual Basic] Public Property PictureShow As PictureShowEnum [C#] public PictureShowEnum PictureShow {get;set;} [Delphi] public property PictureShow: PictureShowEnum read get_PictureShow write set_PictureShow; Remarks To select the background picture and how it should be aligned on the page, use the Picture, PictureAlign, and PictureScale properties. Layout.Width Property · 309 Example The following code sets the PictureShow property to AllPages: • Visual Basic Me.C1Report1.Layout.PictureShow = C1.Win.C1Report.PictureShowEnum.AllPages • C# this.C1Report1.Layout.PictureShow = C1.Win.C1Report.PictureShowEnum.AllPages; • Delphi Self.C1Report1.Layout.PictureShow := C1.Win.C1Report.PictureShowEnum.AllPages; See Also Layout Class | Layout Members | C1.Win.C1Report Namespace | PictureShowEnum Enumeration Layout.Width Property Gets or sets the width of the report's detail section, in twips. [Visual Basic] Public Property Width As Double [C#] public double Width {get;set;} [Delphi] public property Width: Double read get_Width write set_Width; Remarks This property determines the width of the detail section of the report. Multi-column reports have header and footer sections that span all columns so their actual width is Width * Columns. For example, a two-column report with a one-inch wide detail section would have Width = 1440, and its total width would be 2 * 1440 = 2880. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout Methods The methods of the Layout class are listed here. For a complete list of Layout class members, see the Layout Members topic. Public Methods ToString Overriden. Returns a description of layout to show it in designer. UpdateFromPrintDoc Copies information from C1.Win.C1Report.PrintDoc to Layout object. See Also Layout Class | C1.Win.C1Report Namespace 310 · C1.Win.C1Report Namespace Layout.ToString Method Returns a description of layout to show it in designer. [Visual Basic] Overrides Public Function ToString() As String [C#] override public string ToString() [Delphi] public function ToString(): String; override; Return Value Description of layout to show it in designer. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace Layout.UpdateFromPrintDoc Method Copies information from C1.Win.C1Report.PrintDoc to Layout object. [Visual Basic] Public Function UpdateFromPrintDoc() As Boolean [C#] public bool UpdateFromPrintDoc() [Delphi] public function UpdateFromPrintDoc(): Boolean; Return Value True if Layout object was changed. Remarks This is useful if you want to make changes to the System.Drawing.Printing.PageSettings object instead of the Layout object. See Also Layout Class | Layout Members | C1.Win.C1Report Namespace LineSlantEnum Enumeration Determines whether/how a line should be drawn across the field (as opposed to a box around the field). [Visual Basic] Public Enum LineSlantEnum [C#] public enum LineSlantEnum OrientationEnum Enumeration · 311 [Delphi] type LineSlantEnum = (Down, NoLine, NoSlant, Up); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the LineSlant property in the Field class. Members Member name Description Down Render field as a line between the left-top and rightbottom corners of the field box. NoLine Regular field (not a line). NoSlant Render field as a vertical line (if Height > Width) or as a horizontal line (if Width > Height). Up Render field as a line between the left-bottom and righttop corners of the field box. See Also C1.Win.C1Report Namespace OrientationEnum Enumeration Specifies the page orientation. [Visual Basic] Public Enum OrientationEnum [C#] public enum OrientationEnum [Delphi] type OrientationEnum = (Auto, Landscape, Portrait); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the Orientation property in the Layout class. Members Member name Description Auto Set the orientation automatically, based on the current PaperSize and report width (Width). Landscape Use Landscape orientation (wide). Portrait Use Portrait orientation (tall). See Also C1.Win.C1Report Namespace 312 · C1.Win.C1Report Namespace PdfFilter Class Used with the RenderToFilter method to render reports into PDF (portable document format) streams or files. For a list of all members of this type, see PdfFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.PdfFilter [Visual Basic] Public Class PdfFilter Inherits ExportFilter [C#] public class PdfFilter : ExportFilter [Delphi] type PdfFilter = class (ExportFilter); Remarks Creating a PdfFilter and using it in a call to RenderToFilter is similar to using the RenderToFile or RenderToStream (Stream, FileFormatEnum) methods, but offers some extra flexibility because you can set properties on the PdfFilter before calling RenderToFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also PdfFilter Members | C1.Win.C1Report Namespace PdfFilter Members PdfFilter overview Public Constructors PdfFilter Constructor Initializes a new instance of the PdfFilter class attached to a stream. Public Properties EmbedFonts Gets or sets whether the filter should embed font information into the PDF output. Outline Gets or sets whether the PDF output should include an outline tree. Password Gets or sets the owner password associated with the PDF document. Public Methods Dispose (inherited from ExportFilter) Releases the resources used by the filter. EndReport Overriden. Called when the component finishes rendering a report. PdfFilter Constructor · 313 IsPaged (inherited from ExportFilter) Determines whether this filter generates single or multipage reports. NewPage (inherited from ExportFilter) Called after each page break on paged reports (see the IsPaged property). StartOverlays (inherited from ExportFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages (inherited from ExportFilter) Returns a value that determines whether the filter requires page images to be generated. See Also PdfFilter Class | C1.Win.C1Report Namespace PdfFilter Constructor Overload List Initializes a new instance of the PdfFilter class attached to a stream. [Visual Basic] Public Function New(Stream) [C#] public PdfFilter(Stream); [Delphi] public constructor Create(Stream); overload; Initializes a new instance of the PdfFilter class attached to a file. [Visual Basic] Public Function New(String) [C#] public PdfFilter(string); [Delphi] public constructor Create(String); overload; See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace PdfFilter Constructor (Stream) Initializes a new instance of the PdfFilter class attached to a stream. [Visual Basic] Public Function New( _ ByVal stream As Stream _ ) [C#] public PdfFilter( Stream stream ); [Delphi] public constructor Create( stream: Stream ); overload; 314 · C1.Win.C1Report Namespace Parameters stream Output System.IO.Stream where the report will be rendered. See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace | PdfFilter Constructor Overload List PdfFilter Constructor (String) Initializes a new instance of the PdfFilter class attached to a file. [Visual Basic] Public Function New( _ ByVal fileName As String _ ) [C#] public PdfFilter( string fileName ); [Delphi] public constructor Create( fileName: String ); overload; Parameters fileName Full name of the file to be created. If the file already exists, it will be overwritten. See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace | PdfFilter Constructor Overload List PdfFilter Properties The properties of the PdfFilter class are listed here. For a complete list of PdfFilter class members, see the PdfFilter Members topic. Public Properties EmbedFonts Gets or sets whether the filter should embed font information into the PDF output. Outline Gets or sets whether the PDF output should include an outline tree. Password Gets or sets the owner password associated with the PDF document. See Also PdfFilter Class | C1.Win.C1Report Namespace PdfFilter.EmbedFonts Property Gets or sets whether the filter should embed font information into the PDF output. PdfFilter.Outline Property · 315 [Visual Basic] Public Property EmbedFonts As Boolean [C#] public bool EmbedFonts {get;set;} [Delphi] public property EmbedFonts: Boolean read get_EmbedFonts write set_EmbedFonts; Remarks Embedding font information makes the PDF document substantially larger, but it allows the file to be viewed faithfully in systems that don't have all the necessary fonts installed. Enbedding fonts is not necessary if the target systems have the necessary TrueType fonts installed. See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace PdfFilter.Outline Property Gets or sets whether the PDF output should include an outline tree. [Visual Basic] Public Property Outline As Boolean [C#] public bool Outline {get;set;} [Delphi] public property Outline: Boolean read get_Outline write set_Outline; Remarks The tree is created automatically based on the report groups and can be used to navigate through the report in the Adobe Acrobat viewer. See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace PdfFilter.Password Property Gets or sets the owner password associated with the PDF document. [Visual Basic] Public Property Password As String [C#] public string Password {get;set;} [Delphi] public property Password: String read get_Password write set_Password; Remarks The owner password is required for making changes to the document. 316 · C1.Win.C1Report Namespace By default, the password is set to an empty string, which means anyone can open and edit the PDF document. The PdfFilter never sets the user password for the file, which means anyone can open and view the PDF document. See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace PdfFilter Methods The methods of the PdfFilter class are listed here. For a complete list of PdfFilter class members, see the PdfFilter Members topic. Public Methods Dispose (inherited from ExportFilter) Releases the resources used by the filter. EndReport Overriden. Called when the component finishes rendering a report. IsPaged (inherited from ExportFilter) Determines whether this filter generates single or multipage reports. NewPage (inherited from ExportFilter) Called after each page break on paged reports (see the IsPaged property). StartOverlays (inherited from ExportFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages (inherited from ExportFilter) Returns a value that determines whether the filter requires page images to be generated. See Also PdfFilter Class | C1.Win.C1Report Namespace PdfFilter.EndReport Method Called when the component finishes rendering a report. [Visual Basic] Overrides Public Sub EndReport() [C#] override public void EndReport() [Delphi] public procedure EndReport(); override; See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace PdfFilter.StartReport Method Called when the component starts rendering a report. PictureAlignEnum Enumeration · 317 [Visual Basic] Overrides Public Sub StartReport( _ ByVal report As C1Report _ ) [C#] override public void StartReport( C1Report report ); [Delphi] public procedure StartReport( report: C1Report ); override; Parameters report Owner report. See Also PdfFilter Class | PdfFilter Members | C1.Win.C1Report Namespace PictureAlignEnum Enumeration Specifies the alignment of images within the field's rectangle. [Visual Basic] Public Enum PictureAlignEnum [C#] public enum PictureAlignEnum [Delphi] type PictureAlignEnum = (CenterBottom, CenterMiddle, CenterTop, Clip, LeftBottom, LeftMiddle, LeftTop, RightBottom, RightMiddle, RightTop, Stretch, Tile, Zoom); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the PictureAlign and PictureAlign properties in the Field and Layout classes. Members Member name Description CenterBottom Align to the center and to the bottom, clipping if necessary. CenterMiddle Align to the center and to the middle, clipping if necessary. CenterTop Align to the center and to the top, clipping if necessary. 318 · C1.Win.C1Report Namespace Member name Description Clip Align to the left and to the top, clipping if necessary. LeftBottom Align to the left and to the bottom, clipping if necessary. LeftMiddle Align to the left and to the middle, clipping if necessary. LeftTop Align to the left and to the top, clipping if necessary. RightBottom Align to the right and to the bottom, clipping if necessary. RightMiddle Align to the right and to the middle, clipping if necessary. RightTop Align to the right and to the top, clipping if necessary. Stretch Stretch the picture to fill the page. Tile Tile the picture to fill the page. Zoom Scale the picture to use as much of the page as possible, while preserving the picture's aspect ratio. See Also C1.Win.C1Report Namespace PictureScaleEnum Enumeration Specifies the scaling of images within the field's rectangle. [Visual Basic] Public Enum PictureScaleEnum [C#] public enum PictureScaleEnum [Delphi] type PictureScaleEnum = (Clip, Hide, Scale, Stretch, Tile); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the PictureScale and PictureScale properties in the Field and Layout classes. Members Member name Description Clip Use the image's original size, clipping it to the display area if necessary. Hide Hide the picture. Scale Scale the picture to fit the display area. This mode may increase or reduce the size of the image while maintaining its aspect ratio. PictureShowEnum Enumeration · 319 Member name Description Stretch Stretch the picture to fill the display area. This mode will usually change the image's aspect ratio. Tile Tile the picture to fill the display area. See Also C1.Win.C1Report Namespace PictureShowEnum Enumeration Specifies where the background picture is displayed. [Visual Basic] Public Enum PictureShowEnum [C#] public enum PictureShowEnum [Delphi] type PictureShowEnum = (AllButFirstPage, AllPages, FirstPage, NoPages); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the PictureShow property in the Layout class. Members Member name Description AllButFirstPage Show the background picture on all pages but the first. AllPages Show the background picture on all pages. FirstPage Show the background picture on the first page only. NoPages Do not show the background picture. Example The following code sets the PictureShow property to AllPages: • Visual Basic Me.C1Report1.Layout.PictureShow = C1.Win.C1Report.PictureShowEnum.AllPages • C# this.C1Report1.Layout.PictureShow = C1.Win.C1Report.PictureShowEnum.AllPages • Delphi Self.C1Report1.Layout.PictureShow = C1.Win.C1Report.PictureShowEnum.AllPages See Also C1.Win.C1Report Namespace 320 · C1.Win.C1Report Namespace ReportEventArgs Class Provides data for StartPage, EndPage, StartSection, PrintSection, EndSection, ReportError, and AddOutlineEntry events. For a list of all members of this type, see ReportEventArgs Members. System.Object System.EventArgs C1.Win.C1Report.ReportEventArgs [Visual Basic] Public Class ReportEventArgs Inherits EventArgs [C#] public class ReportEventArgs : EventArgs [Delphi] type ReportEventArgs = class (EventArgs); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also ReportEventArgs Members | C1.Win.C1Report Namespace ReportEventArgs Members ReportEventArgs overview Public Fields Exception Exception that caused the error. Handled Gets or sets a value that indicates whether the component should throw the Exception that was detected or whether it should ignore the error and continue rendering the report. Page The current page. Section The current section. Text Gets or sets the text that will be used as an outline entry. See Also ReportEventArgs Class | C1.Win.C1Report Namespace ReportEventArgs Fields The fields of the ReportEventArgs class are listed here. For a complete list of ReportEventArgs class members, see the ReportEventArgs Members topic. ReportEventArgs.Exception Field · 321 Public Fields Exception Exception that caused the error. Handled Gets or sets a value that indicates whether the component should throw the Exception that was detected or whether it should ignore the error and continue rendering the report. Page The current page. Section The current section. Text Gets or sets the text that will be used as an outline entry. See Also ReportEventArgs Class | C1.Win.C1Report Namespace ReportEventArgs.Exception Field Exception that caused the error. [Visual Basic] Public ReadOnly Exception As Exception [C#] public readonly Exception Exception [Delphi] public Exception: Exception; Remarks This property is only used with the ReportError event. See Also ReportEventArgs Class | ReportEventArgs Members | C1.Win.C1Report Namespace ReportEventArgs.Handled Field Gets or sets a value that indicates whether the component should throw the Exception that was detected or whether it should ignore the error and continue rendering the report. [Visual Basic] Public Handled As Boolean [C#] public bool Handled [Delphi] public Handled: Boolean; Remarks This property is only used with the ReportError event. See Also ReportEventArgs Class | ReportEventArgs Members | C1.Win.C1Report Namespace 322 · C1.Win.C1Report Namespace ReportEventArgs.Page Field The current page. [Visual Basic] Public ReadOnly Page As Integer [C#] public readonly int Page [Delphi] public Page: Int32; See Also ReportEventArgs Class | ReportEventArgs Members | C1.Win.C1Report Namespace ReportEventArgs.Section Field The current section. [Visual Basic] Public ReadOnly Section As SectionTypeEnum [C#] public readonly SectionTypeEnum Section [Delphi] public Section: SectionTypeEnum; See Also ReportEventArgs Class | ReportEventArgs Members | C1.Win.C1Report Namespace ReportEventArgs.Text Field Gets or sets the text that will be used as an outline entry. [Visual Basic] Public Text As String [C#] public string Text [Delphi] public Text: String; Remarks This property is only used with the AddOutlineEntry event. See Also ReportEventArgs Class | ReportEventArgs Members | C1.Win.C1Report Namespace ReportEventHandler Delegate · 323 ReportEventHandler Delegate Represents the method that will handle StartPage, EndPage, StartSection, PrintSection, EndSection, ReportError, and AddOutlineEntry events. [Visual Basic] Public Delegate Sub ReportEventHandler( _ ByVal sender As Object, _ ByVal e As ReportEventArgs _ ) [C#] public delegate void ReportEventHandler( object sender, ReportEventArgs e ); [Delphi] type ReportEventHandler = procedure ( sender: Object; e: ReportEventArgs ) of object; Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also C1.Win.C1Report Namespace ReportInfo Class Class that contains report metadata. For a list of all members of this type, see ReportInfo Members. System.Object C1.Win.C1Report.ReportInfo [Visual Basic] Public Class ReportInfo [C#] public class ReportInfo [Delphi] type ReportInfo = class; Remarks Reports may include general information such as a title, author, and keywords. Such global information about the document itself (as opposed to its content or structure) is called metadata, and is intended to assist in cataloguing and searching for reports and report definitions in external databases. Namespace: C1.Win.C1Report 324 · C1.Win.C1Report Namespace Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also ReportInfo Members | C1.Win.C1Report Namespace ReportInfo Members ReportInfo overview Public Properties Author Gets or sets the name of the person that created the report. Creator Gets or sets the name of the application that created the report. Keywords Gets or sets keywords associated with the report. Subject Gets or sets the subject of the report. Title Gets or sets the title of the report. Public Methods Clear Clears the ReportInfo object. Clone Returns a copy of this ReportInfo object. ToString Overriden. Returns a string that represents the current ReportInfo object. See Also ReportInfo Class | C1.Win.C1Report Namespace ReportInfo Properties The properties of the ReportInfo class are listed here. For a complete list of ReportInfo class members, see the ReportInfo Members topic. Public Properties Author Gets or sets the name of the person that created the report. Creator Gets or sets the name of the application that created the report. Keywords Gets or sets keywords associated with the report. Subject Gets or sets the subject of the report. Title Gets or sets the title of the report. See Also ReportInfo Class | C1.Win.C1Report Namespace ReportInfo.Author Property Gets or sets the name of the person that created the report. ReportInfo.Creator Property · 325 [Visual Basic] Public Property Author As String [C#] public string Author {get;set;} [Delphi] public property Author: String read get_Author write set_Author; See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace ReportInfo.Creator Property Gets or sets the name of the application that created the report. [Visual Basic] Public Property Creator As String [C#] public string Creator {get;set;} [Delphi] public property Creator: String read get_Creator write set_Creator; See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace ReportInfo.Keywords Property Gets or sets keywords associated with the report. [Visual Basic] Public Property Keywords As String [C#] public string Keywords {get;set;} [Delphi] public property Keywords: String read get_Keywords write set_Keywords; See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace ReportInfo.Subject Property Gets or sets the subject of the report. [Visual Basic] Public Property Subject As String [C#] public string Subject {get;set;} 326 · C1.Win.C1Report Namespace [Delphi] public property Subject: String read get_Subject write set_Subject; See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace ReportInfo.Title Property Gets or sets the title of the report. [Visual Basic] Public Property Title As String [C#] public string Title {get;set;} [Delphi] public property Title: String read get_Title write set_Title; See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace ReportInfo Methods The methods of the ReportInfo class are listed here. For a complete list of ReportInfo class members, see the ReportInfo Members topic. Public Methods Clear Clears the ReportInfo object. Clone Returns a copy of this ReportInfo object. ToString Overriden. Returns a string that represents the current ReportInfo object. See Also ReportInfo Class | C1.Win.C1Report Namespace ReportInfo.Clear Method Clears the ReportInfo object. [Visual Basic] Public Sub Clear() [C#] public void Clear() [Delphi] public procedure Clear(); See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace ReportInfo.Clone Method · 327 ReportInfo.Clone Method Returns a copy of this ReportInfo object. [Visual Basic] Public Function Clone() As ReportInfo [C#] public ReportInfo Clone() [Delphi] public function Clone(): ReportInfo; Return Value A copy of this ReportInfo object. See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace ReportInfo.ToString Method Returns a string that represents the current ReportInfo object. [Visual Basic] Overrides Public Function ToString() As String [C#] override public string ToString() [Delphi] public function ToString(): String; override; Return Value Returns a string that represents the current ReportInfo object. See Also ReportInfo Class | ReportInfo Members | C1.Win.C1Report Namespace RtfFilter Class Used with the RenderToFilter method to render reports into RTF (rich text format) streams or files. For a list of all members of this type, see RtfFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.RtfFilter C1.Win.C1Report.RtfLabelFilter [Visual Basic] Public Class RtfFilter Inherits ExportFilter Implements IDisposable 328 · C1.Win.C1Report Namespace [C#] public class RtfFilter : ExportFilter , IDisposable [Delphi] type RtfFilter = class (ExportFilter, IDisposable); Remarks Creating an RtfFilter and using it in a call to the RenderToFilter method is similar to using the RenderToFile or RenderToStream (Stream, FileFormatEnum) methods, but offers some extra flexibility because you can set properties on the RtfFilter before calling RenderToFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also RtfFilter Members | C1.Win.C1Report Namespace RtfFilter Members RtfFilter overview Public Constructors RtfFilter Constructor Initializes a new instance of the RtfFilter class attached to a stream. Public Properties EmbedPictures Gets or sets whether filter should embed images in the RTF document. RtfTarget Gets or sets the format used to export images. Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage Overriden. Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays Overriden. Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. RtfFilter Constructor · 329 UsesImages Overriden. Returns a value that determines whether the filter uses page images. Protected Properties MarginLeft Gets the left margin of the page. MarginTop Gets the top margin of the page. StreamWriter Gets the StreamWriter object used by filter. Protected Methods GetRTFFont Gets an RTF representation of a a field's System.Drawing.Font. See Also RtfFilter Class | C1.Win.C1Report Namespace RtfFilter Constructor Overload List Initializes a new instance of the RtfFilter class attached to a stream. [Visual Basic] Public Function New(Stream) [C#] public RtfFilter(Stream); [Delphi] public constructor Create(Stream); overload; Initializes a new instance of the RtfFilter class attached to a file. [Visual Basic] Public Function New(String) [C#] public RtfFilter(string); [Delphi] public constructor Create(String); overload; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter Constructor (Stream) Initializes a new instance of the RtfFilter class attached to a stream. [Visual Basic] Public Function New( _ ByVal stream As Stream _ ) [C#] public RtfFilter( Stream stream ); [Delphi] public constructor Create( stream: Stream ); overload; 330 · C1.Win.C1Report Namespace Parameters stream Output System.IO.Stream where the report will be rendered. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace | RtfFilter Constructor Overload List RtfFilter Constructor (String) Initializes a new instance of the RtfFilter class attached to a file. [Visual Basic] Public Function New( _ ByVal fileName As String _ ) [C#] public RtfFilter( string fileName ); [Delphi] public constructor Create( fileName: String ); overload; Parameters fileName Full name of the file to be created. If the file already exists, it will be overwritten. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace | RtfFilter Constructor Overload List RtfFilter Properties The properties of the RtfFilter class are listed here. For a complete list of RtfFilter class members, see the RtfFilter Members topic. Public Properties EmbedPictures Gets or sets whether filter should embed images in the RTF document. RtfTarget Gets or sets the format used to export images. Protected Properties MarginLeft Gets the left margin of the page. MarginTop Gets the top margin of the page. StreamWriter Gets the StreamWriter object used by filter. See Also RtfFilter Class | C1.Win.C1Report Namespace RtfFilter.EmbedPictures Property · 331 RtfFilter.EmbedPictures Property Gets or sets whether filter should embed images in the RTF document. [Visual Basic] Public Property EmbedPictures As Boolean [C#] public bool EmbedPictures {get;set;} [Delphi] public property EmbedPictures: Boolean read get_EmbedPictures write set_EmbedPictures; Remarks Documents with embedded images are significantly larger than text-only documents. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.MarginLeft Property Gets the left margin of the page. [Visual Basic] Protected ReadOnly Property MarginLeft As Integer [C#] protected int MarginLeft {get;} [Delphi] strict protected property MarginLeft: Int32 read get_MarginLeft; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.MarginTop Property Gets the top margin of the page. [Visual Basic] Protected ReadOnly Property MarginTop As Integer [C#] protected int MarginTop {get;} [Delphi] strict protected property MarginTop: Int32 read get_MarginTop; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.RtfTarget Property Gets or sets the format used to export images. 332 · C1.Win.C1Report Namespace [Visual Basic] Public Property RtfTarget As RtfTargetEnum [C#] public RtfTargetEnum RtfTarget {get;set;} [Delphi] public property RtfTarget: RtfTargetEnum read get_RtfTarget write set_RtfTarget; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace | RtfTargetEnum Enumeration RtfFilter.StreamWriter Property Gets the StreamWriter object used by filter. [Visual Basic] Protected ReadOnly Property StreamWriter As StreamWriter [C#] protected StreamWriter StreamWriter {get;} [Delphi] strict protected property StreamWriter: StreamWriter read get_StreamWriter; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter Methods The methods of the RtfFilter class are listed here. For a complete list of RtfFilter class members, see the RtfFilter Members topic. Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage Overriden. Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays Overriden. Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. RtfFilter.Dispose Method · 333 StartReport Overriden. Called when the component starts rendering a report. UsesImages Overriden. Returns a value that determines whether the filter uses page images. Protected Methods GetRTFFont Gets an RTF representation of a a field's System.Drawing.Font. See Also RtfFilter Class | C1.Win.C1Report Namespace RtfFilter.Dispose Method Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. [Visual Basic] Overrides Public Sub Dispose() Implements IDisposable.Dispose [C#] override public void Dispose() [Delphi] public procedure Dispose(); override; Implements IDisposable.Dispose Remarks Use this method to free any disposable objects used by the filter. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.EndReport Method Called when the component finishes rendering a report. [Visual Basic] Overrides Public Sub EndReport() [C#] override public void EndReport() [Delphi] public procedure EndReport(); override; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.GetRTFFont Method Gets an RTF representation of a a field's System.Drawing.Font. 334 · C1.Win.C1Report Namespace [Visual Basic] Protected Function GetRTFFont( _ ByVal field As Field _ ) As String [C#] protected string GetRTFFont( Field field ); [Delphi] strict protected function GetRTFFont( field: Field ): String; Parameters field Field that contains the font. Return Value A string contianing the RTF representation of the font. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.IsPaged Method Determines whether this filter generates single or multi-page reports. [Visual Basic] Overrides Public Function IsPaged() As Boolean [C#] override public bool IsPaged() [Delphi] public function IsPaged(): Boolean; override; Return Value Always returns True. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.NewPage Method Called after each page break on paged reports (see the IsPaged property). [Visual Basic] Overrides Public Sub NewPage() [C#] override public void NewPage() RtfFilter.RenderField Method · 335 [Delphi] public procedure NewPage(); override; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.RenderField Method Called when the component needs to render a report field with specific content at a specific position on the current page. [Visual Basic] Overrides Public Sub RenderField( _ ByVal field As Field, _ ByVal rc As Rectangle, _ ByVal text As String, _ ByVal img As Image _ ) [C#] override public void RenderField( Field field, Rectangle rc, string text, Image img ); [Delphi] public procedure RenderField( field: Field; rc: Rectangle; text: String; img: Image ); override; Parameters field Field object to render. rc Rectangle that determines the field position on the page, in twips. text Field text to render. img Field image to render. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace 336 · C1.Win.C1Report Namespace RtfFilter.StartOverlays Method Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. [Visual Basic] Overrides Public Sub StartOverlays() [C#] override public void StartOverlays() [Delphi] public procedure StartOverlays(); override; See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.StartReport Method Called when the component starts rendering a report. [Visual Basic] Overrides Public Sub StartReport( _ ByVal report As C1Report _ ) [C#] override public void StartReport( C1Report report ); [Delphi] public procedure StartReport( report: C1Report ); override; Parameters report Owner report. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfFilter.UsesImages Method Returns a value that determines whether the filter uses page images. [Visual Basic] Overrides Public Function UsesImages() As Boolean [C#] override public bool UsesImages() RtfLabelFilter Class · 337 [Delphi] public function UsesImages(): Boolean; override; Return Value Always returns False. See Also RtfFilter Class | RtfFilter Members | C1.Win.C1Report Namespace RtfLabelFilter Class Class is used with the RenderToFilter method to render reports into RTF (rich text format) streams or files. For a list of all members of this type, see RtfLabelFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.RtfFilter C1.Win.C1Report.RtfLabelFilter [Visual Basic] Public Class RtfLabelFilter Inherits RtfFilter [C#] public class RtfLabelFilter : RtfFilter [Delphi] type RtfLabelFilter = class (RtfFilter); Remarks This filter is similar to the plain RtfFilter, except if generates RTF fields with absolute positioning. The resulting files are more accurate than the ones created with the plain RTF filter, but they are harder to edit and can only be opened in Microsoft Word (WordPad and other simple editors do not support RTF absolute positioning). Creating an RtfLabelFilter and using it in a call to the RenderToFilter method is similar to using the RenderToFile or RenderToStream (Stream, FileFormatEnum) methods, but offers some extra flexibility because you can set properties on the RtfLabelFilter before calling RenderToFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also RtfLabelFilter Members | C1.Win.C1Report Namespace RtfLabelFilter Members RtfLabelFilter overview Public Constructors RtfLabelFilter Constructor Initializes a new instance of the RtfLabelFilter class attached to a stream. 338 · C1.Win.C1Report Namespace Public Properties EmbedPictures (inherited from RtfFilter) Gets or sets whether filter should embed images in the RTF document. RtfTarget (inherited from RtfFilter) Gets or sets the format used to export images. Public Methods Dispose (inherited from RtfFilter) Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport (inherited from RtfFilter) Called when the component finishes rendering a report. IsPaged (inherited from RtfFilter) Determines whether this filter generates single or multipage reports. NewPage (inherited from RtfFilter) Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays (inherited from RtfFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. UsesImages (inherited from RtfFilter) Returns a value that determines whether the filter uses page images. Protected Properties MarginLeft (inherited from RtfFilter) Gets the left margin of the page. MarginTop (inherited from RtfFilter) Gets the top margin of the page. StreamWriter (inherited from RtfFilter) Gets the StreamWriter object used by filter. See Also RtfLabelFilter Class | C1.Win.C1Report Namespace RtfLabelFilter Constructor Overload List Initializes a new instance of the RtfLabelFilter class attached to a stream. [Visual Basic] Public Function New(Stream) [C#] public RtfLabelFilter(Stream); [Delphi] public constructor Create(Stream); overload; Initializes a new instance of the RtfLabelFilter class attached to a file. [Visual Basic] Public Function New(String) [C#] public RtfLabelFilter(string); [Delphi] public constructor Create(String); overload; See Also RtfLabelFilter Class | RtfLabelFilter Members | C1.Win.C1Report Namespace RtfLabelFilter Constructor · 339 RtfLabelFilter Constructor (Stream) Initializes a new instance of the RtfLabelFilter class attached to a stream. [Visual Basic] Public Function New( _ ByVal stream As Stream _ ) [C#] public RtfLabelFilter( Stream stream ); [Delphi] public constructor Create( stream: Stream ); overload; Parameters stream Output System.IO.Stream where the report will be rendered. See Also RtfLabelFilter Class | RtfLabelFilter Members | C1.Win.C1Report Namespace | RtfLabelFilter Constructor Overload List RtfLabelFilter Constructor (String) Initializes a new instance of the RtfLabelFilter class attached to a file. [Visual Basic] Public Function New( _ ByVal fileName As String _ ) [C#] public RtfLabelFilter( string fileName ); [Delphi] public constructor Create( fileName: String ); overload; Parameters fileName Full name of the file to be created. If the file already exists, it will be overwritten. See Also RtfLabelFilter Class | RtfLabelFilter Members | C1.Win.C1Report Namespace | RtfLabelFilter Constructor Overload List 340 · C1.Win.C1Report Namespace RtfLabelFilter Properties The properties of the RtfLabelFilter class are listed here. For a complete list of RtfLabelFilter class members, see the RtfLabelFilter Members topic. Public Properties EmbedPictures (inherited from RtfFilter) Gets or sets whether filter should embed images in the RTF document. RtfTarget (inherited from RtfFilter) Gets or sets the format used to export images. Protected Properties MarginLeft (inherited from RtfFilter) Gets the left margin of the page. MarginTop (inherited from RtfFilter) Gets the top margin of the page. StreamWriter (inherited from RtfFilter) Gets the StreamWriter object used by filter. See Also RtfLabelFilter Class | C1.Win.C1Report Namespace RtfLabelFilter Methods The methods of the RtfLabelFilter class are listed here. For a complete list of RtfLabelFilter class members, see the RtfLabelFilter Members topic. Public Methods Dispose (inherited from RtfFilter) Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport (inherited from RtfFilter) Called when the component finishes rendering a report. IsPaged (inherited from RtfFilter) Determines whether this filter generates single or multipage reports. NewPage (inherited from RtfFilter) Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays (inherited from RtfFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. UsesImages (inherited from RtfFilter) Returns a value that determines whether the filter uses page images. See Also RtfLabelFilter Class | C1.Win.C1Report Namespace RtfLabelFilter.RenderField Method Called when the component needs to render a report field with specific content at a specific position on the current page. RtfTargetEnum Enumeration · 341 [Visual Basic] Overrides Public Sub RenderField( _ ByVal field As Field, _ ByVal rc As Rectangle, _ ByVal text As String, _ ByVal img As Image _ ) [C#] override public void RenderField( Field field, Rectangle rc, string text, Image img ); [Delphi] public procedure RenderField( field: Field; rc: Rectangle; text: String; img: Image ); override; Parameters field The field to be rendered. rc Rectangle that determines the field position on the current page, in twips. text Field text to render. img Field image to render. See Also RtfLabelFilter Class | RtfLabelFilter Members | C1.Win.C1Report Namespace RtfTargetEnum Enumeration Specifies the format of the export file. [Visual Basic] Public Enum RtfTargetEnum [C#] public enum RtfTargetEnum [Delphi] type RtfTargetEnum = (MSWord, Portable); Namespace: C1.Win.C1Report 342 · C1.Win.C1Report Namespace Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set RtfTarget property of the RtfFilter class. Members Member name Description MSWord This setting creates RTF content that can be viewed in Microsoft Word. It is useful for exporting high quality images. Documents with such images are significantly larger than with images in Portable format. Portable This setting creates RTF content that can be viewed in Microsoft Word, WordPad and RichTextBox. See Also C1.Win.C1Report Namespace RunningSumEnum Enumeration Determines whether to calculate a running sum. [Visual Basic] Public Enum RunningSumEnum [C#] public enum RunningSumEnum [Delphi] type RunningSumEnum = (NoRunningSum, SumOverAll, SumOverGroup); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the RunningSum property in the Field class. Members Member name Description NoRunningSum Do not treat field as a running sum. SumOverAll Calculate running sum over the whole report. SumOverGroup Calculate running sum over each group. See Also C1.Win.C1Report Namespace Section Class Represents a report band. For a list of all members of this type, see Section Members. Section Members · 343 System.Object C1.Win.C1Report.Section [Visual Basic] Public Class Section [C#] public class Section [Delphi] type Section = class; Remarks Each Section object contains a collection of fields objects that display individual data items within the section. Every report contains the following sections: A detail section. A report header and a report footer section. A page header and a page footer section. A group header and a group footer section for each Group object in the report. The total number of sections in a report is therefore: 5 + 2 * Groups.Count Sections cannot be added and removed from reports directly. The number of sections is a function of the number of groups. Although sections cannot be removed, they can be hidden by setting their Visible property to False. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also Section Members | C1.Win.C1Report Namespace Section Members Section overview Public Properties BackColor Gets or sets the background color for this Section. CanGrow Gets or sets whether the Section height should be automatically increased to fit its contents. CanShrink Gets or sets whether the Section height should be reduced when one or more fields shrink. Fields Returns a collection of all fields in this Section. ForcePageBreak Gets or sets whether page breaks should be inserted before and/or after the section is rendered. Height Gets or sets the Section height, in twips. KeepTogether Gets or sets whether the Section should be kept together on a page. 344 · C1.Win.C1Report Namespace Name Gets or sets the Section name. OnFormat Gets or sets a string containing VBScript code to be executed before the Section is formatted. OnPrint Gets or sets a string containing VBScript code to be executed before the Section is printed (after it is formatted). ParentReport Gets the C1Report object that contains this Section. RenderHeight Returns the height of the section after the CanGrow and CanShrink properties have been applied to the section. Repeat Gets or sets whether the Section should be repeated at the top of every page. Tag Gets or sets extra data used by the calling program. Type Returns the Section type (e.g., PageHeader, Detail). Visible Gets or sets whether the Section will be rendered in the report. See Also Section Class | C1.Win.C1Report Namespace Section Properties The properties of the Section class are listed here. For a complete list of Section class members, see the Section Members topic. Public Properties BackColor Gets or sets the background color for this Section. CanGrow Gets or sets whether the Section height should be automatically increased to fit its contents. CanShrink Gets or sets whether the Section height should be reduced when one or more fields shrink. Fields Returns a collection of all fields in this Section. ForcePageBreak Gets or sets whether page breaks should be inserted before and/or after the section is rendered. Height Gets or sets the Section height, in twips. KeepTogether Gets or sets whether the Section should be kept together on a page. Name Gets or sets the Section name. OnFormat Gets or sets a string containing VBScript code to be executed before the Section is formatted. OnPrint Gets or sets a string containing VBScript code to be executed before the Section is printed (after it is formatted). ParentReport Gets the C1Report object that contains this Section. Section.BackColor Property · 345 RenderHeight Returns the height of the section after the CanGrow and CanShrink properties have been applied to the section. Repeat Gets or sets whether the Section should be repeated at the top of every page. Tag Gets or sets extra data used by the calling program. Type Returns the Section type (e.g., PageHeader, Detail). Visible Gets or sets whether the Section will be rendered in the report. See Also Section Class | C1.Win.C1Report Namespace Section.BackColor Property Gets or sets the background color for this Section. [Visual Basic] Public Property BackColor As Color [C#] public Color BackColor {get;set;} [Delphi] public property BackColor: Color read get_BackColor write set_BackColor; See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.CanGrow Property Gets or sets whether the Section height should be automatically increased to fit its contents. [Visual Basic] Public Property CanGrow As Boolean [C#] public bool CanGrow {get;set;} [Delphi] public property CanGrow: Boolean read get_CanGrow write set_CanGrow; Remarks You can use the CanGrow and CanShrink properties to control the appearance of report sections and fields. For example, if you set both properties to True, a section or field automatically adjusts vertically to print or preview all the data it contains. Sections grow and shrink vertically across their entire width. When a section grows or shrinks, its Height property does not change. To retrieve the actual rendering height, use the RenderHeight property. You can make fields grow or shrink to match the size of the section by setting their Anchor property. 346 · C1.Win.C1Report Namespace See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.CanShrink Property Gets or sets whether the Section height should be reduced when one or more fields shrink. [Visual Basic] Public Property CanShrink As Boolean [C#] public bool CanShrink {get;set;} [Delphi] public property CanShrink: Boolean read get_CanShrink write set_CanShrink; Remarks You can use the CanGrow and CanShrink properties to control the layout of report sections and fields. For example, if you set both properties to True, a section or field automatically adjusts vertically to print or preview all the data it contains. When a section grows or shrinks, its Height property does not change. To retrieve the actual (adjusted) height, use the RenderHeight property. You can make fields grow or shrink to match the size of the section by setting their Anchor property. See Also Section Class | Section Members | C1.Win.C1Report Namespace | Section.CanGrow Section.Fields Property Returns a collection of all fields in this Section. [Visual Basic] Public ReadOnly Property Fields As FieldCollection [C#] public FieldCollection Fields {get;} [Delphi] public property Fields: FieldCollection read get_Fields; Remarks The Fields collection contains all Field objects defined in the current section. When you add a field to a section's Fields collection, the field is automatically assigned to the section that owns the collection. For example, the code below adds a field to the Detail section: • Visual Basic _c1r.Sections.Detail.Fields.Add("new field", "CompanyLogo", rc) • C# _c1r.Sections.Detail.Fields.Add("new field", "CompanyLogo", rc); • Delphi _c1r.Sections.Detail.Fields.Add('new field', 'CompanyLogo', rc); Section.ForcePageBreak Property · 347 See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.ForcePageBreak Property Gets or sets whether page breaks should be inserted before and/or after the section is rendered. [Visual Basic] Public Property ForcePageBreak As ForcePageBreakEnum [C#] public ForcePageBreakEnum ForcePageBreak {get;set;} [Delphi] public property ForcePageBreak: ForcePageBreakEnum read get_ForcePageBreak write set_ForcePageBreak; See Also Section Class | Section Members | C1.Win.C1Report Namespace | ForcePageBreakEnum Enumeration Section.Height Property Gets or sets the Section height, in twips. [Visual Basic] Public Property Height As Double [C#] public double Height {get;set;} [Delphi] public property Height: Double read get_Height write set_Height; Remarks The height of a section should be large enough to accommodate all fields in the section. The Report Designer automatically adjusts section heights when fields are added, moved, or resized. Example The following code ensures that a section is tall enough to accommodate all of the fields it contains: • Visual Basic ' get section object Dim s As Section = c1.Sections(vsrDetail) ' scan all its fields Dim f As Field For Each f In s.Fields ' get field bottom Dim h As Double = f.Top + f.Height ' make sure section is tall enough for the field If h > s.Height Then s.Height = h + 200 348 · C1.Win.C1Report Namespace End If Next • C# // get section object Section s = c1.Sections[vsrDetail]; // scan all its fields Field f; foreach (f In s.Fields) // get field bottom double h = f.Top + f.Height; // make sure section is tall enough for the field if (h > s.Height) s.Height = h + 200; • Delphi var s: Section; f: Field; i: Integer; h: Double; begin // get section object s := c1.Sections(vsrDetail); // scan all its fields for i := 0 to s.Fields.Count - 1 do begin f := s.Fields[i]; // get field bottom h := f.Top + f.Height; // make sure section is tall enough for the field if h > s.Height then s.Height := h + 200; end; end; See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.KeepTogether Property Gets or sets whether the Section should be kept together on a page. [Visual Basic] Public Property KeepTogether As Boolean [C#] public bool KeepTogether {get;set;} [Delphi] public property KeepTogether: Boolean read get_KeepTogether write set_KeepTogether; Section.Name Property · 349 Remarks The Group and Field objects also have KeepTogether properties. The Group object's KeepTogether property works across sections. It determines whether group headers should be kept together with their first detail section or whether entire groups should be kept together on a page. The Field object's KeepTogether property determines whether the field should be rendered on a single page or whether it is allowed to be split across page breaks. See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.Name Property Gets or sets the Section name. [Visual Basic] Public Property Name As String [C#] public string Name {get;set;} [Delphi] public property Name: String read get_Name write set_Name; Remarks The section name can be used as an index into the control's Sections collection. Section names are also used to identify fields in VBScript expressions. Duplicate and empty section names are allowed, but should be avoided if you plan to use the section names in scripts or as indexers. Example The following code provides a sample of the Name property: • Visual Basic c1r.Sections("Detail").Height = 1440 • C# c1r.Sections("Detail").Height = 1440; • Delphi c1r.Sections['Detail'].Height := 1440; See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.OnFormat Property Gets or sets a string containing VBScript code to be executed before the Section is formatted. [Visual Basic] Public Property OnFormat As String [C#] public string OnFormat {get;set;} 350 · C1.Win.C1Report Namespace [Delphi] public property OnFormat: String read get_OnFormat write set_OnFormat; Remarks This property contains VBScript instructions to be executed before the fields in the section are calculated. When this script is executed, the recordset already holds the data that will be displayed in the section, but the field values have not been updated yet. Use this event to assign values to fields before they are calculated, so the new values will be taken into account when the control calculates the field's size and position when the CanGrow or CanShrink properties are set to True. If you want to set field properties based on the field's current value, use the OnPrint property instead. See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.OnPrint Property Gets or sets a string containing VBScript code to be executed before the Section is printed (after it is formatted). [Visual Basic] Public Property OnPrint As String [C#] public string OnPrint {get;set;} [Delphi] public property OnPrint: String read get_OnPrint write set_OnPrint; Remarks This property contains VBScript instructions that get executed after the fields in the section have been calculated. Example The following code adjusts the width of a field based on the value of another field: • Visual Basic Dim script As String script = "BarFld.Width = SaleAmountMaxFld.Width * " & _ "(SaleAmountFld / SaleAmountMaxFld)" c1r.Sections("Detail").OnPrint = script • C# string script; script = "BarFld.Width = SaleAmountMaxFld.Width * " + "(SaleAmountFld / SaleAmountMaxFld)"; c1r.Sections("Detail").OnPrint = script; • Delphi script := 'BarFld.Width = SaleAmountMaxFld.Width * (SaleAmountFld / SaleAmountMaxFld)'; c1r.Sections['Detail'].OnPrint := script; The BarFld field is a green rectangle. By changing its Width property for each detail section , the report creates a bar chart. Section.ParentReport Property · 351 The SaleAmountMaxFld contains an expression that calculates the maximum value for the SaleAmount recordset field. The expression is "=Max ([SaleAmount])". The value and width of the SaleAmountMaxFld are used to calculate the width of the bar. See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.ParentReport Property Gets the C1Report object that contains this Section. [Visual Basic] Public ReadOnly Property ParentReport As C1Report [C#] public C1Report ParentReport {get;} [Delphi] public property ParentReport: C1Report read get_ParentReport; See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.RenderHeight Property Returns the height of the section after the CanGrow and CanShrink properties have been applied to the section. [Visual Basic] Public ReadOnly Property RenderHeight As Double [C#] public double RenderHeight {get;} [Delphi] public property RenderHeight: Double read get_RenderHeight; Remarks When a section grows or shrinks, its Height property does not change. If you need to retrieve the actual height that will be used for rendering the section (for example, while handling the OnPrint event), use the RenderHeight property instead. See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.Repeat Property Gets or sets whether the Section should be repeated at the top of every page. [Visual Basic] Public Property Repeat As Boolean [C#] public bool Repeat {get;set;} 352 · C1.Win.C1Report Namespace [Delphi] public property Repeat: Boolean read get_Repeat write set_Repeat; Remarks This property only applies to group header sections. Set this value to True to repeat the group header page at the top of every page, before the detail sections. If you have multiple groups, all group header sections that have the Repeat property set to True will be rendered at the top of each page. See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.Tag Property Gets or sets extra data used by the calling program. [Visual Basic] Public Property Tag As Object [C#] public object Tag {get;set;} [Delphi] public property Tag: Object read get_Tag write set_Tag; See Also Section Class | Section Members | C1.Win.C1Report Namespace Section.Type Property Returns the Section type (e.g., PageHeader, Detail). [Visual Basic] Public ReadOnly Property Type As SectionTypeEnum [C#] public SectionTypeEnum Type {get;} [Delphi] public property Type: SectionTypeEnum read get_Type; See Also Section Class | Section Members | C1.Win.C1Report Namespace | SectionTypeEnum Enumeration Section.Visible Property Gets or sets whether the Section will be rendered in the report. [Visual Basic] Public Property Visible As Boolean [C#] public bool Visible {get;set;} SectionCollection Class · 353 [Delphi] public property Visible: Boolean read get_Visible write set_Visible; See Also Section Class | Section Members | C1.Win.C1Report Namespace SectionCollection Class Collection of the Section objects. For a list of all members of this type, see SectionCollection Members. System.Object C1.Win.C1Report.SectionCollection [Visual Basic] Public Class SectionCollection Implements ICollection, IEnumerable [C#] public class SectionCollection : ICollection, IEnumerable [Delphi] type SectionCollection = class (TObject, ICollection, IEnumerable); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also SectionCollection Members | C1.Win.C1Report Namespace SectionCollection Members SectionCollection overview Public Properties Count Returns the number of elements in the collection. Detail Returns a reference to the detail section of the report. Footer Returns a reference to the report footer section. Header Returns a reference to the report header section. Item Overloaded. Returns a section from a Sections collection. PageFooter Returns a reference to the page footer section of the report. PageHeader Returns a reference to the page header section of the report. Public Methods Contains Determines whether the collection contains a specific Section. 354 · C1.Win.C1Report Namespace CopyTo Copies the elements of the collection to an System.Array, starting at a particular array index. See Also SectionCollection Class | C1.Win.C1Report Namespace SectionCollection Properties The properties of the SectionCollection class are listed here. For a complete list of SectionCollection class members, see the SectionCollection Members topic. Public Properties Count Returns the number of elements in the collection. Detail Returns a reference to the detail section of the report. Footer Returns a reference to the report footer section. Header Returns a reference to the report header section. Item Overloaded. Returns a section from a Sections collection. PageFooter Returns a reference to the page footer section of the report. PageHeader Returns a reference to the page header section of the report. See Also SectionCollection Class | C1.Win.C1Report Namespace SectionCollection.Count Property Returns the number of elements in the collection. [Visual Basic] Overridable Public ReadOnly Property Count As Integer Implements ICollection.Count [C#] virtual public int Count {get;} [Delphi] public property Count: Int32 read get_Count; Implements ICollection.Count Remarks The SectionCollection class does not have Add or Remove methods. That is because the number of sections in a report is determined by then number of groups. To add or remove sections from the report, you need to add or remove groups. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection.Detail Property · 355 SectionCollection.Detail Property Returns a reference to the detail section of the report. [Visual Basic] Public ReadOnly Property Detail As Section [C#] public Section Detail {get;} [Delphi] public property Detail: Section read get_Detail; Remarks This property is equivalent to this[SectionTypeEnum.Detail]. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection.Footer Property Returns a reference to the report footer section. [Visual Basic] Public ReadOnly Property Footer As Section [C#] public Section Footer {get;} [Delphi] public property Footer: Section read get_Footer; Remarks This property is equivalent to this[SectionTypeEnum.Footer]. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection.Header Property Returns a reference to the report header section. [Visual Basic] Public ReadOnly Property Header As Section [C#] public Section Header {get;} [Delphi] public property Header: Section read get_Header; Remarks This property is equivalent to this[SectionTypeEnum.Header] 356 · C1.Win.C1Report Namespace See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection.Item Property Overload List Returns a section from a Sections collection. [Visual Basic] Overloads Public Default ReadOnly Property Item(Integer) As Section [C#] public Section this[int]{get;} [Delphi] public property Item[index: Int32]: Section read get_Item; Returns a section from a Sections collection. [Visual Basic] Overloads Public Default ReadOnly Property Item(SectionTypeEnum) As Section [C#] public Section this[SectionTypeEnum]{get;} [Delphi] public property Item[index: SectionTypeEnum]: Section read get_Item; Returns a section from a Sections collection. [Visual Basic] Overloads Public Default ReadOnly Property Item(String) As Section [C#] public Section this[string]{get;} [Delphi] public property Item[name: String]: Section read get_Item; See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection.Item Property (Int32) Returns a section from a Sections collection. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As Section [C#] public Section this[ int index ] {get;} [Delphi] public property Item[ index: Int32 ]: Section read get_Item; Remarks The index parameter may be an integer between zero and Count-1. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace | SectionCollection.Item Overload List SectionCollection.PageFooter Property · 357 SectionCollection.Item Property (SectionTypeEnum) Returns a section from a Sections collection. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal index As SectionTypeEnum _ ) As Section [C#] public Section this[ SectionTypeEnum index ] {get;} [Delphi] public property Item[ index: SectionTypeEnum ]: Section read get_Item; See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace | SectionCollection.Item Overload List SectionCollection.Item Property (String) Returns a section from a Sections collection. [Visual Basic] Public Default ReadOnly Property Item( _ ByVal name As String _ ) As Section [C#] public Section this[ string name ] {get;} [Delphi] public property Item[ name: String ]: Section read get_Item; Remarks The name parameter may be a string containing a section name. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace | SectionCollection.Item Overload List SectionCollection.PageFooter Property Returns a reference to the page footer section of the report. [Visual Basic] Public ReadOnly Property PageFooter As Section 358 · C1.Win.C1Report Namespace [C#] public Section PageFooter {get;} [Delphi] public property PageFooter: Section read get_PageFooter; Remarks This property is equivalent to this[SectionTypeEnum.PageFooter]. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection.PageHeader Property Returns a reference to the page header section of the report. [Visual Basic] Public ReadOnly Property PageHeader As Section [C#] public Section PageHeader {get;} [Delphi] public property PageHeader: Section read get_PageHeader; Remarks This property is equivalent to this[SectionTypeEnum.PageHeader]. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection Methods The methods of the SectionCollection class are listed here. For a complete list of SectionCollection class members, see the SectionCollection Members topic. Public Methods Contains Determines whether the collection contains a specific Section. CopyTo Copies the elements of the collection to an System.Array, starting at a particular array index. See Also SectionCollection Class | C1.Win.C1Report Namespace SectionCollection.Contains Method Determines whether the collection contains a specific Section. [Visual Basic] Public Function Contains( _ ByVal s As Section _ ) As Boolean SectionCollection.CopyTo Method · 359 [C#] public bool Contains( Section s ); [Delphi] public function Contains( s: Section ): Boolean; Parameters s The Section object. Return Value True if the collection contains specified section; False otherwise. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace SectionCollection.CopyTo Method Copies the elements of the collection to an System.Array, starting at a particular array index. [Visual Basic] Public Sub CopyTo( _ ByVal array As Section(), _ ByVal index As Integer _ ) [C#] public void CopyTo( Section[] array, int index ); [Delphi] public procedure CopyTo( array: Section(); index: Int32 ); Parameters array The one-dimensional System.Array that is the destination of the elements copied from collection. (The array must have zero-based indexing). index The zero-based index in array at which copying begins. See Also SectionCollection Class | SectionCollection Members | C1.Win.C1Report Namespace 360 · C1.Win.C1Report Namespace SectionTypeEnum Enumeration Specifies the section type, which is equivalent to a the index of a Section object in the control's Sections collection. [Visual Basic] Public Enum SectionTypeEnum [C#] public enum SectionTypeEnum [Delphi] type SectionTypeEnum = (Detail, Footer, GroupFooter1, GroupFooter2, GroupFooter3, GroupFooter4, GroupHeader1, GroupHeader2, GroupHeader3, GroupHeader4, Header, PageFooter, PageHeader, Undefined); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the Section and Type properties. Members Member name Description Detail Detail section: repeated for every record in the source recordset. Footer Report footer section: appears once, in the end of the report. GroupFooter1 Group footer section: appears after level-one groups. GroupFooter2 Group footer section: appears after level-two groups. GroupFooter3 Group footer section: appears after level-three groups. GroupFooter4 Group footer section: appears after level-four groups. GroupHeader1 Group header section: appears before level-one groups. GroupHeader2 Group header section: appears before level-two groups. GroupHeader3 Group header section: appears before level-three groups. GroupHeader4 Group header section: appears before level-four groups. Header Report header section: appears once, in the beginning of the report. PageFooter Page footer section: appears at the bottom of every page, subject to the setting of the PageFooter property. PageHeader Page header section: appears at the top of every page, subject to the setting of the PageHeader property. Undefined Undefined. When fields are created using the Add (String, String, Double, Double, Double, Double) method, they don't belong to any sections and are not rendered with the report. SortEnum Enumeration · 361 See Also C1.Win.C1Report Namespace SortEnum Enumeration Specifies how groups should be sorted. [Visual Basic] Public Enum SortEnum [C#] public enum SortEnum [Delphi] type SortEnum = (Ascending, Descending, NoSort); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the Sort property in the Group class. Members Member name Description Ascending Sort records in ascending order. Descending Sort records in descending order. NoSort Do not sort records for this group. Example The following code sorts the first group in Ascending order: • Visual Basic c1r.Groups(0).Sort = SortEnum.Ascending • C# c1r.Groups[0].Sort = SortEnum.Ascending; • Delphi c1r.Groups[0].Sort := SortEnum.Ascending; See Also C1.Win.C1Report Namespace TextDirectionEnum Enumeration Specifies the direction of the text in the field. [Visual Basic] Public Enum TextDirectionEnum [C#] public enum TextDirectionEnum 362 · C1.Win.C1Report Namespace [Delphi] type TextDirectionEnum = (Down, Normal, Up); Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) Remarks Use the members of this enumeration to set the value of the TextDirection property in the Field class. Members Member name Description Down Text direction is down. Normal Text direction is normal. Up Text direction is up. See Also C1.Win.C1Report Namespace TextFilter Class Used with the RenderToFilter method to render reports into plain text streams or files. For a list of all members of this type, see TextFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.TextFilter [Visual Basic] Public Class TextFilter Inherits ExportFilter Implements IDisposable [C#] public class TextFilter : ExportFilter , IDisposable [Delphi] type TextFilter = class (ExportFilter, IDisposable); Remarks Creating a TextFilter and using it in a call to the RenderToFilter method is similar to using the RenderToFile or RenderToStream (Stream, FileFormatEnum) methods, but offers some extra flexibility because you can set properties on the TextFilter before calling RenderToFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also TextFilter Members | C1.Win.C1Report Namespace TextFilter Members · 363 TextFilter Members TextFilter overview Public Constructors TextFilter Constructor Initializes a new instance of the TextFilter class attached to a stream. Public Properties Paged Gets or sets whether the filter should produce a continuous report or a report with page break characters and page header and footer sections. Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage Overriden. Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays Overriden. Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages Overriden. Returns a value that determines whether the filter uses page images. See Also TextFilter Class | C1.Win.C1Report Namespace TextFilter Constructor Overload List Initializes a new instance of the TextFilter class attached to a stream. [Visual Basic] Public Function New(Stream) [C#] public TextFilter(Stream); [Delphi] public constructor Create(Stream); overload; Initializes a new instance of the TextFilter class attached to a file. [Visual Basic] Public Function New(String) [C#] public TextFilter(string); 364 · C1.Win.C1Report Namespace [Delphi] public constructor Create(String); overload; See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter Constructor (Stream) Initializes a new instance of the TextFilter class attached to a stream. [Visual Basic] Public Function New( _ ByVal stream As Stream _ ) [C#] public TextFilter( Stream stream ); [Delphi] public constructor Create( stream: Stream ); overload; Parameters stream Output System.IO.Stream where the report will be rendered. See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace | TextFilter Constructor Overload List TextFilter Constructor (String) Initializes a new instance of the TextFilter class attached to a file. [Visual Basic] Public Function New( _ ByVal fileName As String _ ) [C#] public TextFilter( string fileName ); [Delphi] public constructor Create( fileName: String ); overload; Parameters fileName Full name of the file to be created. If the file already exists, it will be overwritten. TextFilter Properties · 365 See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace | TextFilter Constructor Overload List TextFilter Properties The properties of the TextFilter class are listed here. For a complete list of TextFilter class members, see the TextFilter Members topic. Public Properties Paged Gets or sets whether the filter should produce a continuous report or a report with page break characters and page header and footer sections. See Also TextFilter Class | C1.Win.C1Report Namespace TextFilter.Paged Property Gets or sets whether the filter should produce a continuous report or a report with page break characters and page header and footer sections. [Visual Basic] Public Property Paged As Boolean [C#] public bool Paged {get;set;} [Delphi] public property Paged: Boolean read get_Paged write set_Paged; See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter Methods The methods of the TextFilter class are listed here. For a complete list of TextFilter class members, see the TextFilter Members topic. Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage Overriden. Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. 366 · C1.Win.C1Report Namespace StartOverlays Overriden. Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages Overriden. Returns a value that determines whether the filter uses page images. See Also TextFilter Class | C1.Win.C1Report Namespace TextFilter.Dispose Method Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. [Visual Basic] Overrides Public Sub Dispose() Implements IDisposable.Dispose [C#] override public void Dispose() [Delphi] public procedure Dispose(); override; Implements IDisposable.Dispose Remarks Use this method to free any disposable objects used by the filter. See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter.EndReport Method Called when the component finishes rendering a report. [Visual Basic] Overrides Public Sub EndReport() [C#] override public void EndReport() [Delphi] public procedure EndReport(); override; See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter.IsPaged Method Determines whether this filter generates single or multi-page reports. TextFilter.NewPage Method · 367 [Visual Basic] Overrides Public Function IsPaged() As Boolean [C#] override public bool IsPaged() [Delphi] public function IsPaged(): Boolean; override; Return Value True if report is paged. Remarks When generating paged reports, the component calls the filter's NewPage method on page breaks and updates the value of the Page property. When generating non-paged (continuous) reports, only one long page is generated. See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter.NewPage Method Called after each page break on paged reports (see the IsPaged property). [Visual Basic] Overrides Public Sub NewPage() [C#] override public void NewPage() [Delphi] public procedure NewPage(); override; See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter.RenderField Method Called when the component needs to render a report field with specific content at a specific position on the current page. [Visual Basic] Overrides Public Sub RenderField( _ ByVal field As Field, _ ByVal rc As Rectangle, _ ByVal text As String, _ ByVal img As Image _ ) 368 · C1.Win.C1Report Namespace [C#] override public void RenderField( Field field, Rectangle rc, string text, Image img ); [Delphi] public procedure RenderField( field: Field; rc: Rectangle; text: String; img: Image ); override; Parameters field Field object to render. rc Rectangle that determines the field position on the page, in twips. text Field text to render. img Field image to render. See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter.StartOverlays Method Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. [Visual Basic] Overrides Public Sub StartOverlays() [C#] override public void StartOverlays() [Delphi] public procedure StartOverlays(); override; See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter.StartReport Method Called when the component starts rendering a report. TextFilter.UsesImages Method · 369 [Visual Basic] Overrides Public Sub StartReport( _ ByVal report As C1Report _ ) [C#] override public void StartReport( C1Report report ); [Delphi] public procedure StartReport( report: C1Report ); override; Parameters report Owner report. See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TextFilter.UsesImages Method Returns a value that determines whether the filter uses page images. [Visual Basic] Overrides Public Function UsesImages() As Boolean [C#] override public bool UsesImages() [Delphi] public function UsesImages(): Boolean; override; Return Value Always returns False. See Also TextFilter Class | TextFilter Members | C1.Win.C1Report Namespace TiffFilter Class Used with the RenderToFilter method to render reports into TIFF streams or files. For a list of all members of this type, see TiffFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.TiffFilter 370 · C1.Win.C1Report Namespace [Visual Basic] Public Class TiffFilter Inherits ExportFilter [C#] public class TiffFilter : ExportFilter [Delphi] type TiffFilter = class (ExportFilter); Remarks Creating a TiffFilter and using it in a call to the RenderToFilter method is similar to using the RenderToFile or RenderToStream (Stream, FileFormatEnum) methods, but offers some extra flexibility because you can set properties on the TiffFilter before calling RenderToFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also TiffFilter Members | C1.Win.C1Report Namespace TiffFilter Members TiffFilter overview Public Constructors TiffFilter Constructor Initializes a new instance of the TiffFilter class attached to a stream. Public Properties Resolution Gets or sets the resolution of the TIFF document, in dots per inch. Public Methods Dispose (inherited from ExportFilter) Releases the resources used by the filter. EndReport Overriden. Called when the component finishes rendering a report. IsPaged (inherited from ExportFilter) Determines whether this filter generates single or multipage reports. NewPage (inherited from ExportFilter) Called after each page break on paged reports (see the IsPaged property). StartOverlays (inherited from ExportFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages (inherited from ExportFilter) Returns a value that determines whether the filter requires page images to be generated. See Also TiffFilter Class | C1.Win.C1Report Namespace TiffFilter Constructor · 371 TiffFilter Constructor Overload List Initializes a new instance of the TiffFilter class attached to a stream. [Visual Basic] Public Function New(Stream) [C#] public TiffFilter(Stream); [Delphi] public constructor Create(Stream); overload; Initializes a new instance of the TiffFilter class attached to a file. [Visual Basic] Public Function New(String) [C#] public TiffFilter(string); [Delphi] public constructor Create(String); overload; See Also TiffFilter Class | TiffFilter Members | C1.Win.C1Report Namespace TiffFilter Constructor (Stream) Initializes a new instance of the TiffFilter class attached to a stream. [Visual Basic] Public Function New( _ ByVal stream As Stream _ ) [C#] public TiffFilter( Stream stream ); [Delphi] public constructor Create( stream: Stream ); overload; Parameters stream Output System.IO.Stream where the report will be rendered. See Also TiffFilter Class | TiffFilter Members | C1.Win.C1Report Namespace | TiffFilter Constructor Overload List TiffFilter Constructor (String) Initializes a new instance of the TiffFilter class attached to a file. [Visual Basic] Public Function New( _ ByVal fileName As String _ ) 372 · C1.Win.C1Report Namespace [C#] public TiffFilter( string fileName ); [Delphi] public constructor Create( fileName: String ); overload; Parameters fileName Full name of the file to be created. If the file already exists, it will be overwritten. See Also TiffFilter Class | TiffFilter Members | C1.Win.C1Report Namespace | TiffFilter Constructor Overload List TiffFilter Properties The properties of the TiffFilter class are listed here. For a complete list of TiffFilter class members, see the TiffFilter Members topic. Public Properties Resolution Gets or sets the resolution of the TIFF document, in dots per inch. See Also TiffFilter Class | C1.Win.C1Report Namespace TiffFilter.Resolution Property Gets or sets the resolution of the TIFF document, in dots per inch. [Visual Basic] Public Property Resolution As Single [C#] public float Resolution {get;set;} [Delphi] public property Resolution: Single read get_Resolution write set_Resolution; Remarks The default value for this property is 150 dpi. Setting the resolution to higher values result in documents with higher quality but significantly larger size. See Also TiffFilter Class | TiffFilter Members | C1.Win.C1Report Namespace TiffFilter Methods · 373 TiffFilter Methods The methods of the TiffFilter class are listed here. For a complete list of TiffFilter class members, see the TiffFilter Members topic. Public Methods Dispose (inherited from ExportFilter) Releases the resources used by the filter. EndReport Overriden. Called when the component finishes rendering a report. IsPaged (inherited from ExportFilter) Determines whether this filter generates single or multipage reports. NewPage (inherited from ExportFilter) Called after each page break on paged reports (see the IsPaged property). StartOverlays (inherited from ExportFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages (inherited from ExportFilter) Returns a value that determines whether the filter requires page images to be generated. See Also TiffFilter Class | C1.Win.C1Report Namespace TiffFilter.EndReport Method Called when the component finishes rendering a report. [Visual Basic] Overrides Public Sub EndReport() [C#] override public void EndReport() [Delphi] public procedure EndReport(); override; See Also TiffFilter Class | TiffFilter Members | C1.Win.C1Report Namespace TiffFilter.StartReport Method Called when the component starts rendering a report. [Visual Basic] Overrides Public Sub StartReport( _ ByVal report As C1Report _ ) 374 · C1.Win.C1Report Namespace [C#] override public void StartReport( C1Report report ); [Delphi] public procedure StartReport( report: C1Report ); override; Parameters report Owner report. See Also TiffFilter Class | TiffFilter Members | C1.Win.C1Report Namespace XlsFilter Class Class used with the RenderToFiltermethod to render reports into Microsoft Excel (XLS) files. For a list of all members of this type, see XlsFilter Members. System.Object C1.Win.C1Report.ExportFilter C1.Win.C1Report.XlsFilter [Visual Basic] Public Class XlsFilter Inherits ExportFilter Implements IDisposable [C#] public class XlsFilter : ExportFilter , IDisposable [Delphi] type XlsFilter = class (ExportFilter, IDisposable); Remarks Creating an XlsFilter and using it in a call to the RenderToFilter method is similar to using the RenderToFile method, but offers some extra flexibility because you can set properties on the XlsFilter before calling RenderToFilter. Namespace: C1.Win.C1Report Assembly: C1.Win.C1Report.2 (in C1.Win.C1Report.2.dll) See Also XlsFilter Members | C1.Win.C1Report Namespace XlsFilter Members XlsFilter overview XlsFilter Constructor · 375 Public Constructors XlsFilter Constructor Initializes a new instance of the XlsFilter class attached to a file. Public Properties Shading Prevents the filter from creating shaded areas on the sheet. SheetName Gets or sets the name of the worksheet to be used when saving the report into the Excel workbook file. Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage (inherited from ExportFilter) Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays (inherited from ExportFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages Overriden. Returns a value that determines whether the filter uses page images. See Also XlsFilter Class | C1.Win.C1Report Namespace XlsFilter Constructor Initializes a new instance of the XlsFilter class attached to a file. [Visual Basic] Public Function New( _ ByVal fileName As String _ ) [C#] public XlsFilter( string fileName ); 376 · C1.Win.C1Report Namespace [Delphi] public constructor Create( fileName: String ); Parameters fileName Full name of the file to be created. Remarks If the file already exists, the filter will open it and will add a new sheet with the report. See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter Properties The properties of the XlsFilter class are listed here. For a complete list of XlsFilter class members, see the XlsFilter Members topic. Public Properties Shading Prevents the filter from creating shaded areas on the sheet. SheetName Gets or sets the name of the worksheet to be used when saving the report into the Excel workbook file. See Also XlsFilter Class | C1.Win.C1Report Namespace XlsFilter.Shading Property Prevents the filter from creating shaded areas on the sheet. [Visual Basic] Public Property Shading As Boolean [C#] public bool Shading {get;set;} [Delphi] public property Shading: Boolean read get_Shading write set_Shading; See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter.SheetName Property Gets or sets the name of the worksheet to be used when saving the report into the Excel workbook file. [Visual Basic] Public Property SheetName As String [C#] public string SheetName {get;set;} XlsFilter Methods · 377 [Delphi] public property SheetName: String read get_SheetName write set_SheetName; Remarks You can use this property to save multiple reports into a single Excel workbook file, one on each sheet. See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter Methods The methods of the XlsFilter class are listed here. For a complete list of XlsFilter class members, see the XlsFilter Members topic. Public Methods Dispose Overriden. Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. EndReport Overriden. Called when the component finishes rendering a report. IsPaged Overriden. Determines whether this filter generates single or multi-page reports. NewPage (inherited from ExportFilter) Called after each page break on paged reports (see the IsPaged property). RenderField Overriden. Called when the component needs to render a report field with specific content at a specific position on the current page. StartOverlays (inherited from ExportFilter) Called after the component has finished rendering the first pass of the report, and before it starts rendering overlay fields. StartReport Overriden. Called when the component starts rendering a report. UsesImages Overriden. Returns a value that determines whether the filter uses page images. See Also XlsFilter Class | C1.Win.C1Report Namespace XlsFilter.Dispose Method Called when the component finishes rendering a report, or when the rendering process is canceled by the user or interrupted by an error. [Visual Basic] Overrides Public Sub Dispose() Implements IDisposable.Dispose [C#] override public void Dispose() 378 · C1.Win.C1Report Namespace [Delphi] public procedure Dispose(); override; Implements IDisposable.Dispose Remarks Use this method to free any disposable objects used by the filter. See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter.EndReport Method Called when the component finishes rendering a report. [Visual Basic] Overrides Public Sub EndReport() [C#] override public void EndReport() [Delphi] public procedure EndReport(); override; See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter.IsPaged Method Determines whether this filter generates single or multi-page reports. [Visual Basic] Overrides Public Function IsPaged() As Boolean [C#] override public bool IsPaged() [Delphi] public function IsPaged(): Boolean; override; Return Value Always returns False. See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter.RenderField Method Called when the component needs to render a report field with specific content at a specific position on the current page. XlsFilter.StartReport Method · 379 [Visual Basic] Overrides Public Sub RenderField( _ ByVal field As Field, _ ByVal rc As Rectangle, _ ByVal text As String, _ ByVal img As Image _ ) [C#] override public void RenderField( Field field, Rectangle rc, string text, Image img ); [Delphi] public procedure RenderField( field: Field; rc: Rectangle; text: String; img: Image ); override; Parameters field Field object to render. rc Rectangle that determines the field position on the page, in twips. text Field text to render. img Field image to render. See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter.StartReport Method Called when the component starts rendering a report. [Visual Basic] Overrides Public Sub StartReport( _ ByVal report As C1Report _ ) [C#] override public void StartReport( C1Report report ); 380 · C1.Win.C1Report Namespace [Delphi] public procedure StartReport( report: C1Report ); override; Parameters report Owner report. See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace XlsFilter.UsesImages Method Returns a value that determines whether the filter uses page images. [Visual Basic] Overrides Public Function UsesImages() As Boolean [C#] override public bool UsesImages() [Delphi] public function UsesImages(): Boolean; override; Return Value Always returns False. See Also XlsFilter Class | XlsFilter Members | C1.Win.C1Report Namespace Index · 381 Index 2 2 assembly (C1.Win.C1Report) 123, 125, 127, 129, 130, 131, 132, 133, 136, 137, 138, 139, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, 159, 161, 163, 166, 167, 168, 169, 170, 171, 172, 173, 175, 182, 183, 184, 185, 186, 187, 188, 189, 190, 192, 193, 194, 195, 197, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 217, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 257, 258, 259, 261, 262, 263, 264, 265, 266, 267, 269, 270, 271, 272, 273, 274, 276, 278, 279, 280, 281, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380 A Access enumeration member 278, 279 Across enumeration member 188 Add method 253, 273 AddOutlineEntry event 182 AddOutlineEntry method 208 AddOutlineEntryHandler delegate 129 AddScriptObject method 154 After enumeration member 263 Align property 219 AllButFirstPage enumeration member 319 AllPages enumeration member 279, 319 Anchor property 220 AnchorEnum enumeration 129 ApplyFilter method 293 ApplySort method 293 Ascending enumeration member 361 Author property 324 Auto enumeration member 311 B BackColor property 220, 345 BackStyleEnum enumeration 130 BarCode property 221 BarCodeEnum enumeration 131 Before enumeration member 263 BeforeAndAfter enumeration member 263 BeginInit method 155 BOF method 200, 294 BorderColor property 221 BorderStyle property 222 BorderStyleEnum enumeration 132 Bottom enumeration member 129, 130 Bounds property 222 C C1Report class 133 about C1Report class 132 all members 133 constructor 136 events 182 methods 152 properties 136 C1Report enumeration member 278, 279 C1Report hierarchy (C1.Win) 127 C1Report namespace (C1.Win) 125 C1Report.AddOutlineEntry event 182 C1Report.AddScriptObject method 154 C1Report.BeginInit method 155 C1Report.C1Report constructor 136 C1Report.Cancel property 137 C1Report.Clear method 155 C1Report.CopyFrom method 156 C1Report.DataSource property 138 C1Report.Dispose method 156 C1Report.Document property 139 C1Report.DoEvents property 139 C1Report.EndInit method 157 C1Report.EndPage event 183 C1Report.EndReport event 183 C1Report.EndSection event 184 C1Report.Evaluate method 157 C1Report.Execute method 158 C1Report.Fields property 141 C1Report.Font property 141 C1Report.GetReportInfo method 159 C1Report.GetReportList method 161 C1Report.Groups property 142 C1Report.GrowShrinkMode property 143 C1Report.InitializeParametersDialog event 184 C1Report.IsBusy property 143 C1Report.LabelOffset property 144 C1Report.Layout property 145 C1Report.Load method 163 C1Report.MaxPages property 145 C1Report.NoData event 184 C1Report.OnClose property 145 382 · Index C1Report.OnEndPage method 166 C1Report.OnEndReport method 166 C1Report.OnEndSection method 167 C1Report.OnError property 146 C1Report.OnNoData property 146 C1Report.OnNoReportData method 167 C1Report.OnOpen property 147 C1Report.OnPage property 147 C1Report.OnPrintSection method 168 C1Report.OnReportError method 168 C1Report.OnStartPage method 169 C1Report.OnStartReport method 169 C1Report.OnStartSection method 170 C1Report.OutlineRootLevel property 148 C1Report.Page property 148 C1Report.PageImages property 149 C1Report.ParentReport property 149 C1Report.ParseExpression method 170 C1Report.ParseStatement method 171 C1Report.PrintSection event 185 C1Report.Render method 172 C1Report.RenderToFile method 172 C1Report.RenderToFilter method 173 C1Report.RenderToStream method 173 C1Report.ReportDefinition property 149 C1Report.ReportError event 186 C1Report.ReportInfo property 150 C1Report.ReportName property 151 C1Report.Save method 175 C1Report.Sections property 152 C1Report.StartPage event 186 C1Report.StartReport event 187 C1Report.StartSection event 187 C1Report.Tag property 152 Calculated property 223 Cancel property 137 CanGrow property 223, 345 CanShrink property 224, 346 CenterBottom enumeration member 249, 317 CenterMiddle enumeration member 249, 317 CenterTop enumeration member 249, 317 CheckBox enumeration member 187, 188 CheckBox property 224 CheckBoxEnum enumeration 187 Clear method 155, 326 Clip enumeration member 317, 318 Clone method 247, 327 Codabar enumeration member 131 Code128 enumeration member 131 Code39 enumeration member 131 Code93 enumeration member 131 CodeI2of5 enumeration member 131 ColumnLayout property 301 ColumnLayoutEnum enumeration 188 Columns property 301 CommandTimeOut property 194 ConnectionString property 195 Contains method 257, 274, 358 CopyFrom method 156 CopyTo method 258, 276, 359 Count property 251, 271, 354 Creator property 325 CrossBox enumeration member 187, 188 CustomHeight property 301 CustomWidth property 302 D Dash enumeration member 132 DashDot enumeration member 132 DashDotDot enumeration member 132 DataAccessException class 189 about DataAccessException class 189 all members 189 constructor 190 DataAccessException.DataAccessException constructor 190 DataSource class 193 about DataSource class 192 all members 193 methods 199 properties 194 DataSource property 138 DataSource.BOF method 200 DataSource.CommandTimeOut property 194 DataSource.ConnectionString property 195 DataSource.EOF method 200 DataSource.Filter property 195 DataSource.GetBookmark method 200 DataSource.GetFieldValue method 201 DataSource.GetRecordSource method 201 DataSource.MaxRecords property 197 DataSource.MoveFirst method 202 DataSource.MoveLast method 202 DataSource.MoveNext method 202 DataSource.MovePrevious method 203 DataSource.ParentReport property 197 DataSource.Recordset property 197 DataSource.RecordSource property 199 DataSource.SetBookmark method 203 DataSource.ToString method 204 Descending enumeration member 361 Detail enumeration member 360 Detail property 355 Dialog field 205 DialogEventArgs class 204 about DialogEventArgs class 204 all members 204 fields 205 DialogEventArgs.Dialog field 205 DialogEventHandler delegate 205 Dispose method 156, 209, 286, 333, 366, 377 Index · 383 Document property 139 DoEvents property 139 Dot enumeration member 132 Down enumeration member 188, 310, 311, 361, 362 DrillDown property 284 E Ean13 enumeration member 131 Ean8 enumeration member 131 EmbedFonts property 314 EmbedPictures property 331 EncodeHtml property 284 EndInit method 157 EndPage event 183 EndReport event 183 EndReport method 209, 287, 316, 333, 366, 373, 378 EndSection event 184 EndSection method 210, 287 EOF method 200, 294 Evaluate method 157 Excel enumeration member 261, 262 Exception field 321 Execute method 158 ExportFilter class 206 about ExportFilter class 206 all members 206 constructor 207 methods 207 ExportFilter.AddOutlineEntry method 208 ExportFilter.Dispose method 209 ExportFilter.EndReport method 209 ExportFilter.EndSection method 210 ExportFilter.ExportFilter constructor 207 ExportFilter.IsPaged method 210 ExportFilter.NewPage method 211 ExportFilter.RenderField method 211 ExportFilter.StartOverlays method 212 ExportFilter.StartReport method 212 ExportFilter.StartSection method 213 ExportFilter.UsesImages method 213 F Field class 214 about Field class 214 all members 214 constructor 217 methods 246 properties 217 Field.Align property 219 Field.Anchor property 220 Field.BackColor property 220 Field.BarCode property 221 Field.BorderColor property 221 Field.BorderStyle property 222 Field.Bounds property 222 Field.Calculated property 223 Field.CanGrow property 223 Field.CanShrink property 224 Field.CheckBox property 224 Field.Clone method 247 Field.Field constructor 217 Field.Font property 225 Field.ForcePageBreak property 225 Field.ForeColor property 225 Field.Format property 226 Field.GetRenderContent method 247 Field.Height property 227 Field.HideDuplicates property 227 Field.Index property 228 Field.KeepTogether property 228 Field.Left property 229 Field.LineSlant property 229 Field.LineSpacing property 229 Field.LineWidth property 230 Field.LinkTarget property 230 Field.LinkValue property 231 Field.Location property 232 Field.MarginBottom property 232 Field.MarginLeft property 232 Field.MarginRight property 233 Field.MarginTop property 233 Field.Name property 234 Field.ParentReport property 234 Field.ParentSection property 235 Field.Picture property 235 Field.PictureAlign property 236 Field.PictureScale property 236 Field.RenderHeight property 237 Field.RenderTop property 237 Field.RTF property 238 Field.RunningSum property 238 Field.Section property 239 Field.SetZOrder method 248 Field.Size property 240 Field.Subreport property 240 Field.SubreportHasData property 241 Field.Tag property 242 Field.Text property 242 Field.TextDirection property 243 Field.Top property 243 Field.ToString method 248 Field.Value property 244 Field.Visible property 245 Field.Width property 245 Field.WordWrap property 245 Field.ZOrder property 246 FieldAlignEnum enumeration 249 FieldCollection class 250 about FieldCollection class 250 all members 250 384 · Index methods 252 properties 250 FieldCollection.Add method 253 FieldCollection.Contains method 257 FieldCollection.CopyTo method 258 FieldCollection.Count property 251 FieldCollection.Item property 251 FieldCollection.Remove method 259 FieldCollection.RemoveAt method 261 Fields property 141, 346 FileFormatEnum enumeration 261 Filter property 195 FirstPage enumeration member 319 Font property 141, 225 Footer enumeration member 360 Footer property 355 ForcePageBreak property 225, 347 ForcePageBreakEnum enumeration 263 ForeColor property 225 Format property 226 G General enumeration member 249 GetBookmark method 200, 295 GetFieldNames method 295 GetFieldTypes method 295 GetFieldValue method 201, 296 GetRecordSource method 201 GetRenderContent method 247 GetReportInfo method 159 GetReportList method 161 GetRTFFont method 333 Group class 264 about Group class 263 all members 264 methods 269 properties 264 Group.GroupBy property 265 Group.KeepTogether property 266 Group.Move method 269 Group.Name property 266 Group.ParentReport property 267 Group.SectionFooter property 267 Group.SectionHeader property 267 Group.Sort property 267 Group.Tag property 269 GroupBy property 265 GroupCollection class 270 about GroupCollection class 270 all members 270 methods 273 properties 271 GroupCollection.Add method 273 GroupCollection.Contains method 274 GroupCollection.CopyTo method 276 GroupCollection.Count property 271 GroupCollection.Item property 271 GroupCollection.Remove method 276 GroupFooter1 enumeration member 360 GroupFooter2 enumeration member 360 GroupFooter3 enumeration member 360 GroupFooter4 enumeration member 360 GroupHeader1 enumeration member 360 GroupHeader2 enumeration member 360 GroupHeader3 enumeration member 360 GroupHeader4 enumeration member 360 Groups property 142 GrowShrinkMode property 143 GrowShrinkModeEnum enumeration 278 H Handled field 321 HdrFtrEnum enumeration 279 Header enumeration member 360 Header property 355 Height property 227, 347 Hide enumeration member 318 HideDuplicates property 227 HTML enumeration member 261, 262 HTMLDrillDown enumeration member 261, 262 HtmlFilter class 280 about HtmlFilter class 279 all members 280 constructor 281 methods 286 properties 283 HtmlFilter.Dispose method 286 HtmlFilter.DrillDown property 284 HtmlFilter.EncodeHtml property 284 HtmlFilter.EndReport method 287 HtmlFilter.EndSection method 287 HtmlFilter.HtmlFilter constructor 281 HtmlFilter.IsPaged method 287 HtmlFilter.MultiFile property 285 HtmlFilter.NewPage method 288 HtmlFilter.Paged property 285 HtmlFilter.RenderField method 288 HtmlFilter.StartCollapsed property 285 HtmlFilter.StartOverlays method 289 HtmlFilter.StartReport method 290 HtmlFilter.StartSection method 290 HtmlFilter.UsesImages method 291 HTMLPaged enumeration member 261, 262 I IC1ReportRecordset interface 292 about IC1ReportRecordset interface 291 all members 292 methods 292 Index · 385 IC1ReportRecordset.ApplyFilter method 293 IC1ReportRecordset.ApplySort method 293 IC1ReportRecordset.BOF method 294 IC1ReportRecordset.EOF method 294 IC1ReportRecordset.GetBookmark method 295 IC1ReportRecordset.GetFieldNames method 295 IC1ReportRecordset.GetFieldTypes method 295 IC1ReportRecordset.GetFieldValue method 296 IC1ReportRecordset.MoveFirst method 296 IC1ReportRecordset.MoveLast method 296 IC1ReportRecordset.MoveNext method 297 IC1ReportRecordset.MovePrevious method 297 IC1ReportRecordset.SetBookmark method 297 Index property 228 InitializeParametersDialog event 184 IsBusy property 143 IsPaged method 210, 287, 334, 366, 378 Item property 251, 271, 356 J JustBottom enumeration member 249 JustMiddle enumeration member 249 JustTop enumeration member 249 K KeepFirstDetail enumeration member 298 KeepNothing enumeration member 298 KeepTogether property 228, 266, 348 KeepTogetherEnum enumeration 298 KeepWholeGroup enumeration member 298 Keywords property 325 L LabelOffset property 144 Labels enumeration member 188, 189 LabelSpacingX property 303 LabelSpacingY property 303 Landscape enumeration member 311 Layout class 299 about Layout class 298 all members 299 methods 309 properties 300 Layout property 145 Layout.ColumnLayout property 301 Layout.Columns property 301 Layout.CustomHeight property 301 Layout.CustomWidth property 302 Layout.LabelSpacingX property 303 Layout.LabelSpacingY property 303 Layout.MarginBottom property 304 Layout.MarginLeft property 304 Layout.MarginRight property 304 Layout.MarginTop property 305 Layout.Orientation property 305 Layout.PageFooter property 305 Layout.PageHeader property 306 Layout.PaperSize property 306 Layout.ParentReport property 307 Layout.Picture property 307 Layout.PictureAlign property 307 Layout.PictureScale property 308 Layout.PictureShow property 308 Layout.ToString method 310 Layout.UpdateFromPrintDoc method 310 Layout.Width property 309 Left property 229 LeftBottom enumeration member 249, 317, 318 LeftMiddle enumeration member 249, 317, 318 LeftTop enumeration member 249, 317, 318 LineSlant property 229 LineSlantEnum enumeration 310 LineSpacing property 229 LineWidth property 230 LinkTarget property 230 LinkValue property 231 Load method 163 Location property 232 M MarginBottom property 232, 304 MarginLeft property 232, 304, 331 MarginRight property 233, 304 MarginTop property 233, 305, 331 MaxPages property 145 MaxRecords property 197 Move method 269 MoveFirst method 202, 296 MoveLast method 202, 296 MoveNext method 202, 297 MovePrevious method 203, 297 MSWord enumeration member 341, 342 MultiFile property 285 N Name property 234, 266, 349 NewPage method 211, 288, 334, 367 NoCheckBox enumeration member 187, 188 NoData event 184 NoLine enumeration member 310, 311 None enumeration member 131, 263 NoPages enumeration member 319 Normal enumeration member 361, 362 NoRunningSum enumeration member 342 NoSlant enumeration member 310, 311 NoSort enumeration member 361 NotWithReportFtr enumeration member 279 386 · Index NotWithReportHdr enumeration member 279 NotWithReportHdrFtr enumeration member 279 O OnClose property 145 OnEndPage method 166 OnEndReport method 166 OnEndSection method 167 OnError property 146 OnFormat property 349 OnNoData property 146 OnNoReportData method 167 OnOpen property 147 OnPage property 147 OnPrint property 350 OnPrintSection method 168 OnReportError method 168 OnStartPage method 169 OnStartReport method 169 OnStartSection method 170 Opaque enumeration member 130 Orientation property 305 OrientationEnum enumeration 311 Outline property 315 OutlineRootLevel property 148 P Page field 322 Page property 148 PageAfter enumeration member 263 PageBefore enumeration member 263 Paged property 285, 365 PageFooter enumeration member 360 PageFooter property 305, 357 PageHeader enumeration member 360 PageHeader property 306, 358 PageImages property 149 PaperSize property 306 ParentReport property 149, 197, 234, 267, 307, 351 ParentSection property 235 ParseExpression method 170 ParseStatement method 171 Password property 315 PDF enumeration member 261, 262 PDFEmbedFonts enumeration member 261, 262 PdfFilter class 312 about PdfFilter class 312 all members 312 constructor 313 methods 316 properties 314 PdfFilter.EmbedFonts property 314 PdfFilter.EndReport method 316 PdfFilter.Outline property 315 PdfFilter.Password property 315 PdfFilter.PdfFilter constructor 313 PdfFilter.StartReport method 316 PDFPrintUtil enumeration member 261, 262 PDFProtected enumeration member 261, 262 Picture property 235, 307 PictureAlign property 236, 307 PictureAlignEnum enumeration 317 PictureScale property 236, 308 PictureScaleEnum enumeration 318 PictureShow property 308 PictureShowEnum enumeration 319 Portable enumeration member 341, 342 Portrait enumeration member 311 PostNet enumeration member 131 PrintSection event 185 R RadioButton enumeration member 187, 188 Recordset property 197 RecordSource property 199 Remove method 259, 276 RemoveAt method 261 Render method 172 RenderField method 211, 288, 335, 340, 367, 378 RenderHeight property 237, 351 RenderToFile method 172 RenderToFilter method 173 RenderTop property 237 RenderToStream method 173 Repeat property 351 ReportDefinition property 149 ReportError event 186 ReportEventArgs class 320 about ReportEventArgs class 320 all members 320 fields 320 ReportEventArgs.Exception field 321 ReportEventArgs.Handled field 321 ReportEventArgs.Page field 322 ReportEventArgs.Section field 322 ReportEventArgs.Text field 322 ReportEventHandler delegate 323 ReportInfo class 323, 324 about ReportInfo class 323 all members 324 methods 326 properties 324 ReportInfo property 150 ReportInfo.Author property 324 ReportInfo.Clear method 326 ReportInfo.Clone method 327 ReportInfo.Creator property 325 ReportInfo.Keywords property 325 ReportInfo.Subject property 325 Index · 387 ReportInfo.Title property 326 ReportInfo.ToString method 327 ReportName property 151 Resolution property 372 RightBottom enumeration member 249, 317, 318 RightMiddle enumeration member 249, 317, 318 RightTop enumeration member 249, 317, 318 RTF enumeration member 261, 262 RTF property 238 RtfFilter class 328 about RtfFilter class 327 all members 328 constructor 329 methods 332 properties 330 RtfFilter.Dispose method 333 RtfFilter.EmbedPictures property 331 RtfFilter.EndReport method 333 RtfFilter.GetRTFFont method 333 RtfFilter.IsPaged method 334 RtfFilter.MarginLeft property 331 RtfFilter.MarginTop property 331 RtfFilter.NewPage method 334 RtfFilter.RenderField method 335 RtfFilter.RtfFilter constructor 329 RtfFilter.RtfTarget property 331 RtfFilter.StartOverlays method 336 RtfFilter.StartReport method 336 RtfFilter.StreamWriter property 332 RtfFilter.UsesImages method 336 RtfLabelFilter class 337 about RtfLabelFilter class 337 all members 337 constructor 338 methods 340 properties 340 RtfLabelFilter.RenderField method 340 RtfLabelFilter.RtfLabelFilter constructor 338 RTFLabels enumeration member 261, 262 RtfTarget property 331 RtfTargetEnum enumeration 341 RunningSum property 238 RunningSumEnum enumeration 342 S Save method 175 Scale enumeration member 318 Section class 343 about Section class 342 all members 343 properties 344 Section field 322 Section property 239 Section.BackColor property 345 Section.CanGrow property 345 Section.CanShrink property 346 Section.Fields property 346 Section.ForcePageBreak property 347 Section.Height property 347 Section.KeepTogether property 348 Section.Name property 349 Section.OnFormat property 349 Section.OnPrint property 350 Section.ParentReport property 351 Section.RenderHeight property 351 Section.Repeat property 351 Section.Tag property 352 Section.Type property 352 Section.Visible property 352 SectionCollection class 353 about SectionCollection class 353 all members 353 methods 358 properties 354 SectionCollection.Contains method 358 SectionCollection.CopyTo method 359 SectionCollection.Count property 354 SectionCollection.Detail property 355 SectionCollection.Footer property 355 SectionCollection.Header property 355 SectionCollection.Item property 356 SectionCollection.PageFooter property 357 SectionCollection.PageHeader property 358 SectionFooter property 267 SectionHeader property 267 Sections property 152 SectionTypeEnum enumeration 360 SetBookmark method 203, 297 SetZOrder method 248 Shading property 376 SheetName property 376 Size property 240 Solid enumeration member 132 Sort property 267 SortEnum enumeration 361 StartCollapsed property 285 StartOverlays method 212, 289, 336, 368 StartPage event 186 StartReport event 187 StartReport method 212, 290, 316, 336, 368, 373, 379 StartSection event 187 StartSection method 213, 290 StreamWriter property 332 Stretch enumeration member 317, 318, 319 Subject property 325 Subreport property 240 SubreportHasData property 241 SumOverAll enumeration member 342 SumOverGroup enumeration member 342 388 · Index T Tag property 152, 242, 269, 352 Text enumeration member 261, 262 Text field 322 Text property 242 TextDirection property 243 TextDirectionEnum enumeration 361 TextFilter class 363 about TextFilter class 362 all members 363 constructor 363 methods 365 properties 365 TextFilter.Dispose method 366 TextFilter.EndReport method 366 TextFilter.IsPaged method 366 TextFilter.NewPage method 367 TextFilter.Paged property 365 TextFilter.RenderField method 367 TextFilter.StartOverlays method 368 TextFilter.StartReport method 368 TextFilter.TextFilter constructor 363 TextFilter.UsesImages method 369 TextSinglePage enumeration member 261, 262 TIFF enumeration member 261, 263 TiffFilter class 370 about TiffFilter class 369 all members 370 constructor 371 methods 373 properties 372 TiffFilter.EndReport method 373 TiffFilter.Resolution property 372 TiffFilter.StartReport method 373 TiffFilter.TiffFilter constructor 371 Tile enumeration member 317, 318, 319 Title property 326 Top enumeration member 129, 130 Top property 243 TopAndBottom enumeration member 129, 130 ToString method 204, 248, 310, 327 Transparent enumeration member 130, 132 Type property 352 U Undefined enumeration member 360 Up enumeration member 310, 311, 361, 362 UpdateFromPrintDoc method 310 UsesImages method 213, 291, 336, 369, 380 V Value property 244 VBScript 69 Visible property 245, 352 W Width property 245, 309 WordWrap property 245 X XlsFilter class 374 about XlsFilter class 374 all members 374 constructor 375 methods 377 properties 376 XlsFilter.Dispose method 377 XlsFilter.EndReport method 378 XlsFilter.IsPaged method 378 XlsFilter.RenderField method 378 XlsFilter.Shading property 376 XlsFilter.SheetName property 376 XlsFilter.StartReport method 379 XlsFilter.UsesImages method 380 XlsFilter.XlsFilter constructor 375 Z Zoom enumeration member 317, 318 ZOrder property 246