+'''
+'''
+
+
+ EmailExport export = new EmailExport();
+ export.Account.Address = "my@address.net";
+ export.Account.Host = "myhost";
+ export.Address = "recipient@address.net";
+ export.Subject = "Re: analysis report";
+ // the report1 report must be prepared at this moment
+ export.SendEmail(report1);
+
+ TextExport.Encoding = Encoding.Default;
+ Unicode UTF-8 encoding
+ TextExport.Encoding = Encoding.UTF8;
+ OEM encoding for current system locale sessings
+ TextExport.Encoding = Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
+
+ TextExportPrint.PrintStream("EPSON FX-1000", "My Report", 1, txtStream)
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+
+
+ // register own cloud storage client
+ RegisteredObjects.AddCloud(typeof(MyCloud), "My Cloud");
+
+
+ // register own messenger
+ RegisteredObjects.AddMessenger(typeof(MyMessenger), "My Messenger");
+
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+
+
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+
+
+ // register data connection
+ RegisteredObjects.AddConnection(typeof(MyDataConnection), "My Data Connection");
+
+
+ // register the report object
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage", myReportObjectBmp, "My Report Object");
+ // register the dialog control
+ RegisteredObjects.Add(typeof(MyDialogControl), "DialogPage", myDialogControlBmp, "My Dialog Control");
+ // add a category and register an object inside it
+ RegisteredObjects.AddCategory("ReportPage,MyCategory", myCategoryBmp, "My Category");
+ // register another report object in MyCategory
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage,MyCategory",
+ anotherReportObjectBmp, "Another Report Object");
+
+
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+
+ public static class MyFunctions
+ {
+ /// <summary>
+ /// Converts a specified string to uppercase.
+ /// </summary>
+ /// <param name="s">The string to convert.</param>
+ /// <returns>A string in uppercase.</returns>
+ public static string MyUpperCase(string s)
+ {
+ return s == null ? "" : s.ToUpper();
+ }
+
+ /// <summary>
+ /// Returns the larger of two 32-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static int MyMaximum(int val1, int val2)
+ {
+ return Math.Max(val1, val2);
+ }
+
+ /// <summary>
+ /// Returns the larger of two 64-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static long MyMaximum(long val1, long val2)
+ {
+ return Math.Max(val1, val2);
+ }
+ }
+
+ // register a category
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+ // obtain MethodInfo for our functions
+ Type myType = typeof(MyFunctions);
+ MethodInfo myUpperCaseFunc = myType.GetMethod("MyUpperCase");
+ MethodInfo myMaximumIntFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(int), typeof(int) });
+ MethodInfo myMaximumLongFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(long), typeof(long) });
+
+ // register simple function
+ RegisteredObjects.AddFunction(myUpperCaseFunc, "MyFuncs");
+
+ // register overridden functions
+ RegisteredObjects.AddFunction(myMaximumIntFunc, "MyFuncs,MyMaximum");
+ RegisteredObjects.AddFunction(myMaximumLongFunc, "MyFuncs,MyMaximum");
+
+
+ <Objects>
+ <Report Text="Report"/>
+ <Bands Text="Bands">
+ <ReportTitle Text="Report Title"/>
+ </Bands>
+ </Objects>
+
+ To get the localized "ReportTitle" value, you should pass the following ID
+ to this method: "Objects,Bands,ReportTitle".
+
+ Res.Set("Messages,SaveChanges", "My text that will appear when you close the designer");
+
+
+ <?xml version="1.0" encoding="utf-8"?>
+ <Config>
+ <Plugins>
+ <Plugin Name="c:\Program Files\MyProgram\MyPlugin.dll"/>
+ </Plugins>
+ </Config>
+
+ When you run your application and use the Report object first time, all plugins will be loaded.
+ To register objects contained in a plugin, FastReport searches for classes of type
+ AssemblyInitializerBase and instantiates them.
+
+ public class MyAssemblyInitializer : AssemblyInitializerBase
+ {
+ public MyAssemblyInitializer()
+ {
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+ }
+ }
+
+
+ FastNameCreator nameCreator = new FastNameCreator(Report.AllObjects);
+ foreach (Base c in Report.AllObjects)
+ {
+ if (c.Name == "")
+ nameCreator.CreateUniqueName(c);
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Serialize(FRWriter writer)
+ {
+ // get the etalon object. It will be used to write changed properties only.
+ Base c = writer.DiffObject as Base;
+
+ // write the type name
+ writer.ItemName = ClassName;
+
+ // write properties
+ if (Name != "")
+ writer.WriteStr("Name", Name);
+ if (Restrictions != c.Restrictions)
+ writer.WriteValue("Restrictions", Restrictions);
+
+ // write child objects if allowed
+ if (writer.SaveChildren)
+ {
+ foreach (Base child in ChildObjects)
+ {
+ writer.Write(child);
+ }
+ }
+ }
+
+
+ // using the Res.Get method
+ miKeepTogether = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,RepeatOnEveryPage"));
+
+ // using MyRes.Get method
+ MyRes res = new MyRes("ComponentMenu,HeaderBand");
+ miKeepTogether = new ToolStripMenuItem(res.Get("KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(res.Get("ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(res.Get("RepeatOnEveryPage"));
+
+
+
+ foreach (AdvancedTextRenderer.Paragraph paragraph in renderer.Paragraphs)
+ {
+ foreach (AdvancedTextRenderer.Line line in paragraph.Lines)
+ {
+ foreach (AdvancedTextRenderer.Word word in line.Words)
+ {
+ if (renderer.HtmlTags)
+ {
+ foreach (AdvancedTextRenderer.Run run in word.Runs)
+ {
+ using (Font f = run.GetFont())
+ using (Brush b = run.GetBrush())
+ {
+ g.DrawString(run.Text, f, b, run.Left, run.Top, renderer.Format);
+ }
+ }
+ }
+ else
+ {
+ g.DrawString(word.Text, renderer.Font, renderer.Brush, word.Left, word.Top, renderer.Format);
+ }
+ }
+ }
+ }
+
+ valueInMillimeters = valueInPixels / Units.Millimeters;
+ To convert millimeters to pixels, use the following code:
+ valueInPixels = valueInMillimeters * Units.Millimeters;
+ inches = pixels / SizeUnitsP.Inch;
+ To convert inches to pixels, use the code:
+ pixels = inches * SizeUnitsP.Inch;
+ inches = millimeters / SizeUnitsM.Inch;
+ To convert inches to millimeters, use the code:
+ millimeters = inches * SizeUnitsM.Inch;
+
+ report1.Preview = previewControl1;
+ report1.Show();
+
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+
+ barcode.SymbologyName = "PDF417";
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+ Represents a 2D matrix of bits. In function arguments below, and throughout the common + module, x is the column position, and y is the row position. The ordering is always x, y. + The origin is at the top-left.
+Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins + with a new int. This is done intentionally so that we can copy out a row into a BitArray very + efficiently.
+The ordering of bits is row-major. Within each int, the least significant bits are used first, + meaning they represent lower x values. This is compatible with BitArray's implementation.
+Gets the requested bit, where true means black.
+ +Flips the given bit.
+ +Sets a square region of the bit matrix to true.
+ +This class contains utility methods for performing mathematical operations over + the Galois Fields. Operations use a given primitive polynomial in calculations.
+Throughout this package, elements of the GF are represented as an {@code int} + for convenience and speed (but at the cost of memory). +
+Represents a polynomial whose coefficients are elements of a GF. + Instances of this class are immutable.
+Much credit is due to William Rucklidge since portions of this code are an indirect + port of his C++ Reed-Solomon implementation.
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+
+
+ BarcodeObject barcode;
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+ barcode.Text = "&C;1234&A;ABC";
+
+ 1.
+
+ @return the position of this MaxiCode symbol in a series of symbols using structured append
+ 1.
+
+ @return size of the series that this symbol is part of
+ | Characters | Meaning |
|---|---|
| 1-9 | Postal code data which can consist of up to 9 digits (for mode 2) or up to 6 + alphanumeric characters (for mode 3). Remaining unused characters should be + filled with the SPACE character (ASCII 32). |
| 10-12 | Three-digit country code according to ISO-3166. |
| 13-15 | Three digit service code. This depends on your parcel courier. |
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = PDF417CompactionMode.Text;
+
+
+ Report report1;
+ XmlDataConnection conn = new XmlDataConnection();
+ conn.XmlFile = @"c:\data.xml";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = "Table1";
+ conn.Tables.Add(table);
+
+
+ TableDataSource ds = report.GetDataSource("My DataSource Name") as TableDataSource;
+ ds.Parameters[0].Value = 10;
+
+ This way is not good because you hardcode the report object's name.
+
+ Report report1;
+ DataSourceBase customersTable = report1.Dictionary.DataSources.FindByAlias("Customers");
+ DataSourceBase ordersTable = report1.Dictionary.DataSources.FindByAlias("Orders");
+ Relation rel = new Relation();
+ rel.Name = "customersOrders";
+ rel.ParentDataSource = customersTable;
+ rel.ChildDataSource = ordersTable;
+ rel.ParentColumns = new string[] { "CustomerID" };
+ rel.ChildColumns = new string[] { "CustomerID" };
+ report1.Dictionary.Relations.Add(rel);
+
+
+ Report report1;
+ OleDbDataConnection conn = new OleDbDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ OdbcDataConnection conn = new OdbcDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsSqlDataConnection conn = new MsSqlDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder(oleDbConnection1.ConnectionString);
+ builder.PersistSecurityInfo = false;
+ oleDbConnection1.ConnectionString = builder.ToString();
+
+
+ public override Type GetConnectionType()
+ {
+ return typeof(OleDbConnection);
+ }
+
+
+ public override DbDataAdapter GetAdapter(string selectCommand, DbConnection connection,
+ CommandParameterCollection parameters)
+ {
+ OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand, connection as OleDbConnection);
+ foreach (CommandParameter p in parameters)
+ {
+ OleDbParameter parameter = adapter.SelectCommand.Parameters.Add(p.Name, (OleDbType)p.DataType, p.Size);
+ parameter.Value = p.Value;
+ }
+ return adapter;
+ }
+
+
+ Report report1;
+ CsvDataConnection conn = new CsvDataConnection();
+ conn.CsvFile = @"c:\data.csv";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ dataSource.Init();
+ while (dataSource.HasMoreRows)
+ {
+ // do something...
+ dataSource.Next();
+ }
+
+
+ Report report1;
+ Parameter par = new Parameter();
+ par.Name = report1.Dictionary.CreateUniqueName("Parameter");
+ report1.Parameters.Add(par);
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = report1.Dictionary.CreateUniqueName("EmployeesTable");
+ table.Alias = report1.Dictionary.CreateUniqueAlias("Employees");
+ conn.Tables.Add(table);
+
+
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 108, "Objects,Shapes,Rectangle", 0);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 109, "Objects,Shapes,RoundRectangle", 1);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 110, "Objects,Shapes,Ellipse", 2);
+
+
+ public override void OnBeforeInsert(int flags)
+ {
+ FShape = (ShapeKind)flags;
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+
+
+ Report report1;
+ ReportPage page = new ReportPage();
+ page.Parent = report1;
+
+ public DataHeaderBand Header
+ {
+ get { return FHeader; }
+ set
+ {
+ SetProp(FHeader, value);
+ FHeader = value;
+ }
+ }
+
+ <TextObject Name="Text2" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+
+
+ <DataBand Name="Data1" Top="163" Width="718.2" Height="18.9">
+ <TextObject Name="Text3" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+ </DataBand>
+
+
+ protected override void DeserializeSubItems(FRReader reader)
+ {
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else
+ base.DeserializeSubItems(reader);
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+ if (text1 != null)
+ {
+ // object found
+ }
+
+
+ TextObject textObj = new TextObject();
+ dataBand1.Objects.Add(textObj);
+ textObj.CreateUniqueName();
+
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings, do not copy report objects
+ report2.Assign(report1);
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings and objects
+ report2.AssignAll(report1);
+
+ public void OnBeforePrint(EventArgs e)
+ {
+ if (BeforePrint != null)
+ BeforePrint(this, e);
+ InvokeEvent(BeforePrintEvent, e);
+ }
+
+ TextObject text1;
+ // set Height to 10mm
+ text1.Height = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Height = " + (text1.Height / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Left to 10mm
+ text1.Left = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Left = " + (text1.Left / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Top to 10mm
+ text1.Top = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Top = " + (text1.Top / Units.Millimeters).ToString() + "mm");
+
+ private void Data1_BeforePrint(object sender, EventArgs e)
+ {
+ Text1.Visible = [Orders.Shipped] == true;
+ }
+
+ TextObject text1;
+ // set Width to 10mm
+ text1.Width = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Width = " + (text1.Width / Units.Millimeters).ToString() + "mm");
+
+ frmPopup popup = new frmPopup();
+ Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
+ popupHelper.ShowPopup(this, popup, location);
+
+
+ Designer designer = new Designer();
+ designer.Parent = form1;
+ designer.Report = report1;
+
+
+ DesignerControl designer = new DesignerControl();
+ designer.MdiMode = true;
+ designer.ShowDialog();
+
+
+ // add an event handler that will be fired when the designer is run
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ // override "New..." command behavior
+ (sender as Designer).cmdNew.CustomAction += new EventHandler(cmdNew_CustomAction);
+ }
+
+ void cmdNew_CustomAction(object sender, EventArgs e)
+ {
+ // show the "Label" wizard instead of standard "Add New Item" dialog
+ Designer designer = sender as Designer;
+ LabelWizard wizard = new LabelWizard();
+ wizard.Run(designer);
+ }
+
+
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ Config.DesignerSettings.PageAdded += new EventHandler(DesignerSettings_PageAdded);
+
+ void DesignerSettings_PageAdded(object sender, EventArgs e)
+ {
+ if (sender is ReportPage)
+ (sender as ReportPage).TopMargin = 0;
+ }
+
+
+ Config.DesignerSettings.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ Config.DesignerSettings.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ Config.DesignerSettings.AddCustomConnection(typeof(MsAccessDataConnection), @"Data Source=c:\data.mdb");
+
+
+ public void SaveState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ xi.SetProp("ShowGrid", DialogWorkspace.ShowGrid ? "1" : "0");
+ }
+
+
+ public void RestoreState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ DialogWorkspace.ShowGrid = xi.GetProp("ShowGrid") != "0";
+ }
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ MessagesWindow window = designer.Plugins.Find("MessagesWindow") as MessagesWindow;
+
+
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ Designer designer;
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolWindow));
+
+
+ Designer designer;
+ DesignerMenu menu = designer.Plugins.FindType("DesignerMenu") as DesignerMenu;
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ environmentSettings1.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ environmentSettings1.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ environmentSettings1.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ ReportPage page = report.Pages[0] as ReportPage;
+
+ // create the main group
+ GroupHeaderBand mainGroup = new GroupHeaderBand();
+ mainGroup.Height = Units.Millimeters * 10;
+ mainGroup.Name = "MainGroup";
+ mainGroup.Condition = "[Orders.CustomerName]";
+ // add a group to the page
+ page.Bands.Add(mainGroup);
+
+ // create the nested group
+ GroupHeaderBand nestedGroup = new GroupHeaderBand();
+ nestedGroup.Height = Units.Millimeters * 10;
+ nestedGroup.Name = "NestedGroup";
+ nestedGroup.Condition = "[Orders.OrderDate]";
+ // add it to the main group
+ mainGroup.NestedGroup = nestedGroup;
+
+ // create a data band
+ DataBand dataBand = new DataBand();
+ dataBand.Height = Units.Millimeters * 10;
+ dataBand.Name = "GroupData";
+ dataBand.DataSource = report.GetDataSource("Orders");
+ // connect the databand to the nested group
+ nestedGroup.Data = dataBand;
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.NestedGroup = new GroupHeaderBand();
+ group.NestedGroup.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ myPictureObject.Image = new Bitmap("file.bmp");
+ myPictureObject.ShouldDisposeImage = true;
+
+
+ Config.PreviewSettings.Buttons = PreviewButtons.Open |
+ PreviewButtons.Save |
+ PreviewButtons.Find |
+ PreviewButtons.Zoom |
+ PreviewButtons.Outline |
+ PreviewButtons.PageSetup |
+ PreviewButtons.Edit |
+ PreviewButtons.Watermark |
+ PreviewButtons.Navigator |
+ PreviewButtons.Close;
+
+
+ Report report = new Report();
+ report.Load("reportfile.frx");
+ report.RegisterData(application_dataset);
+ report.Show();
+
+
+ Report report = new Report();
+ // create the report page
+ ReportPage page = new ReportPage();
+ page.Name = "ReportPage1";
+ // set paper width and height. Note: these properties are measured in millimeters.
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // add a page to the report
+ report.Pages.Add(page);
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create Text object and put it to the title
+ TextObject text = new TextObject();
+ text.Name = "Text1";
+ text.Bounds = new RectangleF(0, 0, Units.Millimeters * 100, Units.Millimeters * 5);
+ page.ReportTitle.Objects.Add(text);
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to a page
+ page.Bands.Add(data);
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ ReportPage page1 = report1.Pages[0] as ReportPage;
+
+
+ using System.Security;
+ using System.Security.Permissions;
+ ...
+ PermissionSet ps = new PermissionSet(PermissionState.None);
+ ps.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
+ report1.ScriptRestrictions = ps;
+ report1.Prepare();
+
+
+ SimpleListReport report = new SimpleListReport();
+ report.RegisterData(your_dataset);
+ report.Show();
+
+
+ string employeeName = (string)report.GetColumnValue("Employees.FirstName");
+
+
+ // load the report
+ report1.Load("report.frx");
+ // setup the parameter
+ report1.SetParameterValue("MyParam", 10);
+ // show the report
+ report1.Show();
+
+ report.AddReferencedAssembly("Newtonsoft.Json.dll")
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind", true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1.Tables["Orders"], "Orders");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataView, "OrdersView");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataRelation, "myRelation");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myBusinessObject, "Customers");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myCubeLink, "Orders");
+
+
+ Report report = new Report();
+ report.Load("report1.frx");
+ report.Prepare();
+ report.Load("report2.frx");
+ report.Prepare(true);
+ report.ShowPrepared();
+
+
+ textObject1.Fill = new SolidFill(Color.Green);
+ (textObject1.Fill as SolidFill).Color = Color.Red;
+
+ reportComponent1.Fill = new SolidFill(color);
+
+ ReportPage page = new ReportPage();
+ // set the paper in millimeters
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to the page
+ page.Bands.Add(data);
+ // add page to the report
+ report.Pages.Add(page);
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ // create the main report page
+ ReportPage reportPage = new ReportPage();
+ reportPage.Name = "Page1";
+ report.Pages.Add(reportPage);
+ // create report title band
+ reportPage.ReportTitle = new ReportTitleBand();
+ reportPage.ReportTitle.Name = "ReportTitle1";
+ reportPage.ReportTitle.Height = Units.Millimeters * 10;
+ // add subreport on it
+ SubreportObject subreport = new SubreportObject();
+ subreport.Name = "Subreport1";
+ subreport.Bounds = new RectangleF(0, 0, Units.Millimeters * 25, Units.Millimeters * 5);
+ reportPage.ReportTitle.Objects.Add(subreport);
+ // create subreport page
+ ReportPage subreportPage = new ReportPage();
+ subreportPage.Name = "SubreportPage1";
+ report.Pages.Add(subreportPage);
+ // connect the subreport to the subreport page
+ subreport.ReportPage = subreportPage;
+
+
+ text1.TextFill = new HatchFill(Color.Black, Color.White, HatchStyle.Cross);
+
+ Use the textObject1.TextFill = new SolidFill(color);
+
+ TextObject text1;
+ HighlightCondition highlight = new HighlightCondition();
+ highlight.Expression = "Value < 0";
+ highlight.Fill = new SolidFill(Color.Red);
+ highlight.ApplyFill = true;
+ text1.Highlight.Add(highlight);
+
+
+ TextObject text1;
+ text1.Format = new CurrencyFormat();
+
+
+ text1.Formats.Clear();
+ text1.Formats.Add(new DateFormat());
+ text1.Formats.Add(new NumberFormat());
+
+
+ CrossViewObject crossView;
+ // change the fill color of the first matrix cell
+ crossView.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ DialogPage form = new DialogPage();
+ // set the width and height in pixels
+ form.Width = 200;
+ form.Height = 200;
+ form.Name = "Form1";
+ // create a button
+ ButtonControl button = new ButtonControl();
+ button.Location = new Point(20, 20);
+ button.Size = new Size(75, 25);
+ button.Text = "The button";
+ // add the button to the form
+ form.Controls.Add(button);
+
+
+ protected override void AttachEvents()
+ {
+ base.AttachEvents();
+ CheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
+ }
+
+ private void CheckBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if (CheckedChanged != null)
+ CheckedChanged(this, e);
+ InvokeEvent(CheckedChangedEvent, e);
+ }
+
+
+ protected override void DetachEvents()
+ {
+ base.DetachEvents();
+ CheckBox.CheckedChanged -= new EventHandler(CheckBox_CheckedChanged);
+ }
+
+
+ protected override void FillData(DataSourceBase dataSource, Column column)
+ {
+ Items.Clear();
+ dataSource.First();
+ while (dataSource.HasMoreRows)
+ {
+ Items.Add(dataSource[column].ToString());
+ dataSource.Next();
+ }
+ }
+
+
+ protected override void Done()
+ {
+ base.Done();
+ ImageExport imageExport = Export as ImageExport;
+ imageExport.ImageFormat = (ImageExportFormat)cbxImageFormat.SelectedIndex;
+ imageExport.Resolution = (int)udResolution.Value;
+ imageExport.JpegQuality = (int)udQuality.Value;
+ imageExport.SeparateFiles = cbSeparateFiles.Checked;
+ }
+
+
+ public override void Init(ExportBase export)
+ {
+ base.Init(export);
+ ImageExport imageExport = Export as ImageExport;
+ cbxImageFormat.SelectedIndex = (int)imageExport.ImageFormat;
+ udResolution.Value = imageExport.Resolution;
+ udQuality.Value = imageExport.JpegQuality;
+ cbSeparateFiles.Checked = imageExport.SeparateFiles;
+ }
+
+
+ public DialogPageOptions(DialogPageDesigner pd) : base()
+ {
+ FPageDesigner = pd;
+ InitializeComponent();
+ }
+
+
+ // create an instance of MatrixObject
+ MatrixObject matrix = new MatrixObject();
+ matrix.Name = "Matrix1";
+ // add it to the report title band of the first report page
+ matrix.Parent = (report.Pages[0] as ReportPage).ReportTitle;
+
+ // create two column descriptors
+ MatrixHeaderDescriptor column = new MatrixHeaderDescriptor("[MatrixDemo.Year]");
+ matrix.Data.Columns.Add(column);
+ column = new MatrixHeaderDescriptor("[MatrixDemo.Month]");
+ matrix.Data.Columns.Add(column);
+
+ // create one row descriptor
+ MatrixHeaderDescriptor row = new MatrixHeaderDescriptor("[MatrixDemo.Name]");
+ matrix.Data.Rows.Add(row);
+
+ // create one data cell
+ MatrixCellDescriptor cell = new MatrixCellDescriptor("[MatrixDemo.Revenue]", MatrixAggregateFunction.Sum);
+ matrix.Data.Cells.Add(cell);
+
+ // connect matrix to a datasource
+ matrix.DataSource = Report.GetDataSource("MatrixDemo");
+
+ // create the matrix template
+ matrix.BuildTemplate();
+
+ // change the style
+ matrix.Style = "Green";
+
+ // change the column and row total's text to "Grand Total"
+ matrix.Data.Columns[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ // suppose we have a matrix with one column, row and data cell.
+ // provide 3 one-dimensional arrays with one element in each to the AddValue method
+ Matrix1.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 21.35f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Nancy Davolio" },
+ new object[] { 421.5f });
+
+ // this code will produce the following matrix:
+ // | 1996 | 1997 |
+ // --------------+--------+--------+
+ // Andrew Fuller | 123.45| 21.35|
+ // --------------+--------+--------+
+ // Nancy Davolio | | 421.50|
+ // --------------+--------+--------+
+
+
+ MatrixObject matrix;
+ matrix.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+
+ // this will produce the following result:
+ // | 1996 |
+ // --------------+----------+
+ // Andrew Fuller | 123.45|
+ // --------------+----------+
+
+
+ MatrixObject matrix;
+ // change the fill color of the first matrix cell
+ matrix.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Fill = new SolidFill(Color.Green);
+
+
+ report.Load("...");
+ MSChartObject reportChart = report.FindObject("MSChart1") as MSChartObject;
+ reportChart.AssignChart(applicationChart);
+ report.Show();
+
+
+ // print table header (the first row)
+ Table1.PrintRow(0);
+ Table1.PrintColumns();
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintRow(1);
+ Table1.PrintColumns();
+ }
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ Table1.PrintColumns();
+
+
+
+ // print table header (the first column)
+ Table1.PrintColumn(0);
+ Table1.PrintRows();
+ // print table body (the second column)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ Table1.PrintRows();
+ }
+ // print table footer (the third column)
+ Table1.PrintColumn(2);
+ Table1.PrintRows();
+
+
+
+ // print the first row with all its columns
+ Table1.PrintRow(0);
+ // print header column
+ Table1.PrintColumn(0);
+ // print 10 data columns
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ // print footer column
+ Table1.PrintColumn(2);
+
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ // print data row with all its columns
+ Table1.PrintRow(1);
+ Table1.PrintColumn(0);
+ for (int j = 0; j < 10; j++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+ }
+
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ // again print all columns in the table footer
+ Table1.PrintColumn(0);
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+
+
+ TableCell cell1;
+ PictureObject picture1 = new PictureObject();
+ picture1.Bounds = new RectangleF(0, 0, 32, 32);
+ picture1.Name = "Picture1";
+ cell1.Objects.Add(picture1);
+
+
+ // right-align the table
+ Table1.ResultTable.Left = Engine.PageWidth - Table1.ResultTable.CalcWidth() - 1;
+
+
+ public void Draw(FRPaintEventArgs e)
+ {
+ Brush brush = e.Cache.GetBrush(BackColor);
+ Pen pen = e.Cache.GetPen(BorderColor, 1, BorderStyle);
+ e.Graphics.FillRectangle(brush, Bounds);
+ e.Graphics.DrawRectangle(pen, Bounds);
+ }
+
+
+
+
+ EmailExport export = new EmailExport();
+ export.Account.Address = "my@address.net";
+ export.Account.Host = "myhost";
+ export.Address = "recipient@address.net";
+ export.Subject = "Re: analysis report";
+ // the report1 report must be prepared at this moment
+ export.SendEmail(report1);
+
+ TextExport.Encoding = Encoding.Default;
+ Unicode UTF-8 encoding
+ TextExport.Encoding = Encoding.UTF8;
+ OEM encoding for current system locale sessings
+ TextExport.Encoding = Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
+
+ TextExportPrint.PrintStream("EPSON FX-1000", "My Report", 1, txtStream)
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+
+
+ // register own cloud storage client
+ RegisteredObjects.AddCloud(typeof(MyCloud), "My Cloud");
+
+
+ // register own messenger
+ RegisteredObjects.AddMessenger(typeof(MyMessenger), "My Messenger");
+
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+
+
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+
+
+ // register data connection
+ RegisteredObjects.AddConnection(typeof(MyDataConnection), "My Data Connection");
+
+
+ // register the report object
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage", myReportObjectBmp, "My Report Object");
+ // register the dialog control
+ RegisteredObjects.Add(typeof(MyDialogControl), "DialogPage", myDialogControlBmp, "My Dialog Control");
+ // add a category and register an object inside it
+ RegisteredObjects.AddCategory("ReportPage,MyCategory", myCategoryBmp, "My Category");
+ // register another report object in MyCategory
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage,MyCategory",
+ anotherReportObjectBmp, "Another Report Object");
+
+
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+
+ public static class MyFunctions
+ {
+ /// <summary>
+ /// Converts a specified string to uppercase.
+ /// </summary>
+ /// <param name="s">The string to convert.</param>
+ /// <returns>A string in uppercase.</returns>
+ public static string MyUpperCase(string s)
+ {
+ return s == null ? "" : s.ToUpper();
+ }
+
+ /// <summary>
+ /// Returns the larger of two 32-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static int MyMaximum(int val1, int val2)
+ {
+ return Math.Max(val1, val2);
+ }
+
+ /// <summary>
+ /// Returns the larger of two 64-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static long MyMaximum(long val1, long val2)
+ {
+ return Math.Max(val1, val2);
+ }
+ }
+
+ // register a category
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+ // obtain MethodInfo for our functions
+ Type myType = typeof(MyFunctions);
+ MethodInfo myUpperCaseFunc = myType.GetMethod("MyUpperCase");
+ MethodInfo myMaximumIntFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(int), typeof(int) });
+ MethodInfo myMaximumLongFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(long), typeof(long) });
+
+ // register simple function
+ RegisteredObjects.AddFunction(myUpperCaseFunc, "MyFuncs");
+
+ // register overridden functions
+ RegisteredObjects.AddFunction(myMaximumIntFunc, "MyFuncs,MyMaximum");
+ RegisteredObjects.AddFunction(myMaximumLongFunc, "MyFuncs,MyMaximum");
+
+
+ <Objects>
+ <Report Text="Report"/>
+ <Bands Text="Bands">
+ <ReportTitle Text="Report Title"/>
+ </Bands>
+ </Objects>
+
+ To get the localized "ReportTitle" value, you should pass the following ID
+ to this method: "Objects,Bands,ReportTitle".
+
+ Res.Set("Messages,SaveChanges", "My text that will appear when you close the designer");
+
+
+ <?xml version="1.0" encoding="utf-8"?>
+ <Config>
+ <Plugins>
+ <Plugin Name="c:\Program Files\MyProgram\MyPlugin.dll"/>
+ </Plugins>
+ </Config>
+
+ When you run your application and use the Report object first time, all plugins will be loaded.
+ To register objects contained in a plugin, FastReport searches for classes of type
+ AssemblyInitializerBase and instantiates them.
+
+ public class MyAssemblyInitializer : AssemblyInitializerBase
+ {
+ public MyAssemblyInitializer()
+ {
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+ }
+ }
+
+
+ FastNameCreator nameCreator = new FastNameCreator(Report.AllObjects);
+ foreach (Base c in Report.AllObjects)
+ {
+ if (c.Name == "")
+ nameCreator.CreateUniqueName(c);
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Serialize(FRWriter writer)
+ {
+ // get the etalon object. It will be used to write changed properties only.
+ Base c = writer.DiffObject as Base;
+
+ // write the type name
+ writer.ItemName = ClassName;
+
+ // write properties
+ if (Name != "")
+ writer.WriteStr("Name", Name);
+ if (Restrictions != c.Restrictions)
+ writer.WriteValue("Restrictions", Restrictions);
+
+ // write child objects if allowed
+ if (writer.SaveChildren)
+ {
+ foreach (Base child in ChildObjects)
+ {
+ writer.Write(child);
+ }
+ }
+ }
+
+
+ // using the Res.Get method
+ miKeepTogether = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,RepeatOnEveryPage"));
+
+ // using MyRes.Get method
+ MyRes res = new MyRes("ComponentMenu,HeaderBand");
+ miKeepTogether = new ToolStripMenuItem(res.Get("KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(res.Get("ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(res.Get("RepeatOnEveryPage"));
+
+
+
+ foreach (AdvancedTextRenderer.Paragraph paragraph in renderer.Paragraphs)
+ {
+ foreach (AdvancedTextRenderer.Line line in paragraph.Lines)
+ {
+ foreach (AdvancedTextRenderer.Word word in line.Words)
+ {
+ if (renderer.HtmlTags)
+ {
+ foreach (AdvancedTextRenderer.Run run in word.Runs)
+ {
+ using (Font f = run.GetFont())
+ using (Brush b = run.GetBrush())
+ {
+ g.DrawString(run.Text, f, b, run.Left, run.Top, renderer.Format);
+ }
+ }
+ }
+ else
+ {
+ g.DrawString(word.Text, renderer.Font, renderer.Brush, word.Left, word.Top, renderer.Format);
+ }
+ }
+ }
+ }
+
+ valueInMillimeters = valueInPixels / Units.Millimeters;
+ To convert millimeters to pixels, use the following code:
+ valueInPixels = valueInMillimeters * Units.Millimeters;
+ inches = pixels / SizeUnitsP.Inch;
+ To convert inches to pixels, use the code:
+ pixels = inches * SizeUnitsP.Inch;
+ inches = millimeters / SizeUnitsM.Inch;
+ To convert inches to millimeters, use the code:
+ millimeters = inches * SizeUnitsM.Inch;
+
+ report1.Preview = previewControl1;
+ report1.Show();
+
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+
+ barcode.SymbologyName = "PDF417";
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+ Represents a 2D matrix of bits. In function arguments below, and throughout the common + module, x is the column position, and y is the row position. The ordering is always x, y. + The origin is at the top-left.
+Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins + with a new int. This is done intentionally so that we can copy out a row into a BitArray very + efficiently.
+The ordering of bits is row-major. Within each int, the least significant bits are used first, + meaning they represent lower x values. This is compatible with BitArray's implementation.
+Gets the requested bit, where true means black.
+ +Flips the given bit.
+ +Sets a square region of the bit matrix to true.
+ +This class contains utility methods for performing mathematical operations over + the Galois Fields. Operations use a given primitive polynomial in calculations.
+Throughout this package, elements of the GF are represented as an {@code int} + for convenience and speed (but at the cost of memory). +
+Represents a polynomial whose coefficients are elements of a GF. + Instances of this class are immutable.
+Much credit is due to William Rucklidge since portions of this code are an indirect + port of his C++ Reed-Solomon implementation.
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+
+
+ BarcodeObject barcode;
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+ barcode.Text = "&C;1234&A;ABC";
+
+ 1.
+
+ @return the position of this MaxiCode symbol in a series of symbols using structured append
+ 1.
+
+ @return size of the series that this symbol is part of
+ | Characters | Meaning |
|---|---|
| 1-9 | Postal code data which can consist of up to 9 digits (for mode 2) or up to 6 + alphanumeric characters (for mode 3). Remaining unused characters should be + filled with the SPACE character (ASCII 32). |
| 10-12 | Three-digit country code according to ISO-3166. |
| 13-15 | Three digit service code. This depends on your parcel courier. |
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = PDF417CompactionMode.Text;
+
+
+ Report report1;
+ XmlDataConnection conn = new XmlDataConnection();
+ conn.XmlFile = @"c:\data.xml";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = "Table1";
+ conn.Tables.Add(table);
+
+
+ TableDataSource ds = report.GetDataSource("My DataSource Name") as TableDataSource;
+ ds.Parameters[0].Value = 10;
+
+ This way is not good because you hardcode the report object's name.
+
+ Report report1;
+ DataSourceBase customersTable = report1.Dictionary.DataSources.FindByAlias("Customers");
+ DataSourceBase ordersTable = report1.Dictionary.DataSources.FindByAlias("Orders");
+ Relation rel = new Relation();
+ rel.Name = "customersOrders";
+ rel.ParentDataSource = customersTable;
+ rel.ChildDataSource = ordersTable;
+ rel.ParentColumns = new string[] { "CustomerID" };
+ rel.ChildColumns = new string[] { "CustomerID" };
+ report1.Dictionary.Relations.Add(rel);
+
+
+ Report report1;
+ OleDbDataConnection conn = new OleDbDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ OdbcDataConnection conn = new OdbcDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsSqlDataConnection conn = new MsSqlDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder(oleDbConnection1.ConnectionString);
+ builder.PersistSecurityInfo = false;
+ oleDbConnection1.ConnectionString = builder.ToString();
+
+
+ public override Type GetConnectionType()
+ {
+ return typeof(OleDbConnection);
+ }
+
+
+ public override DbDataAdapter GetAdapter(string selectCommand, DbConnection connection,
+ CommandParameterCollection parameters)
+ {
+ OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand, connection as OleDbConnection);
+ foreach (CommandParameter p in parameters)
+ {
+ OleDbParameter parameter = adapter.SelectCommand.Parameters.Add(p.Name, (OleDbType)p.DataType, p.Size);
+ parameter.Value = p.Value;
+ }
+ return adapter;
+ }
+
+
+ Report report1;
+ CsvDataConnection conn = new CsvDataConnection();
+ conn.CsvFile = @"c:\data.csv";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ dataSource.Init();
+ while (dataSource.HasMoreRows)
+ {
+ // do something...
+ dataSource.Next();
+ }
+
+
+ Report report1;
+ Parameter par = new Parameter();
+ par.Name = report1.Dictionary.CreateUniqueName("Parameter");
+ report1.Parameters.Add(par);
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = report1.Dictionary.CreateUniqueName("EmployeesTable");
+ table.Alias = report1.Dictionary.CreateUniqueAlias("Employees");
+ conn.Tables.Add(table);
+
+
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 108, "Objects,Shapes,Rectangle", 0);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 109, "Objects,Shapes,RoundRectangle", 1);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 110, "Objects,Shapes,Ellipse", 2);
+
+
+ public override void OnBeforeInsert(int flags)
+ {
+ FShape = (ShapeKind)flags;
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+
+
+ Report report1;
+ ReportPage page = new ReportPage();
+ page.Parent = report1;
+
+ public DataHeaderBand Header
+ {
+ get { return FHeader; }
+ set
+ {
+ SetProp(FHeader, value);
+ FHeader = value;
+ }
+ }
+
+ <TextObject Name="Text2" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+
+
+ <DataBand Name="Data1" Top="163" Width="718.2" Height="18.9">
+ <TextObject Name="Text3" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+ </DataBand>
+
+
+ protected override void DeserializeSubItems(FRReader reader)
+ {
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else
+ base.DeserializeSubItems(reader);
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+ if (text1 != null)
+ {
+ // object found
+ }
+
+
+ TextObject textObj = new TextObject();
+ dataBand1.Objects.Add(textObj);
+ textObj.CreateUniqueName();
+
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings, do not copy report objects
+ report2.Assign(report1);
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings and objects
+ report2.AssignAll(report1);
+
+ public void OnBeforePrint(EventArgs e)
+ {
+ if (BeforePrint != null)
+ BeforePrint(this, e);
+ InvokeEvent(BeforePrintEvent, e);
+ }
+
+ TextObject text1;
+ // set Height to 10mm
+ text1.Height = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Height = " + (text1.Height / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Left to 10mm
+ text1.Left = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Left = " + (text1.Left / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Top to 10mm
+ text1.Top = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Top = " + (text1.Top / Units.Millimeters).ToString() + "mm");
+
+ private void Data1_BeforePrint(object sender, EventArgs e)
+ {
+ Text1.Visible = [Orders.Shipped] == true;
+ }
+
+ TextObject text1;
+ // set Width to 10mm
+ text1.Width = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Width = " + (text1.Width / Units.Millimeters).ToString() + "mm");
+
+ frmPopup popup = new frmPopup();
+ Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
+ popupHelper.ShowPopup(this, popup, location);
+
+
+ Designer designer = new Designer();
+ designer.Parent = form1;
+ designer.Report = report1;
+
+
+ DesignerControl designer = new DesignerControl();
+ designer.MdiMode = true;
+ designer.ShowDialog();
+
+
+ // add an event handler that will be fired when the designer is run
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ // override "New..." command behavior
+ (sender as Designer).cmdNew.CustomAction += new EventHandler(cmdNew_CustomAction);
+ }
+
+ void cmdNew_CustomAction(object sender, EventArgs e)
+ {
+ // show the "Label" wizard instead of standard "Add New Item" dialog
+ Designer designer = sender as Designer;
+ LabelWizard wizard = new LabelWizard();
+ wizard.Run(designer);
+ }
+
+
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ Config.DesignerSettings.PageAdded += new EventHandler(DesignerSettings_PageAdded);
+
+ void DesignerSettings_PageAdded(object sender, EventArgs e)
+ {
+ if (sender is ReportPage)
+ (sender as ReportPage).TopMargin = 0;
+ }
+
+
+ Config.DesignerSettings.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ Config.DesignerSettings.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ Config.DesignerSettings.AddCustomConnection(typeof(MsAccessDataConnection), @"Data Source=c:\data.mdb");
+
+
+ public void SaveState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ xi.SetProp("ShowGrid", DialogWorkspace.ShowGrid ? "1" : "0");
+ }
+
+
+ public void RestoreState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ DialogWorkspace.ShowGrid = xi.GetProp("ShowGrid") != "0";
+ }
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ MessagesWindow window = designer.Plugins.Find("MessagesWindow") as MessagesWindow;
+
+
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ Designer designer;
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolWindow));
+
+
+ Designer designer;
+ DesignerMenu menu = designer.Plugins.FindType("DesignerMenu") as DesignerMenu;
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ environmentSettings1.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ environmentSettings1.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ environmentSettings1.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ ReportPage page = report.Pages[0] as ReportPage;
+
+ // create the main group
+ GroupHeaderBand mainGroup = new GroupHeaderBand();
+ mainGroup.Height = Units.Millimeters * 10;
+ mainGroup.Name = "MainGroup";
+ mainGroup.Condition = "[Orders.CustomerName]";
+ // add a group to the page
+ page.Bands.Add(mainGroup);
+
+ // create the nested group
+ GroupHeaderBand nestedGroup = new GroupHeaderBand();
+ nestedGroup.Height = Units.Millimeters * 10;
+ nestedGroup.Name = "NestedGroup";
+ nestedGroup.Condition = "[Orders.OrderDate]";
+ // add it to the main group
+ mainGroup.NestedGroup = nestedGroup;
+
+ // create a data band
+ DataBand dataBand = new DataBand();
+ dataBand.Height = Units.Millimeters * 10;
+ dataBand.Name = "GroupData";
+ dataBand.DataSource = report.GetDataSource("Orders");
+ // connect the databand to the nested group
+ nestedGroup.Data = dataBand;
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.NestedGroup = new GroupHeaderBand();
+ group.NestedGroup.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ myPictureObject.Image = new Bitmap("file.bmp");
+ myPictureObject.ShouldDisposeImage = true;
+
+
+ Config.PreviewSettings.Buttons = PreviewButtons.Open |
+ PreviewButtons.Save |
+ PreviewButtons.Find |
+ PreviewButtons.Zoom |
+ PreviewButtons.Outline |
+ PreviewButtons.PageSetup |
+ PreviewButtons.Edit |
+ PreviewButtons.Watermark |
+ PreviewButtons.Navigator |
+ PreviewButtons.Close;
+
+
+ Report report = new Report();
+ report.Load("reportfile.frx");
+ report.RegisterData(application_dataset);
+ report.Show();
+
+
+ Report report = new Report();
+ // create the report page
+ ReportPage page = new ReportPage();
+ page.Name = "ReportPage1";
+ // set paper width and height. Note: these properties are measured in millimeters.
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // add a page to the report
+ report.Pages.Add(page);
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create Text object and put it to the title
+ TextObject text = new TextObject();
+ text.Name = "Text1";
+ text.Bounds = new RectangleF(0, 0, Units.Millimeters * 100, Units.Millimeters * 5);
+ page.ReportTitle.Objects.Add(text);
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to a page
+ page.Bands.Add(data);
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ ReportPage page1 = report1.Pages[0] as ReportPage;
+
+
+ using System.Security;
+ using System.Security.Permissions;
+ ...
+ PermissionSet ps = new PermissionSet(PermissionState.None);
+ ps.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
+ report1.ScriptRestrictions = ps;
+ report1.Prepare();
+
+
+ SimpleListReport report = new SimpleListReport();
+ report.RegisterData(your_dataset);
+ report.Show();
+
+
+ string employeeName = (string)report.GetColumnValue("Employees.FirstName");
+
+
+ // load the report
+ report1.Load("report.frx");
+ // setup the parameter
+ report1.SetParameterValue("MyParam", 10);
+ // show the report
+ report1.Show();
+
+ report.AddReferencedAssembly("Newtonsoft.Json.dll")
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind", true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1.Tables["Orders"], "Orders");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataView, "OrdersView");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataRelation, "myRelation");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myBusinessObject, "Customers");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myCubeLink, "Orders");
+
+
+ Report report = new Report();
+ report.Load("report1.frx");
+ report.Prepare();
+ report.Load("report2.frx");
+ report.Prepare(true);
+ report.ShowPrepared();
+
+
+ textObject1.Fill = new SolidFill(Color.Green);
+ (textObject1.Fill as SolidFill).Color = Color.Red;
+
+ reportComponent1.Fill = new SolidFill(color);
+
+ ReportPage page = new ReportPage();
+ // set the paper in millimeters
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to the page
+ page.Bands.Add(data);
+ // add page to the report
+ report.Pages.Add(page);
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ // create the main report page
+ ReportPage reportPage = new ReportPage();
+ reportPage.Name = "Page1";
+ report.Pages.Add(reportPage);
+ // create report title band
+ reportPage.ReportTitle = new ReportTitleBand();
+ reportPage.ReportTitle.Name = "ReportTitle1";
+ reportPage.ReportTitle.Height = Units.Millimeters * 10;
+ // add subreport on it
+ SubreportObject subreport = new SubreportObject();
+ subreport.Name = "Subreport1";
+ subreport.Bounds = new RectangleF(0, 0, Units.Millimeters * 25, Units.Millimeters * 5);
+ reportPage.ReportTitle.Objects.Add(subreport);
+ // create subreport page
+ ReportPage subreportPage = new ReportPage();
+ subreportPage.Name = "SubreportPage1";
+ report.Pages.Add(subreportPage);
+ // connect the subreport to the subreport page
+ subreport.ReportPage = subreportPage;
+
+
+ text1.TextFill = new HatchFill(Color.Black, Color.White, HatchStyle.Cross);
+
+ Use the textObject1.TextFill = new SolidFill(color);
+
+ TextObject text1;
+ HighlightCondition highlight = new HighlightCondition();
+ highlight.Expression = "Value < 0";
+ highlight.Fill = new SolidFill(Color.Red);
+ highlight.ApplyFill = true;
+ text1.Highlight.Add(highlight);
+
+
+ TextObject text1;
+ text1.Format = new CurrencyFormat();
+
+
+ text1.Formats.Clear();
+ text1.Formats.Add(new DateFormat());
+ text1.Formats.Add(new NumberFormat());
+
+
+ CrossViewObject crossView;
+ // change the fill color of the first matrix cell
+ crossView.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ DialogPage form = new DialogPage();
+ // set the width and height in pixels
+ form.Width = 200;
+ form.Height = 200;
+ form.Name = "Form1";
+ // create a button
+ ButtonControl button = new ButtonControl();
+ button.Location = new Point(20, 20);
+ button.Size = new Size(75, 25);
+ button.Text = "The button";
+ // add the button to the form
+ form.Controls.Add(button);
+
+
+ protected override void AttachEvents()
+ {
+ base.AttachEvents();
+ CheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
+ }
+
+ private void CheckBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if (CheckedChanged != null)
+ CheckedChanged(this, e);
+ InvokeEvent(CheckedChangedEvent, e);
+ }
+
+
+ protected override void DetachEvents()
+ {
+ base.DetachEvents();
+ CheckBox.CheckedChanged -= new EventHandler(CheckBox_CheckedChanged);
+ }
+
+
+ protected override void FillData(DataSourceBase dataSource, Column column)
+ {
+ Items.Clear();
+ dataSource.First();
+ while (dataSource.HasMoreRows)
+ {
+ Items.Add(dataSource[column].ToString());
+ dataSource.Next();
+ }
+ }
+
+
+ protected override void Done()
+ {
+ base.Done();
+ ImageExport imageExport = Export as ImageExport;
+ imageExport.ImageFormat = (ImageExportFormat)cbxImageFormat.SelectedIndex;
+ imageExport.Resolution = (int)udResolution.Value;
+ imageExport.JpegQuality = (int)udQuality.Value;
+ imageExport.SeparateFiles = cbSeparateFiles.Checked;
+ }
+
+
+ public override void Init(ExportBase export)
+ {
+ base.Init(export);
+ ImageExport imageExport = Export as ImageExport;
+ cbxImageFormat.SelectedIndex = (int)imageExport.ImageFormat;
+ udResolution.Value = imageExport.Resolution;
+ udQuality.Value = imageExport.JpegQuality;
+ cbSeparateFiles.Checked = imageExport.SeparateFiles;
+ }
+
+
+ public DialogPageOptions(DialogPageDesigner pd) : base()
+ {
+ FPageDesigner = pd;
+ InitializeComponent();
+ }
+
+
+ // create an instance of MatrixObject
+ MatrixObject matrix = new MatrixObject();
+ matrix.Name = "Matrix1";
+ // add it to the report title band of the first report page
+ matrix.Parent = (report.Pages[0] as ReportPage).ReportTitle;
+
+ // create two column descriptors
+ MatrixHeaderDescriptor column = new MatrixHeaderDescriptor("[MatrixDemo.Year]");
+ matrix.Data.Columns.Add(column);
+ column = new MatrixHeaderDescriptor("[MatrixDemo.Month]");
+ matrix.Data.Columns.Add(column);
+
+ // create one row descriptor
+ MatrixHeaderDescriptor row = new MatrixHeaderDescriptor("[MatrixDemo.Name]");
+ matrix.Data.Rows.Add(row);
+
+ // create one data cell
+ MatrixCellDescriptor cell = new MatrixCellDescriptor("[MatrixDemo.Revenue]", MatrixAggregateFunction.Sum);
+ matrix.Data.Cells.Add(cell);
+
+ // connect matrix to a datasource
+ matrix.DataSource = Report.GetDataSource("MatrixDemo");
+
+ // create the matrix template
+ matrix.BuildTemplate();
+
+ // change the style
+ matrix.Style = "Green";
+
+ // change the column and row total's text to "Grand Total"
+ matrix.Data.Columns[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ // suppose we have a matrix with one column, row and data cell.
+ // provide 3 one-dimensional arrays with one element in each to the AddValue method
+ Matrix1.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 21.35f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Nancy Davolio" },
+ new object[] { 421.5f });
+
+ // this code will produce the following matrix:
+ // | 1996 | 1997 |
+ // --------------+--------+--------+
+ // Andrew Fuller | 123.45| 21.35|
+ // --------------+--------+--------+
+ // Nancy Davolio | | 421.50|
+ // --------------+--------+--------+
+
+
+ MatrixObject matrix;
+ matrix.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+
+ // this will produce the following result:
+ // | 1996 |
+ // --------------+----------+
+ // Andrew Fuller | 123.45|
+ // --------------+----------+
+
+
+ MatrixObject matrix;
+ // change the fill color of the first matrix cell
+ matrix.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Fill = new SolidFill(Color.Green);
+
+
+ report.Load("...");
+ MSChartObject reportChart = report.FindObject("MSChart1") as MSChartObject;
+ reportChart.AssignChart(applicationChart);
+ report.Show();
+
+
+ // print table header (the first row)
+ Table1.PrintRow(0);
+ Table1.PrintColumns();
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintRow(1);
+ Table1.PrintColumns();
+ }
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ Table1.PrintColumns();
+
+
+
+ // print table header (the first column)
+ Table1.PrintColumn(0);
+ Table1.PrintRows();
+ // print table body (the second column)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ Table1.PrintRows();
+ }
+ // print table footer (the third column)
+ Table1.PrintColumn(2);
+ Table1.PrintRows();
+
+
+
+ // print the first row with all its columns
+ Table1.PrintRow(0);
+ // print header column
+ Table1.PrintColumn(0);
+ // print 10 data columns
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ // print footer column
+ Table1.PrintColumn(2);
+
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ // print data row with all its columns
+ Table1.PrintRow(1);
+ Table1.PrintColumn(0);
+ for (int j = 0; j < 10; j++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+ }
+
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ // again print all columns in the table footer
+ Table1.PrintColumn(0);
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+
+
+ TableCell cell1;
+ PictureObject picture1 = new PictureObject();
+ picture1.Bounds = new RectangleF(0, 0, 32, 32);
+ picture1.Name = "Picture1";
+ cell1.Objects.Add(picture1);
+
+
+ // right-align the table
+ Table1.ResultTable.Left = Engine.PageWidth - Table1.ResultTable.CalcWidth() - 1;
+
+
+ public void Draw(FRPaintEventArgs e)
+ {
+ Brush brush = e.Cache.GetBrush(BackColor);
+ Pen pen = e.Cache.GetPen(BorderColor, 1, BorderStyle);
+ e.Graphics.FillRectangle(brush, Bounds);
+ e.Graphics.DrawRectangle(pen, Bounds);
+ }
+
+
- // create string-based MultiColumnDictionary and assign it to column
- // note: this will automatically generate keys of type 'int' for each item,
- // the key values will be stored in the grid.
- string text = "Row1, Col1\tRow1, Col2|Row2, Col1\tRow2, Col3|Row2, Col1\tRow3, Col2";
- MultiColumnDictionary map = new MultiColumnDictionary(text, 0, true);
- _flex.Cols[1].DataMap = map;
-
-
- // create data-based MultiColumnDictionary and assign it to column
- // notes: the list will automatically be updated is the data source changes.
- DataTable dt = GetDataTable("employees");
- string[] columnNames = new string[] { "FirstName", "LastName", "Country" };
- MultiColumnDictionary map = new MultiColumnDictionary(dt, "EmployeeID", columnNames, 1);
- _flex.Cols[2].DataMap = map;
-
-
- [LicenseProvider(typeof(LicenseProvider))]
- public class MyGrid : C1FlexGrid
- {
- // implementation
- }
-
-
- // bind grids together
- _flexRight.DataSource = _flexLeft;
- _flexLeft.ScrollBars = ScrollBars.Horizontal;
-
- // synchronize vertical scrolling
- // (this handles the AfterScroll event for both grids)
- void flex_AfterScroll(object sender, C1.Win.C1FlexGrid.RangeEventArgs e)
- {
- // update sender grid (could be _flexLeft or _flexRight)
- C1FlexGrid.C1FlexGrid src = ((C1FlexGrid)sender);
- src.Update();
-
- // get new vertical position from sender grid
- int y = src.ScrollPosition.Y;
-
- // apply new vertical position to the other grid
- if (src.Equals == _flexLeft)
- {
- _flexRight.ScrollPosition = new Point(_flexRight.ScrollPosition.X, y);
- }
- else
- {
- _flexLeft.ScrollPosition = new Point(_flexLeft.ScrollPosition.X, y);
- }
- }
-
- CellRange rg = _flex.GetCellRange(3, 3, 10, 10);
- rg.Style = _flex.Styles["MyRangeStyle"];
-
-
- flex.SetData(1, 1, "Hello", true);
- flex[1, 1] = "Hello"; // same thing
-
-
- flex.SetData(1, "ColName", "Hello", true);
- flex[1, "ColName"] = "Hello"; // same thing
-
-
- object foo = flex.GetData(1, 1);
- object bar = flex[1, 1]; // same thing
-
-
- void _flex_BeforeMouseDown(object sender, BeforeMouseDownEventArgs e)
- {
- HitTestInfo hti = _flex.HitTest(e.X, e.Y);
- Console.WriteLine("at {0},{1}: row {2} col {3} type {4}",
- hti.X, hti.Y, hti.Row, hti.Column, hti.Type);
- }
-
- void UpdateGrid(C1FlexGrid flex)
- {
- try
- {
- flex.BeginUpdate(); // suspend painting to avoid flicker
- flex.Rows.Count = 1;
- for (int i = 1; i < 10000; i++)
- flex.AddItem("Row " + i.ToString());
- }
- finally
- {
- flex.EndUpdate(); // always restore painting
- }
- }
-
- CellRange rg = flex.GetCellRange(5, 5, 20, 8);
- rg.Style = flex.Styles["MyStyle"];
-
-
- // this does not compile
- flex.GetCellRange(5, 5, 20, 8).Style = flex.Styles["MyStyle"];
-
-
- Image img = flex.CreateImage(0,0,10,5);
- img.Save(@"c:\temp\grid.png", System.Drawing.Imaging.ImageFormat.Png);
-
- void _flex_RowColChange(object sender, System.EventArgs e)
- {
- _flex.StartEditing();
- }
-
- void flex_SelChange(object sender, System.EventArgs e)
- {
- string fmt = "Count {0:0}, Sum {1:#,##0.00}, " +
- "Avg {2:#,##0.00}, Stdev {3:#,##0.00}";
- Console.WriteLine(fmt,
- flex.Aggregate(AggregateEnum.Count),
- flex.Aggregate(AggregateEnum.Sum),
- flex.Aggregate(AggregateEnum.Average),
- flex.Aggregate(AggregateEnum.Std));
- }
-
- void UpdateTotals()
- {
- // no repainting until we're done
- _flex.Redraw = false;
-
- // clear old subtotals, if any
- _flex.Subtotal(AggregateEnum.Clear);
-
- // sort the grid on the columns that will be grouped
- _flex.Sort(SortFlags.Ascending, 0, 3);
-
- // show outline tree on column 0
- _flex.Tree.Column = 0;
-
- // get a grand total (use -1 instead of column index)
- _flex.Subtotal(AggregateEnum.Sum, -1, -1, 3, "Grand Total");
-
- // total on column 0 (initially Product)
- _flex.Subtotal(AggregateEnum.Sum, 0, 0, 3);
-
- // total on column 1 (initially Region)
- _flex.Subtotal(AggregateEnum.Sum, 1, 1, 3);
-
- // show outline level 1
- _flex.Tree.Show(1);
-
- // restore painting
- _flex.Redraw = true;
- }
- void _flex_AfterDragColumn(object sender, C1.Win.C1FlexGrid.DragRowColEventArgs e)
- {
- UpdateTotals(); // user moved a column, update totals
- }
-
-
- flex.Subtotal(AggregateEnum.Clear); // clear all subtotals
-
- // suspend painting to improve performance
- bool redraw = flex.Redraw;
- flex.Redraw = false;
-
- // append 100 rows, using tabs as separators
- flex.ClipSeparators = "\t\n";
- for (int i = 0; i < 100; i++)
- flex.AddItem("\tcol1\tcol2\tcol3");
-
- // add 100 rows at the top, using pipes as separators
- flex.ClipSeparators = "|;";
- for (int i = 0; i < 100; i++)
- flex.AddItem("|col1|col2|col3", 0);
-
- // append 100 rows at the bottom, using an object array
- object[] items = { "col1", "col2", "col3" };
- for (int i = 0; i < 100; i++)
- flex.AddItem(items, flex.Rows.Count, flex.Cols.Fixed);
-
- // restore painting
- flex.Redraw = redraw;
-
- // clear tabControl
- tabControl.TabPages.Clear();
-
- // load sheet names
- string fileName = "c:\book1.xls";
- string[] sheets = _flexGrid.LoadExcelSheetNames(fileName);
-
- // load each sheet
- foreach (string sheetName in sheets)
- {
- // create a new grid for this sheet
- C1FlexGrid flex = new C1FlexGrid();
- flex.Dock = DockStyle.Fill;
-
- // load sheet into new grid
- flex.LoadExcel(fileName, sheetName);
-
- // add grid to the tabControl
- TabPage page = new TabPage();
- page.Controls.Add(flex);
- page.Text = sheetName;
- tabControl.TabPages.Add(page);
- }
-
- // save a grid into am Xml file
- flex.WriteXml(fileName);
-
- The code below saves two grids into an Xml file, then reads them back in reverse order:
-
- // prepare XmlTextWriter
- XmlTextWriter w = new XmlTextWriter(fileName, new UTF8Encoding(false));
- w.Formatting = Formatting.Indented;
- w.WriteStartDocument();
- w.WriteStartElement("Grids");
-
- // save first grid
- w.WriteStartElement(c1FlexGrid1.Name);
- c1FlexGrid1.WriteXml(w);
- w.WriteEndElement();
-
- // save second grid
- w.WriteStartElement(c1FlexGrid2.Name);
- c1FlexGrid2.WriteXml(w);
- w.WriteEndElement();
-
- // close document
- w.WriteEndElement();
- w.Close();
-
- // load document from file
- XmlDocument doc = new XmlDocument();
- doc.Load(fileName);
- XmlNode n = doc.SelectSingleNode("Grids");
-
- // load grids in reverse order
- c1FlexGrid2.ReadXml(n.ChildNodes[0]);
- c1FlexGrid1.ReadXml(n.ChildNodes[1]);
-
- flex.Cols["CheckBoxes"].DataType = typeof(bool);
- flex.Cols["yesNo"].DataType = typeof(bool);
- flex.Cols["yesNo"].Format := "Yes;No";
-
-
- flex.SetCellCheck(3, 3, CheckEnum.Unchecked) // Boolean;
- flex.SetCellCheck(4, 3, CheckEnum.TSUnchecked) // tri-state;
-
-
- void Initialize()
- {
- // enable filtering
- _flex.AllowFiltering = true;
-
- // set GetLocalizedString handler
- _flex.GetLocalizedString += _flex_GetLocalizedString;
- }
- void _flex_GetLocalizedString(object sender, C1.Win.C1FlexGrid.GetLocalizedStringEventArgs e)
- {
- // customize item based on text value
- if (e.Value == "(Select All)")
- {
- e.Value = "(Select Everything)";
- }
-
- // customize item based on component name
- switch (e.ComponentName)
- {
- case "_btnApplyFilter":
- e.Value = "OK";
- break;
- case "_btnClearFilter":
- e.Value = "Reset";
- break;
- case "_btnCancel":
- e.Value = "Close";
- break;
- }
- }
-
- void _flex_BeforeMouseDown(object sender, C1.Win.C1FlexGrid.BeforeMouseDownEventArgs e)
- {
- // start dragging when the user clicks the row headers
- HitTestInfo hti = _flex.HitTest(e.X, e.Y);
- if (hti.Type == HitTestTypeEnum.RowHeader)
- {
- e.Cancel = true; // cancel default handling
- HandleRowDragDrop(hti.Row); // handle row drag/drop
- }
- }
-
- void _flex_BeforeDoubleClick(object sender, C1.Win.C1FlexGrid.BeforeMouseDownEventArgs e)
- {
- // detect double-clicks on column "Customer"
- HitTestInfo hti = _flex.HitTest(e.X, e.Y);
- if (hti.Type == HitTestTypeEnum.Cell && _flex[hti.Column].Name == "Customer")
- {
- e.Cancel = true; // cancel default handling
- ShowCustomEditDialog(hti.Row, hti.Column); // handle row drag/drop
- }
- }
-
- void Form1_Load(object sender, EventArgs e)
- {
- // create style for tracking cell under the mouse
- CellStyle cs = _flex.Styles.Add("track");
- cs.BackColor = Color.Gold;
- }
- void _flex_MouseEnterCell(object sender, RowColEventArgs e)
- {
- // apply tracking style when mouse enters the cell
- _flex.SetCellStyle(e.Row, e.Col, _flex.Styles["track"]);
- }
- void _flex_MouseLeaveCell(object sender, RowColEventArgs e)
- {
- // remove tracking style when mouse leaves the cell
- _flex.SetCellStyle(e.Row, e.Col, (CellStyle)null);
- }
-
- void _flex_BeforeScroll(object sender, C1.Win.C1FlexGrid.RangeEventArgs e)
- {
- if (_flex.Editor != null)
- e.Cancel = true;
- }
-
- _flex.ScrollOptions = ScrollFlags.DelayedScroll | ScrollFlags.ShowScrollTips;
- void _flex_ShowScrollTip(object sender, ToolTipEventArgs e)
- {
- e.ToolTipText = string.Format("row {0}", e.Row);
- }
-
- void _flex_SetupEditor(object sender, RowColEventArgs e)
- {
- TextBox tb = _flex.Editor as TextBox;
- if (tb != null)
- {
- if (_flex.Cols[e.Col].Name == "ID")
- tb.MaxLength = 4;
- else
- tb.MaxLength = 32000;
- }
- }
-
-
- void _flex_ValidateEdit(object sender, ValidateEditEventArgs e)
- {
- if (_flex.Cols[e.Col].Name = "Score")
- {
- try
- {
- int value = int.Parse(_flex.Editor.Text);
- if (value >= 0 && value <= 50)
- return; // accept edits
- }
- catch {}
-
- // error or invalid range, refuse edits
- e.Cancel = true;
- }
- }
-
- void _flex_ChangeEdit(object sender, EventArgs e)
- {
- // get text in editor
- string text = _flex.Editor.Text;
-
- // show message if it's too long
- statusStrip1.Text = text.Length > 10
- ? "This text seems too long..."
- : "This text looks OK...";
- }
-
- // create a column, assign it a name and get the new index
- Column myCol = flex.Cols.Add();
- myCol.Name = "address";
- myCol.DataType = typeof(string);
- int colIndex = myCol.Index;
-
- // assign a value to a cell using cell coordinates:
- flex[1, colIndex] = "555, Broadway";
-
- // get the value using the column name
- string address = (string)flex[1, "address"];
- MessageBox.Show("The address is " + address);
-
- CellRange rg = flex.Selection;
- for (int r = rg.r1; r <= rg.r2; r++)
- for (int c = rg.c1; c <= rg.c2; c++)
- Console.WriteLine("the value at {0} {1} is {2}", r, c, flex[r, c]);
-
- int total = 0;
- CellRange rg = flex.Selection;
- for (int r = rg.r1; r <= rg.r2; r++)
- for (int c = rg.c1; c <= rg.c2; c++)
- total += (int)flex[r,c];
- Console.WriteLine("The total is: {0}", total);
-
- // build clip string
- string s = "r1 c1\tr1 c2\nr2 c1\tr2 c2";
-
- // select a 2 x 2 range and apply clip string to selection
- flex.Select(2, 2, 4, 4);
- flex.Clip = s;
-
- void _flex_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
- {
- TextBox tb = _flex.Editor as TextBox;
- if (tb != null)
- {
- tb.CharacterCasing = CharacterCasing.Upper;
- tb.MaxLength = 12;
- }
- }
- flex.ComboList = string.Empty;
- flex.ComboList = "Item 1|Item 2|Item 3";
- flex.ComboList = "|Item 1|Item 2|Item 3";
- flex.ComboList = "...";
- flex.ComboList = "|...";
-
- void _flex_BeforeEdit(object sender, RowColEventArgs e)
- {
- _flex.ComboList = string.Empty;
- if (e.Row % 2 == 0) _flex.ComboList = "...";
- }
-
- flex.EditMask = "(###) 000-0000 St\ate\: >LL;*";
-
- flex.AllowAddNew = true;
- flex.Rows.Count = 10;
- Console.WriteLine("Row count is {0}.", _flex.Rows.Count);
- Row count is 11.
-
-
- flex.Glyphs[GlyphEnum.Ascending] = imgAscending;
- flex.Glyphs[GlyphEnum.Descending] = imgDescending;
-
- // use case-insensitive comparer
- flex.CustomComparer = new CaseInsensitiveComparer();
-
- // add groups ignoring case
- flex.Subtotal(AggregateEnum.Sum, 0, groupOn, totalOn);
-
- // restore default (case-sensitive) comparer
- flex.CustomComparer = null;
-
- // with the ComboBoxEditor property:
- Console.WriteLine("The current combo index is {0}",
- _flex.ComboBoxEditor.SelectedIndex);
-
- // without the ComboBoxEditor property:
- ComboBox cb = _flex.Editor as ComboBox;
- int index = (cb != null) ? cb.SelectedIndex : -1;
- Console.WriteLine("The current combo index is {0}",
- index);
-
- private void _flex_SelChange(object sender, System.EventArgs e)
- {
- CellRange rg = this._flex.GetMergedRange(_flex.Row, _flex.Col, false);
- if (!rg.IsSingleCell)
- {
- Console.WriteLine("selection is merged: {0},{1}-{2},{3}",
- rg.TopRow, rg.LeftCol, rg.BottomRow, rg.RightCol);
- }
- }
-
- The code below shows how you can override the
- public class CustomMerge : C1FlexGrid
- {
- public CustomMerge()
- {
- // allow free merging by default
- AllowMerging = AllowMergingEnum.Free;
- for (int r = 0; r < Rows.Count; r++) Rows[r].AllowMerging = true;
- for (int c = 0; c < Cols.Count; c++) Cols[c].AllowMerging = true;
- }
- override public CellRange GetMergedRange(int row, int col, bool clip)
- {
- // merge cells in range (1,1)-(3,3)
- if (row >= 1 && row <= 3 && col >= 1 && col <= 3)
- return GetCellRange(1, 1, 3, 3);
-
- // don't merge anything else
- return GetCellRange(row, col);
- }
- }
-
- flex.AllowMerging = AllowMergingEnum.Free;
- flex.Cols[1].AllowMerging = true; // merge values in column 1
-
- // C#
- SortFlags order = SortFlags.Ascending | SortFlags.IgnoreCase;
- _flex.Sort(order, col1, col2);
-
- ' VB
- Dim order As SortFlags = SortFlags.Ascending Or SortFlags.IgnoreCase
- _flex.Sort(order, col1, col2)
-
- // create a style
- CellStyle cs = _flex.Styles.Add("red");
- cs.BackColor = Color.Red;
-
- // create a cell range and assign it a style
- CellRange rg = _flex.GetCellRange(1, 1, 5, 5);
- rg.Style = cs;
-
- // create a cell range
- CellRange rg = _flex.GetCellRange(1, 1, 5, 5);
-
- // make sure range is red
- rg.StyleNew.BackColor = Color.Red;
-
- // create style used to display low-stock items
- CellStyle cs = _flex.Styles.Add("Critical");
- cs.BackColor = Color.Red;
-
- private void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
- {
- // ignore fixed cells
- if (e.Row < _flex.Rows.Fixed || e.Col < _flex.Cols.Fixed)
- return;
-
- // apply custom style if reorder level is critical
- if (_flex.Cols[e.Col].Name == "UnitsInStock")
- {
- // change the style by applying the "Critical" style to the Style parameter
- // (do not change the e.Style.BackColor property directly since that would
- // affect other cells that use this style)
- if ((short)_flex[e.Row, "UnitsInStock"] < (short)_flex[e.Row, "ReorderLevel"])
- e.Style = _flex.Styles["Critical"];
- }
- }
-
- Form dlg = _flex.PrintParameters.PrintPreviewDialog as Form;
- dlg.Text = "Custom Caption";
- dlg.StartPosition = FormStartPosition.Manual;
- dlg.WindowState = FormWindowState.Maximized;
- _flex.PrintGrid("test", PrintGridFlags.ShowPreviewDialog);
-
- _flex.Header = "\t\tPage {0} of {1}";
- _flex.HeaderFont = new Font("Tahoma", 10);
- _flex.PrintGrid("Header");
-
- // print two grids into an existing PrintDocument
- private void button1_Click(object sender, EventArgs e)
- {
- using (var dlg = new PrintPreviewDialog())
- {
- dlg.Document = this.printDocument1;
- dlg.ShowDialog(this);
- }
- }
-
- // event handlers for the PrintDocument object on the form
- PrintDocumentGridRenderer _g1, _g2;
- void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
- {
- // create and configure grid renderer for the first grid
- _g1 = new PrintDocumentGridRenderer(c1FlexGrid1);
- _g1.Options = PrintGridFlags.FitToPageWidth | PrintGridFlags.ExtendLastCol;
-
- // create and configure grid renderer for the second grid
- _g2 = new PrintDocumentGridRenderer(c1FlexGrid2);
- _g2.Options = PrintGridFlags.FitToPageWidth | PrintGridFlags.ExtendLastCol;
- }
- void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
- {
- // render first grid
- if (_g1.CurrentPage < _g1.PageCount)
- {
- _g1.PrintPage(e);
- e.HasMorePages = true;
- }
-
- // render second grid
- else if (_g2.CurrentPage < _g2.PageCount)
- {
- _g2.PrintPage(e);
- e.HasMorePages = _g2.CurrentPage < _g2.PageCount;
- }
- }
-
- // get the style associated with column 1 (create a new one if necessary)
- CellStyle cs = _flex.Cols[1].StyleNew.BackColor;
-
- // set the new style's back color to red
- cs.BackColor = Color.Red;
-
- // create C1DateEdit control (included with C1Input)
- C1DateEdit dateEdit = new C1DateEdit();
-
- // use the new control as an editor for a grid column
- _flex.Cols[1].DataType = typeof(DateTime);
- _flex.Cols[1].Editor = c1DateEdit;
-
-
- // initialize "ShipRegion" column filter to show only two values: "AK" and "CA"
- var col = _flex.Cols["ShipRegion"];
- col.AllowFiltering = AllowFiltering.ByValue;
- var vf = col.Filter as ValueFilter;
- vf.ShowValues = new object[] { "AK", "CA" };
-
- // initialize "UnitPrice" column filter to show only values greater than $30
- col = _flex.Cols["UnitPrice"];
- col.AllowFiltering = AllowFiltering.ByCondition;
- var cf = col.Filter as ConditionFilter;
- cf.Condition1.Operator = ConditionOperator.GreaterThan;
- cf.Condition1.Parameter = 30;
-
- // apply both column filters to the data
- _flex.ApplyFilters();
-
- // delete all selected rows
- foreach (Row r in _flex.Rows.Selected)
- {
- _flex.Rows.Remove(r);
- }
-
-
- int columnIndex = _flex.Cols.IndexOf("total");
- _flex.AutoSizeCol(columnIndex);
-
- int columnIndex = _flex.Cols.IndexOf("total");
- _flex.AutoSizeCol(columnIndex);
-
- // s1, s2, and s3 are all references to the grid's Normal style:
- CellStyle s1 = _flex.Styles[CellStyleEnum.Normal];
- CellStyle s2 = _flex.Styles["Normal"];
- CellStyle s3 = _flex.Styles.Normal;
-
- // create style with red background
- CellStyle cs = _flex.Styles.Add("red");
- Style.BackColor = Color.Red;
-
- // create style with green background
- cs = _flex.Styles.Add("green");
- Style.BackColor = Color.Green;
-
- // create style with bold font
- cs = _flex.Styles.Add("bold");
- Style.Font = new Font("Tahoma", 8, FontStyle.Bold);
-
- // assign red style to a column
- _flex.Cols[3].Style = _flex.Styles["red"];
-
- // assign green style to a row
- _flex.Rows[3].Style = _flex.Styles["green"];
-
- // assign bold style to a cell range
- CellRange rg = _flex.GetCellRange(2, 2, 4, 4);
- rg.Style = _flex.Styles["bold"];
-
- // create a new style
- CellStyle cs = _flex.Styles.Add("newStyle");
-
- // set data type, alignment
- cs.DataType = typeof(int);
- cs.TextAlign = TextAlignEnum.CenterCenter;
-
- // copy remaining elements from "Fixed" style
- cs.MergeWith(_flex.Styles.Fixed);
-
- // assign new style to grid column
- _flex.Cols[col].Style = cs;
-
- // create style with custom font and back color
- CellStyle cs = _flex.Styles.Add("s1");
- cs.Font = new Font("Arial", 12, FontStyle.Bold);
- cs.BackColor = Color.Beige;
-
- // save style definition into a string
- string styleDef = cs.BuildString();
-
- // use string to initialize another style
- CellStyle csNew = _flex.Styles.Add("s2");
- csNew.ParseString(styleDef);
-
- // compare styles
- Debug.Assert(csNew.Font.Equals(cs.Font));
- Debug.Assert(csNew.BackColor.Equals(cs.BackColor));
-
- // build compact and a long style definition strings
- string s1 = _flex.Styles.Fixed.BuildString();
- string s2 = _flex.Styles.Fixed.BuildString(StyleElementFlags.All);
-
- // show both style definitions
- Console.WriteLine("{0}: {1}", s1.Length, s1);
- Console.WriteLine("{0}: {1}", s2.Length, s2);
-
+ EmailExport export = new EmailExport();
+ export.Account.Address = "my@address.net";
+ export.Account.Host = "myhost";
+ export.Address = "recipient@address.net";
+ export.Subject = "Re: analysis report";
+ // the report1 report must be prepared at this moment
+ export.SendEmail(report1);
+
+ TextExport.Encoding = Encoding.Default;
+ Unicode UTF-8 encoding
+ TextExport.Encoding = Encoding.UTF8;
+ OEM encoding for current system locale sessings
+ TextExport.Encoding = Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
+
+ TextExportPrint.PrintStream("EPSON FX-1000", "My Report", 1, txtStream)
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+
+
+ // register own cloud storage client
+ RegisteredObjects.AddCloud(typeof(MyCloud), "My Cloud");
+
+
+ // register own messenger
+ RegisteredObjects.AddMessenger(typeof(MyMessenger), "My Messenger");
+
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+
+
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+
+
+ // register data connection
+ RegisteredObjects.AddConnection(typeof(MyDataConnection), "My Data Connection");
+
+
+ // register the report object
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage", myReportObjectBmp, "My Report Object");
+ // register the dialog control
+ RegisteredObjects.Add(typeof(MyDialogControl), "DialogPage", myDialogControlBmp, "My Dialog Control");
+ // add a category and register an object inside it
+ RegisteredObjects.AddCategory("ReportPage,MyCategory", myCategoryBmp, "My Category");
+ // register another report object in MyCategory
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage,MyCategory",
+ anotherReportObjectBmp, "Another Report Object");
+
+
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+
+ public static class MyFunctions
+ {
+ /// <summary>
+ /// Converts a specified string to uppercase.
+ /// </summary>
+ /// <param name="s">The string to convert.</param>
+ /// <returns>A string in uppercase.</returns>
+ public static string MyUpperCase(string s)
+ {
+ return s == null ? "" : s.ToUpper();
+ }
+
+ /// <summary>
+ /// Returns the larger of two 32-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static int MyMaximum(int val1, int val2)
+ {
+ return Math.Max(val1, val2);
+ }
+
+ /// <summary>
+ /// Returns the larger of two 64-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static long MyMaximum(long val1, long val2)
+ {
+ return Math.Max(val1, val2);
+ }
+ }
+
+ // register a category
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+ // obtain MethodInfo for our functions
+ Type myType = typeof(MyFunctions);
+ MethodInfo myUpperCaseFunc = myType.GetMethod("MyUpperCase");
+ MethodInfo myMaximumIntFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(int), typeof(int) });
+ MethodInfo myMaximumLongFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(long), typeof(long) });
+
+ // register simple function
+ RegisteredObjects.AddFunction(myUpperCaseFunc, "MyFuncs");
+
+ // register overridden functions
+ RegisteredObjects.AddFunction(myMaximumIntFunc, "MyFuncs,MyMaximum");
+ RegisteredObjects.AddFunction(myMaximumLongFunc, "MyFuncs,MyMaximum");
+
+
+ <Objects>
+ <Report Text="Report"/>
+ <Bands Text="Bands">
+ <ReportTitle Text="Report Title"/>
+ </Bands>
+ </Objects>
+
+ To get the localized "ReportTitle" value, you should pass the following ID
+ to this method: "Objects,Bands,ReportTitle".
+
+ Res.Set("Messages,SaveChanges", "My text that will appear when you close the designer");
+
+
+ <?xml version="1.0" encoding="utf-8"?>
+ <Config>
+ <Plugins>
+ <Plugin Name="c:\Program Files\MyProgram\MyPlugin.dll"/>
+ </Plugins>
+ </Config>
+
+ When you run your application and use the Report object first time, all plugins will be loaded.
+ To register objects contained in a plugin, FastReport searches for classes of type
+ AssemblyInitializerBase and instantiates them.
+
+ public class MyAssemblyInitializer : AssemblyInitializerBase
+ {
+ public MyAssemblyInitializer()
+ {
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+ }
+ }
+
+
+ FastNameCreator nameCreator = new FastNameCreator(Report.AllObjects);
+ foreach (Base c in Report.AllObjects)
+ {
+ if (c.Name == "")
+ nameCreator.CreateUniqueName(c);
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Serialize(FRWriter writer)
+ {
+ // get the etalon object. It will be used to write changed properties only.
+ Base c = writer.DiffObject as Base;
+
+ // write the type name
+ writer.ItemName = ClassName;
+
+ // write properties
+ if (Name != "")
+ writer.WriteStr("Name", Name);
+ if (Restrictions != c.Restrictions)
+ writer.WriteValue("Restrictions", Restrictions);
+
+ // write child objects if allowed
+ if (writer.SaveChildren)
+ {
+ foreach (Base child in ChildObjects)
+ {
+ writer.Write(child);
+ }
+ }
+ }
+
+
+ // using the Res.Get method
+ miKeepTogether = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,RepeatOnEveryPage"));
+
+ // using MyRes.Get method
+ MyRes res = new MyRes("ComponentMenu,HeaderBand");
+ miKeepTogether = new ToolStripMenuItem(res.Get("KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(res.Get("ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(res.Get("RepeatOnEveryPage"));
+
+
+
+ foreach (AdvancedTextRenderer.Paragraph paragraph in renderer.Paragraphs)
+ {
+ foreach (AdvancedTextRenderer.Line line in paragraph.Lines)
+ {
+ foreach (AdvancedTextRenderer.Word word in line.Words)
+ {
+ if (renderer.HtmlTags)
+ {
+ foreach (AdvancedTextRenderer.Run run in word.Runs)
+ {
+ using (Font f = run.GetFont())
+ using (Brush b = run.GetBrush())
+ {
+ g.DrawString(run.Text, f, b, run.Left, run.Top, renderer.Format);
+ }
+ }
+ }
+ else
+ {
+ g.DrawString(word.Text, renderer.Font, renderer.Brush, word.Left, word.Top, renderer.Format);
+ }
+ }
+ }
+ }
+
+ valueInMillimeters = valueInPixels / Units.Millimeters;
+ To convert millimeters to pixels, use the following code:
+ valueInPixels = valueInMillimeters * Units.Millimeters;
+ inches = pixels / SizeUnitsP.Inch;
+ To convert inches to pixels, use the code:
+ pixels = inches * SizeUnitsP.Inch;
+ inches = millimeters / SizeUnitsM.Inch;
+ To convert inches to millimeters, use the code:
+ millimeters = inches * SizeUnitsM.Inch;
+
+ report1.Preview = previewControl1;
+ report1.Show();
+
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+
+ barcode.SymbologyName = "PDF417";
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+ Represents a 2D matrix of bits. In function arguments below, and throughout the common + module, x is the column position, and y is the row position. The ordering is always x, y. + The origin is at the top-left.
+Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins + with a new int. This is done intentionally so that we can copy out a row into a BitArray very + efficiently.
+The ordering of bits is row-major. Within each int, the least significant bits are used first, + meaning they represent lower x values. This is compatible with BitArray's implementation.
+Gets the requested bit, where true means black.
+ +Flips the given bit.
+ +Sets a square region of the bit matrix to true.
+ +This class contains utility methods for performing mathematical operations over + the Galois Fields. Operations use a given primitive polynomial in calculations.
+Throughout this package, elements of the GF are represented as an {@code int} + for convenience and speed (but at the cost of memory). +
+Represents a polynomial whose coefficients are elements of a GF. + Instances of this class are immutable.
+Much credit is due to William Rucklidge since portions of this code are an indirect + port of his C++ Reed-Solomon implementation.
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+
+
+ BarcodeObject barcode;
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+ barcode.Text = "&C;1234&A;ABC";
+
+ 1.
+
+ @return the position of this MaxiCode symbol in a series of symbols using structured append
+ 1.
+
+ @return size of the series that this symbol is part of
+ | Characters | Meaning |
|---|---|
| 1-9 | Postal code data which can consist of up to 9 digits (for mode 2) or up to 6 + alphanumeric characters (for mode 3). Remaining unused characters should be + filled with the SPACE character (ASCII 32). |
| 10-12 | Three-digit country code according to ISO-3166. |
| 13-15 | Three digit service code. This depends on your parcel courier. |
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = PDF417CompactionMode.Text;
+
+
+ Report report1;
+ XmlDataConnection conn = new XmlDataConnection();
+ conn.XmlFile = @"c:\data.xml";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = "Table1";
+ conn.Tables.Add(table);
+
+
+ TableDataSource ds = report.GetDataSource("My DataSource Name") as TableDataSource;
+ ds.Parameters[0].Value = 10;
+
+ This way is not good because you hardcode the report object's name.
+
+ Report report1;
+ DataSourceBase customersTable = report1.Dictionary.DataSources.FindByAlias("Customers");
+ DataSourceBase ordersTable = report1.Dictionary.DataSources.FindByAlias("Orders");
+ Relation rel = new Relation();
+ rel.Name = "customersOrders";
+ rel.ParentDataSource = customersTable;
+ rel.ChildDataSource = ordersTable;
+ rel.ParentColumns = new string[] { "CustomerID" };
+ rel.ChildColumns = new string[] { "CustomerID" };
+ report1.Dictionary.Relations.Add(rel);
+
+
+ Report report1;
+ OleDbDataConnection conn = new OleDbDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ OdbcDataConnection conn = new OdbcDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsSqlDataConnection conn = new MsSqlDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder(oleDbConnection1.ConnectionString);
+ builder.PersistSecurityInfo = false;
+ oleDbConnection1.ConnectionString = builder.ToString();
+
+
+ public override Type GetConnectionType()
+ {
+ return typeof(OleDbConnection);
+ }
+
+
+ public override DbDataAdapter GetAdapter(string selectCommand, DbConnection connection,
+ CommandParameterCollection parameters)
+ {
+ OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand, connection as OleDbConnection);
+ foreach (CommandParameter p in parameters)
+ {
+ OleDbParameter parameter = adapter.SelectCommand.Parameters.Add(p.Name, (OleDbType)p.DataType, p.Size);
+ parameter.Value = p.Value;
+ }
+ return adapter;
+ }
+
+
+ Report report1;
+ CsvDataConnection conn = new CsvDataConnection();
+ conn.CsvFile = @"c:\data.csv";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ dataSource.Init();
+ while (dataSource.HasMoreRows)
+ {
+ // do something...
+ dataSource.Next();
+ }
+
+
+ Report report1;
+ Parameter par = new Parameter();
+ par.Name = report1.Dictionary.CreateUniqueName("Parameter");
+ report1.Parameters.Add(par);
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = report1.Dictionary.CreateUniqueName("EmployeesTable");
+ table.Alias = report1.Dictionary.CreateUniqueAlias("Employees");
+ conn.Tables.Add(table);
+
+
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 108, "Objects,Shapes,Rectangle", 0);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 109, "Objects,Shapes,RoundRectangle", 1);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 110, "Objects,Shapes,Ellipse", 2);
+
+
+ public override void OnBeforeInsert(int flags)
+ {
+ FShape = (ShapeKind)flags;
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+
+
+ Report report1;
+ ReportPage page = new ReportPage();
+ page.Parent = report1;
+
+ public DataHeaderBand Header
+ {
+ get { return FHeader; }
+ set
+ {
+ SetProp(FHeader, value);
+ FHeader = value;
+ }
+ }
+
+ <TextObject Name="Text2" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+
+
+ <DataBand Name="Data1" Top="163" Width="718.2" Height="18.9">
+ <TextObject Name="Text3" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+ </DataBand>
+
+
+ protected override void DeserializeSubItems(FRReader reader)
+ {
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else
+ base.DeserializeSubItems(reader);
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+ if (text1 != null)
+ {
+ // object found
+ }
+
+
+ TextObject textObj = new TextObject();
+ dataBand1.Objects.Add(textObj);
+ textObj.CreateUniqueName();
+
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings, do not copy report objects
+ report2.Assign(report1);
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings and objects
+ report2.AssignAll(report1);
+
+ public void OnBeforePrint(EventArgs e)
+ {
+ if (BeforePrint != null)
+ BeforePrint(this, e);
+ InvokeEvent(BeforePrintEvent, e);
+ }
+
+ TextObject text1;
+ // set Height to 10mm
+ text1.Height = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Height = " + (text1.Height / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Left to 10mm
+ text1.Left = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Left = " + (text1.Left / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Top to 10mm
+ text1.Top = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Top = " + (text1.Top / Units.Millimeters).ToString() + "mm");
+
+ private void Data1_BeforePrint(object sender, EventArgs e)
+ {
+ Text1.Visible = [Orders.Shipped] == true;
+ }
+
+ TextObject text1;
+ // set Width to 10mm
+ text1.Width = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Width = " + (text1.Width / Units.Millimeters).ToString() + "mm");
+
+ frmPopup popup = new frmPopup();
+ Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
+ popupHelper.ShowPopup(this, popup, location);
+
+
+ Designer designer = new Designer();
+ designer.Parent = form1;
+ designer.Report = report1;
+
+
+ DesignerControl designer = new DesignerControl();
+ designer.MdiMode = true;
+ designer.ShowDialog();
+
+
+ // add an event handler that will be fired when the designer is run
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ // override "New..." command behavior
+ (sender as Designer).cmdNew.CustomAction += new EventHandler(cmdNew_CustomAction);
+ }
+
+ void cmdNew_CustomAction(object sender, EventArgs e)
+ {
+ // show the "Label" wizard instead of standard "Add New Item" dialog
+ Designer designer = sender as Designer;
+ LabelWizard wizard = new LabelWizard();
+ wizard.Run(designer);
+ }
+
+
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ Config.DesignerSettings.PageAdded += new EventHandler(DesignerSettings_PageAdded);
+
+ void DesignerSettings_PageAdded(object sender, EventArgs e)
+ {
+ if (sender is ReportPage)
+ (sender as ReportPage).TopMargin = 0;
+ }
+
+
+ Config.DesignerSettings.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ Config.DesignerSettings.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ Config.DesignerSettings.AddCustomConnection(typeof(MsAccessDataConnection), @"Data Source=c:\data.mdb");
+
+
+ public void SaveState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ xi.SetProp("ShowGrid", DialogWorkspace.ShowGrid ? "1" : "0");
+ }
+
+
+ public void RestoreState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ DialogWorkspace.ShowGrid = xi.GetProp("ShowGrid") != "0";
+ }
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ MessagesWindow window = designer.Plugins.Find("MessagesWindow") as MessagesWindow;
+
+
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ Designer designer;
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolWindow));
+
+
+ Designer designer;
+ DesignerMenu menu = designer.Plugins.FindType("DesignerMenu") as DesignerMenu;
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ environmentSettings1.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ environmentSettings1.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ environmentSettings1.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ ReportPage page = report.Pages[0] as ReportPage;
+
+ // create the main group
+ GroupHeaderBand mainGroup = new GroupHeaderBand();
+ mainGroup.Height = Units.Millimeters * 10;
+ mainGroup.Name = "MainGroup";
+ mainGroup.Condition = "[Orders.CustomerName]";
+ // add a group to the page
+ page.Bands.Add(mainGroup);
+
+ // create the nested group
+ GroupHeaderBand nestedGroup = new GroupHeaderBand();
+ nestedGroup.Height = Units.Millimeters * 10;
+ nestedGroup.Name = "NestedGroup";
+ nestedGroup.Condition = "[Orders.OrderDate]";
+ // add it to the main group
+ mainGroup.NestedGroup = nestedGroup;
+
+ // create a data band
+ DataBand dataBand = new DataBand();
+ dataBand.Height = Units.Millimeters * 10;
+ dataBand.Name = "GroupData";
+ dataBand.DataSource = report.GetDataSource("Orders");
+ // connect the databand to the nested group
+ nestedGroup.Data = dataBand;
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.NestedGroup = new GroupHeaderBand();
+ group.NestedGroup.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ myPictureObject.Image = new Bitmap("file.bmp");
+ myPictureObject.ShouldDisposeImage = true;
+
+
+ Config.PreviewSettings.Buttons = PreviewButtons.Open |
+ PreviewButtons.Save |
+ PreviewButtons.Find |
+ PreviewButtons.Zoom |
+ PreviewButtons.Outline |
+ PreviewButtons.PageSetup |
+ PreviewButtons.Edit |
+ PreviewButtons.Watermark |
+ PreviewButtons.Navigator |
+ PreviewButtons.Close;
+
+
+ Report report = new Report();
+ report.Load("reportfile.frx");
+ report.RegisterData(application_dataset);
+ report.Show();
+
+
+ Report report = new Report();
+ // create the report page
+ ReportPage page = new ReportPage();
+ page.Name = "ReportPage1";
+ // set paper width and height. Note: these properties are measured in millimeters.
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // add a page to the report
+ report.Pages.Add(page);
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create Text object and put it to the title
+ TextObject text = new TextObject();
+ text.Name = "Text1";
+ text.Bounds = new RectangleF(0, 0, Units.Millimeters * 100, Units.Millimeters * 5);
+ page.ReportTitle.Objects.Add(text);
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to a page
+ page.Bands.Add(data);
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ ReportPage page1 = report1.Pages[0] as ReportPage;
+
+
+ using System.Security;
+ using System.Security.Permissions;
+ ...
+ PermissionSet ps = new PermissionSet(PermissionState.None);
+ ps.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
+ report1.ScriptRestrictions = ps;
+ report1.Prepare();
+
+
+ SimpleListReport report = new SimpleListReport();
+ report.RegisterData(your_dataset);
+ report.Show();
+
+
+ string employeeName = (string)report.GetColumnValue("Employees.FirstName");
+
+
+ // load the report
+ report1.Load("report.frx");
+ // setup the parameter
+ report1.SetParameterValue("MyParam", 10);
+ // show the report
+ report1.Show();
+
+ report.AddReferencedAssembly("Newtonsoft.Json.dll")
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind", true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1.Tables["Orders"], "Orders");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataView, "OrdersView");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataRelation, "myRelation");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myBusinessObject, "Customers");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myCubeLink, "Orders");
+
+
+ Report report = new Report();
+ report.Load("report1.frx");
+ report.Prepare();
+ report.Load("report2.frx");
+ report.Prepare(true);
+ report.ShowPrepared();
+
+
+ textObject1.Fill = new SolidFill(Color.Green);
+ (textObject1.Fill as SolidFill).Color = Color.Red;
+
+ reportComponent1.Fill = new SolidFill(color);
+
+ ReportPage page = new ReportPage();
+ // set the paper in millimeters
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to the page
+ page.Bands.Add(data);
+ // add page to the report
+ report.Pages.Add(page);
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ // create the main report page
+ ReportPage reportPage = new ReportPage();
+ reportPage.Name = "Page1";
+ report.Pages.Add(reportPage);
+ // create report title band
+ reportPage.ReportTitle = new ReportTitleBand();
+ reportPage.ReportTitle.Name = "ReportTitle1";
+ reportPage.ReportTitle.Height = Units.Millimeters * 10;
+ // add subreport on it
+ SubreportObject subreport = new SubreportObject();
+ subreport.Name = "Subreport1";
+ subreport.Bounds = new RectangleF(0, 0, Units.Millimeters * 25, Units.Millimeters * 5);
+ reportPage.ReportTitle.Objects.Add(subreport);
+ // create subreport page
+ ReportPage subreportPage = new ReportPage();
+ subreportPage.Name = "SubreportPage1";
+ report.Pages.Add(subreportPage);
+ // connect the subreport to the subreport page
+ subreport.ReportPage = subreportPage;
+
+
+ text1.TextFill = new HatchFill(Color.Black, Color.White, HatchStyle.Cross);
+
+ Use the textObject1.TextFill = new SolidFill(color);
+
+ TextObject text1;
+ HighlightCondition highlight = new HighlightCondition();
+ highlight.Expression = "Value < 0";
+ highlight.Fill = new SolidFill(Color.Red);
+ highlight.ApplyFill = true;
+ text1.Highlight.Add(highlight);
+
+
+ TextObject text1;
+ text1.Format = new CurrencyFormat();
+
+
+ text1.Formats.Clear();
+ text1.Formats.Add(new DateFormat());
+ text1.Formats.Add(new NumberFormat());
+
+
+ CrossViewObject crossView;
+ // change the fill color of the first matrix cell
+ crossView.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ DialogPage form = new DialogPage();
+ // set the width and height in pixels
+ form.Width = 200;
+ form.Height = 200;
+ form.Name = "Form1";
+ // create a button
+ ButtonControl button = new ButtonControl();
+ button.Location = new Point(20, 20);
+ button.Size = new Size(75, 25);
+ button.Text = "The button";
+ // add the button to the form
+ form.Controls.Add(button);
+
+
+ protected override void AttachEvents()
+ {
+ base.AttachEvents();
+ CheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
+ }
+
+ private void CheckBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if (CheckedChanged != null)
+ CheckedChanged(this, e);
+ InvokeEvent(CheckedChangedEvent, e);
+ }
+
+
+ protected override void DetachEvents()
+ {
+ base.DetachEvents();
+ CheckBox.CheckedChanged -= new EventHandler(CheckBox_CheckedChanged);
+ }
+
+
+ protected override void FillData(DataSourceBase dataSource, Column column)
+ {
+ Items.Clear();
+ dataSource.First();
+ while (dataSource.HasMoreRows)
+ {
+ Items.Add(dataSource[column].ToString());
+ dataSource.Next();
+ }
+ }
+
+
+ protected override void Done()
+ {
+ base.Done();
+ ImageExport imageExport = Export as ImageExport;
+ imageExport.ImageFormat = (ImageExportFormat)cbxImageFormat.SelectedIndex;
+ imageExport.Resolution = (int)udResolution.Value;
+ imageExport.JpegQuality = (int)udQuality.Value;
+ imageExport.SeparateFiles = cbSeparateFiles.Checked;
+ }
+
+
+ public override void Init(ExportBase export)
+ {
+ base.Init(export);
+ ImageExport imageExport = Export as ImageExport;
+ cbxImageFormat.SelectedIndex = (int)imageExport.ImageFormat;
+ udResolution.Value = imageExport.Resolution;
+ udQuality.Value = imageExport.JpegQuality;
+ cbSeparateFiles.Checked = imageExport.SeparateFiles;
+ }
+
+
+ public DialogPageOptions(DialogPageDesigner pd) : base()
+ {
+ FPageDesigner = pd;
+ InitializeComponent();
+ }
+
+
+ // create an instance of MatrixObject
+ MatrixObject matrix = new MatrixObject();
+ matrix.Name = "Matrix1";
+ // add it to the report title band of the first report page
+ matrix.Parent = (report.Pages[0] as ReportPage).ReportTitle;
+
+ // create two column descriptors
+ MatrixHeaderDescriptor column = new MatrixHeaderDescriptor("[MatrixDemo.Year]");
+ matrix.Data.Columns.Add(column);
+ column = new MatrixHeaderDescriptor("[MatrixDemo.Month]");
+ matrix.Data.Columns.Add(column);
+
+ // create one row descriptor
+ MatrixHeaderDescriptor row = new MatrixHeaderDescriptor("[MatrixDemo.Name]");
+ matrix.Data.Rows.Add(row);
+
+ // create one data cell
+ MatrixCellDescriptor cell = new MatrixCellDescriptor("[MatrixDemo.Revenue]", MatrixAggregateFunction.Sum);
+ matrix.Data.Cells.Add(cell);
+
+ // connect matrix to a datasource
+ matrix.DataSource = Report.GetDataSource("MatrixDemo");
+
+ // create the matrix template
+ matrix.BuildTemplate();
+
+ // change the style
+ matrix.Style = "Green";
+
+ // change the column and row total's text to "Grand Total"
+ matrix.Data.Columns[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ // suppose we have a matrix with one column, row and data cell.
+ // provide 3 one-dimensional arrays with one element in each to the AddValue method
+ Matrix1.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 21.35f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Nancy Davolio" },
+ new object[] { 421.5f });
+
+ // this code will produce the following matrix:
+ // | 1996 | 1997 |
+ // --------------+--------+--------+
+ // Andrew Fuller | 123.45| 21.35|
+ // --------------+--------+--------+
+ // Nancy Davolio | | 421.50|
+ // --------------+--------+--------+
+
+
+ MatrixObject matrix;
+ matrix.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+
+ // this will produce the following result:
+ // | 1996 |
+ // --------------+----------+
+ // Andrew Fuller | 123.45|
+ // --------------+----------+
+
+
+ MatrixObject matrix;
+ // change the fill color of the first matrix cell
+ matrix.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Fill = new SolidFill(Color.Green);
+
+
+ report.Load("...");
+ MSChartObject reportChart = report.FindObject("MSChart1") as MSChartObject;
+ reportChart.AssignChart(applicationChart);
+ report.Show();
+
+
+ // print table header (the first row)
+ Table1.PrintRow(0);
+ Table1.PrintColumns();
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintRow(1);
+ Table1.PrintColumns();
+ }
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ Table1.PrintColumns();
+
+
+
+ // print table header (the first column)
+ Table1.PrintColumn(0);
+ Table1.PrintRows();
+ // print table body (the second column)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ Table1.PrintRows();
+ }
+ // print table footer (the third column)
+ Table1.PrintColumn(2);
+ Table1.PrintRows();
+
+
+
+ // print the first row with all its columns
+ Table1.PrintRow(0);
+ // print header column
+ Table1.PrintColumn(0);
+ // print 10 data columns
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ // print footer column
+ Table1.PrintColumn(2);
+
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ // print data row with all its columns
+ Table1.PrintRow(1);
+ Table1.PrintColumn(0);
+ for (int j = 0; j < 10; j++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+ }
+
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ // again print all columns in the table footer
+ Table1.PrintColumn(0);
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+
+
+ TableCell cell1;
+ PictureObject picture1 = new PictureObject();
+ picture1.Bounds = new RectangleF(0, 0, 32, 32);
+ picture1.Name = "Picture1";
+ cell1.Objects.Add(picture1);
+
+
+ // right-align the table
+ Table1.ResultTable.Left = Engine.PageWidth - Table1.ResultTable.CalcWidth() - 1;
+
+
+ public void Draw(FRPaintEventArgs e)
+ {
+ Brush brush = e.Cache.GetBrush(BackColor);
+ Pen pen = e.Cache.GetPen(BorderColor, 1, BorderStyle);
+ e.Graphics.FillRectangle(brush, Bounds);
+ e.Graphics.DrawRectangle(pen, Bounds);
+ }
+
+
- <form>
- <culture id="en">
- <control name="C1SpellDialog" text="Spelling" />
- <control name="_btnAdd" text="&Add" />
- ...
- </culture>
- <culture id="es">
- <control name="C1SpellDialog" text="Ortografia" />
- <control name="_btnAdd" text="&Anadir" />
- ...
- </culture>
- ...
- <form name="C1SpellDialog">
-
-
- "" Then
- If sb.ToString() <> "" Then
- sb.Append(" AND ")
- End If
- sb.Append(cond)
- End If
-
- Next dc
- ' filter the data
- Me.DataSet11.Tables(0).DefaultView.RowFilter = sb.ToString()
- End Sub]]>
-
-
- private void c1TrueDBGrid1_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e)
- {
- ViewRow row = this.c1TrueDBGrid1.Splits[0].Rows[e.Row];
- if (row.RowType == RowTypeEnum.DataRow)
- {
- bool val = (bool)this.c1TrueDBGrid1[row.DataRowIndex, 3];
- if (val == true)
- e.CellStyle.BackColor = Color.Red;
- }
- }
-
-
- public class CustPrintForm : C1.Win.C1TrueDBGrid.PrintForm
- {
- public CustPrintForm(): base()
- {
- }
-
- protected override void Init()
- {
- base.Init();
- FormBorderStyle = FormBorderStyle.Sizable;
- this.ControlBox = true;
- this.MinimizeBox = false;
- this.MaximizeBox = false;
- }
- }
-
-
- _doc.DoEvents = true;
-
- private void Generate_Click(object sender, EventArgs e)
- {
- if (_doc.BusyState != BusyStateEnum.Ready)
- Console.WriteLine("Cannot generate now, document is busy");
- else
- _doc.Generate();
- }
- private void Cancel_Click(object sender, EventArgs e)
- {
- if (_doc.BusyState != BusyStateEnum.Ready)
- _doc.Cancel = true;
- else
- Console.WriteLine("Document is not generating, nothing to cancel");
- }
-
-
- private int _flags;
-
- This field can be used for storing various boolean properties
- (CanSplitHorz, CanSplitVert etc), for example CanSplitHorz property defined as:
-
- public bool CanSplitHorz
- {
- get { return GetFlag(c_flgCanSplitVert); }
- set { SetFlag(c_flgCanSplitVert, value); }
- }
-
-
- RenderTable rt = new RenderTable();
- if (rt.Rows[10].Height == Unit.Auto)
- doSomething();
-
- At the same time, the following code does not cause a physical row object to be created,
- while being functionally identical to the code above:
-
- RenderTable rt = new RenderTable();
- if (rt.Rows.GetVectorSize(10) == Unit.Auto)
- doSomething();
-
-
- RenderTable rt = new RenderTable();
- rt.Cells[1, 2].Text = "My text.";
- rt.Cells[1, 2].Style.Spacing.All = "3mm";
-
- while the following code adds 3mm of whie space around the text in the
- cell:
-
- RenderTable rt = new RenderTable();
- rt.Cells[1, 2].Text = "My text.";
- rt.Cells[1, 2].CellStyle.Spacing.All = "3mm";
-
-
- RenderTable rt = new RenderTable();
- rt.ColumnSizingMode = TableSizingModeEnum.Auto;
- rt.Width = Unit.Auto;
-
-
- RenderTable rt = new RenderTable();
- rt.ColGroups[0, 2].Header = TableHeaderEnum.All;
-
-
- RenderTable rt = new RenderTable();
- rt.RowGroups[0, 2].Header = TableHeaderEnum.All;
-
-
- RenderTable rt = new RenderTable();
- rt.ColGroups[10, 2].Footer = TableFooterEnum.All;
-
-
- RenderTable rt = new RenderTable();
- rt.RowGroups[10, 2].Footer = TableFooterEnum.All;
-
-
- C1PrintDocument doc = new C1PrintDocument();
- RenderArea ra = new RenderArea();
- ra.Style.FontBold = true;
- RenderText rt = new RenderText("my text");
- ra.Style.AmbientParent = doc.Style;
- ra.Children.Add(rt);
- doc.Body.Children.Add(ra);
-
- still prints "my text" in bold, while this code:
-
- C1PrintDocument doc = new C1PrintDocument();
- doc.Style.FontBold = false; // this line makes the difference!
- RenderArea ra = new RenderArea();
- ra.Style.FontBold = true;
- RenderText rt = new RenderText("my text");
- ra.Style.AmbientParent = doc.Style;
- ra.Children.Add(rt);
- doc.Body.Children.Add(ra);
-
- prints "my text" using regular (non-bold) font. This is because
-
- private AmbientPropertyMonitor __ambientVisualStyleMonitor = null;
- ...
- ctor() {
- __ambientVisualStyleMonitor = new AmbientPropertyMonitor(this, "VisualStyle");
- ...
- }
- public VisualStyle VisualStyle {
- get { ... }
- set { ... }
- }
- protected void ResetVisualStyle() {
- ...
- __ambientVisualStyleMonitor.ResetValue();
- }
-
-
- private AmbientPropertyMonitor __ambientVisualStyleMonitor = null;
- ...
- ctor() {
- __ambientVisualStyleMonitor = new AmbientPropertyMonitor(this, "VisualStyle");
- ...
- }
- public VisualStyle VisualStyle {
- get { ... }
- set { ... }
- }
- protected bool ShouldSerializeVisualStyle() {
- if (__ambientVisualStyleMonitor.IsValueAmbient)
- return false;
- ...
- }
-
-
- uint assocLen = 0;
- AssocQueryString(ASSOCF.ASSOCF_INIT_DEFAULTTOSTAR,ASSOCSTR.ASSOCSTR_EXECUTABLE,Path.GetExtension(OutputFileName),"open",null,ref assocLen);
-
- For existing files, another option is FindExecutable.
-
- LicenseInfo _licInfo;
- public LicensedControl()
- {
- // check license but don't nag yet
- _licInfo = ProviderInfo.Validate(typeof(LicensedControl), this, false);
-
- // perform licensing after control is fully loaded
- Loaded += LicensedControl_Loaded;
- }
- void LicensedControl_Loaded(object sender, RoutedEventArgs e)
- {
- // nag after loading
- if (_licInfo.ShouldNag)
- {
- ProviderInfo.ShowAboutBox(this);
- }
- }
-
-
- // get Stream from application resources
- System.Reflection.Assembly a = this.GetType().Assembly;
- using (Stream stream = a.GetManifestResourceStream("MyApp.test.zip"))
- {
- // open C1ZipFile on the stream
- zip.Open(stream);
-
- // enumerate the entries in the zip file,
- foreach (C1ZipEntry ze in zip.Entries)
- {
- // show entries that have a 'txt' extension.
- if (ze.FileName.ToLower().EndsWith(".txt"))
- {
- using (var sr = new StreamReader(ze.OpenReader()))
- {
- MessageBox.Show(sr.ReadToEnd(), ze.FileName);
- }
- }
- }
- }
-
-
- // create zip on a stream
- MemoryStream msZip = new MemoryStream();
- C1ZipFile zip = new C1ZipFile(msZip, true);
-
- // add some entries to it
- foreach (string f in Directory.GetFiles(@"c:\WINDOWS\Web\Wallpaper"))
- {
- zip.Entries.Add(f);
- }
-
- // get zipped data out as a byte array
- byte[] zipData = msZip.ToArray();
-
-
- C1ZipFile zip = new C1ZipFile();
- zip.Open(myzipfile);
- try
- {
- zip.OpenBatch();
- foreach (string fileName in Directory.GetFiles(path, "*.*"))
- zip.Entries.Add(fileName);
- }
- finally
- {
- zip.CloseBatch();
- }
-
-
+ EmailExport export = new EmailExport();
+ export.Account.Address = "my@address.net";
+ export.Account.Host = "myhost";
+ export.Address = "recipient@address.net";
+ export.Subject = "Re: analysis report";
+ // the report1 report must be prepared at this moment
+ export.SendEmail(report1);
+
+ TextExport.Encoding = Encoding.Default;
+ Unicode UTF-8 encoding
+ TextExport.Encoding = Encoding.UTF8;
+ OEM encoding for current system locale sessings
+ TextExport.Encoding = Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
+
+ TextExportPrint.PrintStream("EPSON FX-1000", "My Report", 1, txtStream)
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+
+
+ // register own cloud storage client
+ RegisteredObjects.AddCloud(typeof(MyCloud), "My Cloud");
+
+
+ // register own messenger
+ RegisteredObjects.AddMessenger(typeof(MyMessenger), "My Messenger");
+
+
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+
+
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+
+
+ // register data connection
+ RegisteredObjects.AddConnection(typeof(MyDataConnection), "My Data Connection");
+
+
+ // register the report object
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage", myReportObjectBmp, "My Report Object");
+ // register the dialog control
+ RegisteredObjects.Add(typeof(MyDialogControl), "DialogPage", myDialogControlBmp, "My Dialog Control");
+ // add a category and register an object inside it
+ RegisteredObjects.AddCategory("ReportPage,MyCategory", myCategoryBmp, "My Category");
+ // register another report object in MyCategory
+ RegisteredObjects.Add(typeof(MyReportObject), "ReportPage,MyCategory",
+ anotherReportObjectBmp, "Another Report Object");
+
+
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+
+ public static class MyFunctions
+ {
+ /// <summary>
+ /// Converts a specified string to uppercase.
+ /// </summary>
+ /// <param name="s">The string to convert.</param>
+ /// <returns>A string in uppercase.</returns>
+ public static string MyUpperCase(string s)
+ {
+ return s == null ? "" : s.ToUpper();
+ }
+
+ /// <summary>
+ /// Returns the larger of two 32-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static int MyMaximum(int val1, int val2)
+ {
+ return Math.Max(val1, val2);
+ }
+
+ /// <summary>
+ /// Returns the larger of two 64-bit signed integers.
+ /// </summary>
+ /// <param name="val1">The first of two values to compare.</param>
+ /// <param name="val2">The second of two values to compare.</param>
+ /// <returns>Parameter val1 or val2, whichever is larger.</returns>
+ public static long MyMaximum(long val1, long val2)
+ {
+ return Math.Max(val1, val2);
+ }
+ }
+
+ // register a category
+ RegisteredObjects.AddFunctionCategory("MyFuncs", "My Functions");
+
+ // obtain MethodInfo for our functions
+ Type myType = typeof(MyFunctions);
+ MethodInfo myUpperCaseFunc = myType.GetMethod("MyUpperCase");
+ MethodInfo myMaximumIntFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(int), typeof(int) });
+ MethodInfo myMaximumLongFunc = myType.GetMethod("MyMaximum", new Type[] { typeof(long), typeof(long) });
+
+ // register simple function
+ RegisteredObjects.AddFunction(myUpperCaseFunc, "MyFuncs");
+
+ // register overridden functions
+ RegisteredObjects.AddFunction(myMaximumIntFunc, "MyFuncs,MyMaximum");
+ RegisteredObjects.AddFunction(myMaximumLongFunc, "MyFuncs,MyMaximum");
+
+
+ <Objects>
+ <Report Text="Report"/>
+ <Bands Text="Bands">
+ <ReportTitle Text="Report Title"/>
+ </Bands>
+ </Objects>
+
+ To get the localized "ReportTitle" value, you should pass the following ID
+ to this method: "Objects,Bands,ReportTitle".
+
+ Res.Set("Messages,SaveChanges", "My text that will appear when you close the designer");
+
+
+ <?xml version="1.0" encoding="utf-8"?>
+ <Config>
+ <Plugins>
+ <Plugin Name="c:\Program Files\MyProgram\MyPlugin.dll"/>
+ </Plugins>
+ </Config>
+
+ When you run your application and use the Report object first time, all plugins will be loaded.
+ To register objects contained in a plugin, FastReport searches for classes of type
+ AssemblyInitializerBase and instantiates them.
+
+ public class MyAssemblyInitializer : AssemblyInitializerBase
+ {
+ public MyAssemblyInitializer()
+ {
+ // register own wizard
+ RegisteredObjects.AddWizard(typeof(MyWizard), myWizBmp, "My Wizard", true);
+ // register own export filter
+ RegisteredObjects.AddExport(typeof(MyExport), "My Export");
+ // register own report object
+ RegisteredObjects.Add(typeof(MyObject), "ReportPage", myObjBmp, "My Object");
+ }
+ }
+
+
+ FastNameCreator nameCreator = new FastNameCreator(Report.AllObjects);
+ foreach (Base c in Report.AllObjects)
+ {
+ if (c.Name == "")
+ nameCreator.CreateUniqueName(c);
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Deserialize(FRReader reader)
+ {
+ // read simple properties like "Text", complex properties like "Border.Lines"
+ reader.ReadProperties(this);
+
+ // moves the current reader item
+ while (reader.NextItem())
+ {
+ // read the "Styles" collection
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else if (reader.ReadChildren)
+ {
+ // if read of children is enabled, read them
+ Base obj = reader.Read();
+ if (obj != null)
+ obj.Parent = this;
+ }
+ }
+ }
+
+
+ public void Serialize(FRWriter writer)
+ {
+ // get the etalon object. It will be used to write changed properties only.
+ Base c = writer.DiffObject as Base;
+
+ // write the type name
+ writer.ItemName = ClassName;
+
+ // write properties
+ if (Name != "")
+ writer.WriteStr("Name", Name);
+ if (Restrictions != c.Restrictions)
+ writer.WriteValue("Restrictions", Restrictions);
+
+ // write child objects if allowed
+ if (writer.SaveChildren)
+ {
+ foreach (Base child in ChildObjects)
+ {
+ writer.Write(child);
+ }
+ }
+ }
+
+
+ // using the Res.Get method
+ miKeepTogether = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(Res.Get("ComponentMenu,HeaderBand,RepeatOnEveryPage"));
+
+ // using MyRes.Get method
+ MyRes res = new MyRes("ComponentMenu,HeaderBand");
+ miKeepTogether = new ToolStripMenuItem(res.Get("KeepTogether"));
+ miResetPageNumber = new ToolStripMenuItem(res.Get("ResetPageNumber"));
+ miRepeatOnEveryPage = new ToolStripMenuItem(res.Get("RepeatOnEveryPage"));
+
+
+
+ foreach (AdvancedTextRenderer.Paragraph paragraph in renderer.Paragraphs)
+ {
+ foreach (AdvancedTextRenderer.Line line in paragraph.Lines)
+ {
+ foreach (AdvancedTextRenderer.Word word in line.Words)
+ {
+ if (renderer.HtmlTags)
+ {
+ foreach (AdvancedTextRenderer.Run run in word.Runs)
+ {
+ using (Font f = run.GetFont())
+ using (Brush b = run.GetBrush())
+ {
+ g.DrawString(run.Text, f, b, run.Left, run.Top, renderer.Format);
+ }
+ }
+ }
+ else
+ {
+ g.DrawString(word.Text, renderer.Font, renderer.Brush, word.Left, word.Top, renderer.Format);
+ }
+ }
+ }
+ }
+
+ valueInMillimeters = valueInPixels / Units.Millimeters;
+ To convert millimeters to pixels, use the following code:
+ valueInPixels = valueInMillimeters * Units.Millimeters;
+ inches = pixels / SizeUnitsP.Inch;
+ To convert inches to pixels, use the code:
+ pixels = inches * SizeUnitsP.Inch;
+ inches = millimeters / SizeUnitsM.Inch;
+ To convert inches to millimeters, use the code:
+ millimeters = inches * SizeUnitsM.Inch;
+
+ report1.Preview = previewControl1;
+ report1.Show();
+
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+
+ barcode.SymbologyName = "PDF417";
+ (barcode.Barcode as BarcodePDF417).CompactionMode = CompactionMode.Text;
+
+ Represents a 2D matrix of bits. In function arguments below, and throughout the common + module, x is the column position, and y is the row position. The ordering is always x, y. + The origin is at the top-left.
+Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins + with a new int. This is done intentionally so that we can copy out a row into a BitArray very + efficiently.
+The ordering of bits is row-major. Within each int, the least significant bits are used first, + meaning they represent lower x values. This is compatible with BitArray's implementation.
+Gets the requested bit, where true means black.
+ +Flips the given bit.
+ +Sets a square region of the bit matrix to true.
+ +This class contains utility methods for performing mathematical operations over + the Galois Fields. Operations use a given primitive polynomial in calculations.
+Throughout this package, elements of the GF are represented as an {@code int} + for convenience and speed (but at the cost of memory). +
+Represents a polynomial whose coefficients are elements of a GF. + Instances of this class are immutable.
+Much credit is due to William Rucklidge since portions of this code are an indirect + port of his C++ Reed-Solomon implementation.
+
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+
+
+ BarcodeObject barcode;
+ barcode.Barcode = new Barcode128();
+ (barcode.Barcode as Barcode128).AutoEncode = false;
+ barcode.Text = "&C;1234&A;ABC";
+
+ 1.
+
+ @return the position of this MaxiCode symbol in a series of symbols using structured append
+ 1.
+
+ @return size of the series that this symbol is part of
+ | Characters | Meaning |
|---|---|
| 1-9 | Postal code data which can consist of up to 9 digits (for mode 2) or up to 6 + alphanumeric characters (for mode 3). Remaining unused characters should be + filled with the SPACE character (ASCII 32). |
| 10-12 | Three-digit country code according to ISO-3166. |
| 13-15 | Three digit service code. This depends on your parcel courier. |
+ BarcodeObject barcode;
+ ...
+ barcode.Barcode = new BarcodePDF417();
+ (barcode.Barcode as BarcodePDF417).CompactionMode = PDF417CompactionMode.Text;
+
+
+ Report report1;
+ XmlDataConnection conn = new XmlDataConnection();
+ conn.XmlFile = @"c:\data.xml";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = "Table1";
+ conn.Tables.Add(table);
+
+
+ TableDataSource ds = report.GetDataSource("My DataSource Name") as TableDataSource;
+ ds.Parameters[0].Value = 10;
+
+ This way is not good because you hardcode the report object's name.
+
+ Report report1;
+ DataSourceBase customersTable = report1.Dictionary.DataSources.FindByAlias("Customers");
+ DataSourceBase ordersTable = report1.Dictionary.DataSources.FindByAlias("Orders");
+ Relation rel = new Relation();
+ rel.Name = "customersOrders";
+ rel.ParentDataSource = customersTable;
+ rel.ChildDataSource = ordersTable;
+ rel.ParentColumns = new string[] { "CustomerID" };
+ rel.ChildColumns = new string[] { "CustomerID" };
+ report1.Dictionary.Relations.Add(rel);
+
+
+ Report report1;
+ OleDbDataConnection conn = new OleDbDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ OdbcDataConnection conn = new OdbcDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsSqlDataConnection conn = new MsSqlDataConnection();
+ conn.ConnectionString = "your_connection_string";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ Report report1;
+ MsAccessDataConnection conn = new MsAccessDataConnection();
+ conn.DataSource = @"c:\data.mdb";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder(oleDbConnection1.ConnectionString);
+ builder.PersistSecurityInfo = false;
+ oleDbConnection1.ConnectionString = builder.ToString();
+
+
+ public override Type GetConnectionType()
+ {
+ return typeof(OleDbConnection);
+ }
+
+
+ public override DbDataAdapter GetAdapter(string selectCommand, DbConnection connection,
+ CommandParameterCollection parameters)
+ {
+ OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand, connection as OleDbConnection);
+ foreach (CommandParameter p in parameters)
+ {
+ OleDbParameter parameter = adapter.SelectCommand.Parameters.Add(p.Name, (OleDbType)p.DataType, p.Size);
+ parameter.Value = p.Value;
+ }
+ return adapter;
+ }
+
+
+ Report report1;
+ CsvDataConnection conn = new CsvDataConnection();
+ conn.CsvFile = @"c:\data.csv";
+ report1.Dictionary.Connections.Add(conn);
+ conn.CreateAllTables();
+
+
+ dataSource.Init();
+ while (dataSource.HasMoreRows)
+ {
+ // do something...
+ dataSource.Next();
+ }
+
+
+ Report report1;
+ Parameter par = new Parameter();
+ par.Name = report1.Dictionary.CreateUniqueName("Parameter");
+ report1.Parameters.Add(par);
+
+
+ Report report1;
+ DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
+ TableDataSource table = new TableDataSource();
+ table.TableName = "Employees";
+ table.Name = report1.Dictionary.CreateUniqueName("EmployeesTable");
+ table.Alias = report1.Dictionary.CreateUniqueAlias("Employees");
+ conn.Tables.Add(table);
+
+
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 108, "Objects,Shapes,Rectangle", 0);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 109, "Objects,Shapes,RoundRectangle", 1);
+ RegisteredObjects.Add(typeof(ShapeObject), "ReportPage,Shapes", 110, "Objects,Shapes,Ellipse", 2);
+
+
+ public override void OnBeforeInsert(int flags)
+ {
+ FShape = (ShapeKind)flags;
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+
+
+ Report report1;
+ ReportPage page = new ReportPage();
+ page.Parent = report1;
+
+ public DataHeaderBand Header
+ {
+ get { return FHeader; }
+ set
+ {
+ SetProp(FHeader, value);
+ FHeader = value;
+ }
+ }
+
+ <TextObject Name="Text2" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+
+
+ <DataBand Name="Data1" Top="163" Width="718.2" Height="18.9">
+ <TextObject Name="Text3" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
+ </DataBand>
+
+
+ protected override void DeserializeSubItems(FRReader reader)
+ {
+ if (String.Compare(reader.ItemName, "Styles", true) == 0)
+ reader.Read(Styles);
+ else
+ base.DeserializeSubItems(reader);
+ }
+
+
+ TextObject text1 = report1.FindObject("Text1") as TextObject;
+ if (text1 != null)
+ {
+ // object found
+ }
+
+
+ TextObject textObj = new TextObject();
+ dataBand1.Objects.Add(textObj);
+ textObj.CreateUniqueName();
+
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings, do not copy report objects
+ report2.Assign(report1);
+
+ Report report1;
+ Report report2 = new Report();
+ // copy all report settings and objects
+ report2.AssignAll(report1);
+
+ public void OnBeforePrint(EventArgs e)
+ {
+ if (BeforePrint != null)
+ BeforePrint(this, e);
+ InvokeEvent(BeforePrintEvent, e);
+ }
+
+ TextObject text1;
+ // set Height to 10mm
+ text1.Height = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Height = " + (text1.Height / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Left to 10mm
+ text1.Left = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Left = " + (text1.Left / Units.Millimeters).ToString() + "mm");
+
+ TextObject text1;
+ // set Top to 10mm
+ text1.Top = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Top = " + (text1.Top / Units.Millimeters).ToString() + "mm");
+
+ private void Data1_BeforePrint(object sender, EventArgs e)
+ {
+ Text1.Visible = [Orders.Shipped] == true;
+ }
+
+ TextObject text1;
+ // set Width to 10mm
+ text1.Width = Units.Millimeters * 10;
+ // convert a value to millimeters
+ MessageBox.Show("Width = " + (text1.Width / Units.Millimeters).ToString() + "mm");
+
+ frmPopup popup = new frmPopup();
+ Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
+ popupHelper.ShowPopup(this, popup, location);
+
+
+ Designer designer = new Designer();
+ designer.Parent = form1;
+ designer.Report = report1;
+
+
+ DesignerControl designer = new DesignerControl();
+ designer.MdiMode = true;
+ designer.ShowDialog();
+
+
+ // add an event handler that will be fired when the designer is run
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ // override "New..." command behavior
+ (sender as Designer).cmdNew.CustomAction += new EventHandler(cmdNew_CustomAction);
+ }
+
+ void cmdNew_CustomAction(object sender, EventArgs e)
+ {
+ // show the "Label" wizard instead of standard "Add New Item" dialog
+ Designer designer = sender as Designer;
+ LabelWizard wizard = new LabelWizard();
+ wizard.Run(designer);
+ }
+
+
+ Config.DesignerSettings.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ Config.DesignerSettings.PageAdded += new EventHandler(DesignerSettings_PageAdded);
+
+ void DesignerSettings_PageAdded(object sender, EventArgs e)
+ {
+ if (sender is ReportPage)
+ (sender as ReportPage).TopMargin = 0;
+ }
+
+
+ Config.DesignerSettings.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ Config.DesignerSettings.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ Config.DesignerSettings.AddCustomConnection(typeof(MsAccessDataConnection), @"Data Source=c:\data.mdb");
+
+
+ public void SaveState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ xi.SetProp("ShowGrid", DialogWorkspace.ShowGrid ? "1" : "0");
+ }
+
+
+ public void RestoreState()
+ {
+ XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
+ DialogWorkspace.ShowGrid = xi.GetProp("ShowGrid") != "0";
+ }
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ MessagesWindow window = designer.Plugins.Find("MessagesWindow") as MessagesWindow;
+
+
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolbar));
+
+
+ Designer designer;
+ MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
+
+
+ DesignerPlugins.Add(typeof(MyToolWindow));
+
+
+ Designer designer;
+ DesignerMenu menu = designer.Plugins.FindType("DesignerMenu") as DesignerMenu;
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ environmentSettings1.DesignerLoaded += new EventHandler(DesignerSettings_DesignerLoaded);
+
+ void DesignerSettings_DesignerLoaded(object sender, EventArgs e)
+ {
+ (sender as DesignerControl).MainMenu.miFileSelectLanguage.Visible = false;
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (OpenFileDialog dialog = new OpenFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ dialog.Filter = "Report files (*.frx)|*.frx";
+ // get default file name from e.FileName
+ dialog.FileName = e.FileName;
+
+ // set e.Cancel to false if dialog was succesfully executed
+ e.Cancel = dialog.ShowDialog() != DialogResult.OK;
+ // set e.FileName to the selected file name
+ e.FileName = dialog.FileName;
+ }
+ }
+
+ private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // load the report from the given e.FileName
+ e.Report.Load(e.FileName);
+ }
+
+ private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
+ {
+ // save the report to the given e.FileName
+ e.Report.Save(e.FileName);
+ }
+
+
+ environmentSettings1.CustomPreviewReport += new EventHandler(MyPreviewHandler);
+
+ private void MyPreviewHandler(object sender, EventArgs e)
+ {
+ Report report = sender as Report;
+ using (MyPreviewForm form = new MyPreviewForm())
+ {
+ report.Preview = form.previewControl1;
+ report.ShowPreparedReport();
+ form.ShowDialog();
+ }
+ }
+
+
+ environmentSettings1.FilterConnectionTables += DesignerSettings_FilterConnectionTables;
+
+ private void DesignerSettings_FilterConnectionTables(object sender, FilterConnectionTablesEventArgs e)
+ {
+ if (e.TableName == "Table 1")
+ e.Skip = true;
+ }
+
+
+ ReportPage page = report.Pages[0] as ReportPage;
+
+ // create the main group
+ GroupHeaderBand mainGroup = new GroupHeaderBand();
+ mainGroup.Height = Units.Millimeters * 10;
+ mainGroup.Name = "MainGroup";
+ mainGroup.Condition = "[Orders.CustomerName]";
+ // add a group to the page
+ page.Bands.Add(mainGroup);
+
+ // create the nested group
+ GroupHeaderBand nestedGroup = new GroupHeaderBand();
+ nestedGroup.Height = Units.Millimeters * 10;
+ nestedGroup.Name = "NestedGroup";
+ nestedGroup.Condition = "[Orders.OrderDate]";
+ // add it to the main group
+ mainGroup.NestedGroup = nestedGroup;
+
+ // create a data band
+ DataBand dataBand = new DataBand();
+ dataBand.Height = Units.Millimeters * 10;
+ dataBand.Name = "GroupData";
+ dataBand.DataSource = report.GetDataSource("Orders");
+ // connect the databand to the nested group
+ nestedGroup.Data = dataBand;
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.NestedGroup = new GroupHeaderBand();
+ group.NestedGroup.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ ReportPage page;
+ GroupHeaderBand group = new GroupHeaderBand();
+ group.Data = new DataBand();
+ page.Bands.Add(group);
+
+
+ myPictureObject.Image = new Bitmap("file.bmp");
+ myPictureObject.ShouldDisposeImage = true;
+
+
+ Config.PreviewSettings.Buttons = PreviewButtons.Open |
+ PreviewButtons.Save |
+ PreviewButtons.Find |
+ PreviewButtons.Zoom |
+ PreviewButtons.Outline |
+ PreviewButtons.PageSetup |
+ PreviewButtons.Edit |
+ PreviewButtons.Watermark |
+ PreviewButtons.Navigator |
+ PreviewButtons.Close;
+
+
+ Report report = new Report();
+ report.Load("reportfile.frx");
+ report.RegisterData(application_dataset);
+ report.Show();
+
+
+ Report report = new Report();
+ // create the report page
+ ReportPage page = new ReportPage();
+ page.Name = "ReportPage1";
+ // set paper width and height. Note: these properties are measured in millimeters.
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // add a page to the report
+ report.Pages.Add(page);
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create Text object and put it to the title
+ TextObject text = new TextObject();
+ text.Name = "Text1";
+ text.Bounds = new RectangleF(0, 0, Units.Millimeters * 100, Units.Millimeters * 5);
+ page.ReportTitle.Objects.Add(text);
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to a page
+ page.Bands.Add(data);
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ if (report.Prepare())
+ {
+ PrinterSettings printerSettings = null;
+ if (report.ShowPrintDialog(out printerSettings))
+ {
+ report.PrintPrepared(printerSettings);
+ }
+ }
+
+
+ ReportPage page1 = report1.Pages[0] as ReportPage;
+
+
+ using System.Security;
+ using System.Security.Permissions;
+ ...
+ PermissionSet ps = new PermissionSet(PermissionState.None);
+ ps.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
+ report1.ScriptRestrictions = ps;
+ report1.Prepare();
+
+
+ SimpleListReport report = new SimpleListReport();
+ report.RegisterData(your_dataset);
+ report.Show();
+
+
+ string employeeName = (string)report.GetColumnValue("Employees.FirstName");
+
+
+ // load the report
+ report1.Load("report.frx");
+ // setup the parameter
+ report1.SetParameterValue("MyParam", 10);
+ // show the report
+ report1.Show();
+
+ report.AddReferencedAssembly("Newtonsoft.Json.dll")
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1, "NorthWind", true);
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(dataSet1.Tables["Orders"], "Orders");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataView, "OrdersView");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myDataRelation, "myRelation");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myBusinessObject, "Customers");
+
+
+ report1.Load("report.frx");
+ report1.RegisterData(myCubeLink, "Orders");
+
+
+ Report report = new Report();
+ report.Load("report1.frx");
+ report.Prepare();
+ report.Load("report2.frx");
+ report.Prepare(true);
+ report.ShowPrepared();
+
+
+ textObject1.Fill = new SolidFill(Color.Green);
+ (textObject1.Fill as SolidFill).Color = Color.Red;
+
+ reportComponent1.Fill = new SolidFill(color);
+
+ ReportPage page = new ReportPage();
+ // set the paper in millimeters
+ page.PaperWidth = 210;
+ page.PaperHeight = 297;
+ // create report title
+ page.ReportTitle = new ReportTitleBand();
+ page.ReportTitle.Name = "ReportTitle1";
+ page.ReportTitle.Height = Units.Millimeters * 10;
+ // create data band
+ DataBand data = new DataBand();
+ data.Name = "Data1";
+ data.Height = Units.Millimeters * 10;
+ // add data band to the page
+ page.Bands.Add(data);
+ // add page to the report
+ report.Pages.Add(page);
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ using (MyLoginDialog dialog = new MyLoginDialog())
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ e.UserName = dialog.UserName;
+ e.Password = dialog.Password;
+ }
+ }
+ }
+
+
+ private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
+ {
+ e.ConnectionString = my_connection_string;
+ }
+
+
+ // create the main report page
+ ReportPage reportPage = new ReportPage();
+ reportPage.Name = "Page1";
+ report.Pages.Add(reportPage);
+ // create report title band
+ reportPage.ReportTitle = new ReportTitleBand();
+ reportPage.ReportTitle.Name = "ReportTitle1";
+ reportPage.ReportTitle.Height = Units.Millimeters * 10;
+ // add subreport on it
+ SubreportObject subreport = new SubreportObject();
+ subreport.Name = "Subreport1";
+ subreport.Bounds = new RectangleF(0, 0, Units.Millimeters * 25, Units.Millimeters * 5);
+ reportPage.ReportTitle.Objects.Add(subreport);
+ // create subreport page
+ ReportPage subreportPage = new ReportPage();
+ subreportPage.Name = "SubreportPage1";
+ report.Pages.Add(subreportPage);
+ // connect the subreport to the subreport page
+ subreport.ReportPage = subreportPage;
+
+
+ text1.TextFill = new HatchFill(Color.Black, Color.White, HatchStyle.Cross);
+
+ Use the textObject1.TextFill = new SolidFill(color);
+
+ TextObject text1;
+ HighlightCondition highlight = new HighlightCondition();
+ highlight.Expression = "Value < 0";
+ highlight.Fill = new SolidFill(Color.Red);
+ highlight.ApplyFill = true;
+ text1.Highlight.Add(highlight);
+
+
+ TextObject text1;
+ text1.Format = new CurrencyFormat();
+
+
+ text1.Formats.Clear();
+ text1.Formats.Add(new DateFormat());
+ text1.Formats.Add(new NumberFormat());
+
+
+ CrossViewObject crossView;
+ // change the fill color of the first matrix cell
+ crossView.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ DialogPage form = new DialogPage();
+ // set the width and height in pixels
+ form.Width = 200;
+ form.Height = 200;
+ form.Name = "Form1";
+ // create a button
+ ButtonControl button = new ButtonControl();
+ button.Location = new Point(20, 20);
+ button.Size = new Size(75, 25);
+ button.Text = "The button";
+ // add the button to the form
+ form.Controls.Add(button);
+
+
+ protected override void AttachEvents()
+ {
+ base.AttachEvents();
+ CheckBox.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
+ }
+
+ private void CheckBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if (CheckedChanged != null)
+ CheckedChanged(this, e);
+ InvokeEvent(CheckedChangedEvent, e);
+ }
+
+
+ protected override void DetachEvents()
+ {
+ base.DetachEvents();
+ CheckBox.CheckedChanged -= new EventHandler(CheckBox_CheckedChanged);
+ }
+
+
+ protected override void FillData(DataSourceBase dataSource, Column column)
+ {
+ Items.Clear();
+ dataSource.First();
+ while (dataSource.HasMoreRows)
+ {
+ Items.Add(dataSource[column].ToString());
+ dataSource.Next();
+ }
+ }
+
+
+ protected override void Done()
+ {
+ base.Done();
+ ImageExport imageExport = Export as ImageExport;
+ imageExport.ImageFormat = (ImageExportFormat)cbxImageFormat.SelectedIndex;
+ imageExport.Resolution = (int)udResolution.Value;
+ imageExport.JpegQuality = (int)udQuality.Value;
+ imageExport.SeparateFiles = cbSeparateFiles.Checked;
+ }
+
+
+ public override void Init(ExportBase export)
+ {
+ base.Init(export);
+ ImageExport imageExport = Export as ImageExport;
+ cbxImageFormat.SelectedIndex = (int)imageExport.ImageFormat;
+ udResolution.Value = imageExport.Resolution;
+ udQuality.Value = imageExport.JpegQuality;
+ cbSeparateFiles.Checked = imageExport.SeparateFiles;
+ }
+
+
+ public DialogPageOptions(DialogPageDesigner pd) : base()
+ {
+ FPageDesigner = pd;
+ InitializeComponent();
+ }
+
+
+ // create an instance of MatrixObject
+ MatrixObject matrix = new MatrixObject();
+ matrix.Name = "Matrix1";
+ // add it to the report title band of the first report page
+ matrix.Parent = (report.Pages[0] as ReportPage).ReportTitle;
+
+ // create two column descriptors
+ MatrixHeaderDescriptor column = new MatrixHeaderDescriptor("[MatrixDemo.Year]");
+ matrix.Data.Columns.Add(column);
+ column = new MatrixHeaderDescriptor("[MatrixDemo.Month]");
+ matrix.Data.Columns.Add(column);
+
+ // create one row descriptor
+ MatrixHeaderDescriptor row = new MatrixHeaderDescriptor("[MatrixDemo.Name]");
+ matrix.Data.Rows.Add(row);
+
+ // create one data cell
+ MatrixCellDescriptor cell = new MatrixCellDescriptor("[MatrixDemo.Revenue]", MatrixAggregateFunction.Sum);
+ matrix.Data.Cells.Add(cell);
+
+ // connect matrix to a datasource
+ matrix.DataSource = Report.GetDataSource("MatrixDemo");
+
+ // create the matrix template
+ matrix.BuildTemplate();
+
+ // change the style
+ matrix.Style = "Green";
+
+ // change the column and row total's text to "Grand Total"
+ matrix.Data.Columns[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ // suppose we have a matrix with one column, row and data cell.
+ // provide 3 one-dimensional arrays with one element in each to the AddValue method
+ Matrix1.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 21.35f });
+ Matrix1.Data.AddValue(
+ new object[] { 1997 },
+ new object[] { "Nancy Davolio" },
+ new object[] { 421.5f });
+
+ // this code will produce the following matrix:
+ // | 1996 | 1997 |
+ // --------------+--------+--------+
+ // Andrew Fuller | 123.45| 21.35|
+ // --------------+--------+--------+
+ // Nancy Davolio | | 421.50|
+ // --------------+--------+--------+
+
+
+ MatrixObject matrix;
+ matrix.Data.AddValue(
+ new object[] { 1996 },
+ new object[] { "Andrew Fuller" },
+ new object[] { 123.45f });
+
+ // this will produce the following result:
+ // | 1996 |
+ // --------------+----------+
+ // Andrew Fuller | 123.45|
+ // --------------+----------+
+
+
+ MatrixObject matrix;
+ // change the fill color of the first matrix cell
+ matrix.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+
+
+ MatrixObject matrix;
+ matrix.Data.Rows[0].TemplateTotalCell.Text = "Grand Total";
+ matrix.Data.Rows[0].TemplateTotalCell.Fill = new SolidFill(Color.Green);
+
+
+ report.Load("...");
+ MSChartObject reportChart = report.FindObject("MSChart1") as MSChartObject;
+ reportChart.AssignChart(applicationChart);
+ report.Show();
+
+
+ // print table header (the first row)
+ Table1.PrintRow(0);
+ Table1.PrintColumns();
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintRow(1);
+ Table1.PrintColumns();
+ }
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ Table1.PrintColumns();
+
+
+
+ // print table header (the first column)
+ Table1.PrintColumn(0);
+ Table1.PrintRows();
+ // print table body (the second column)
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ Table1.PrintRows();
+ }
+ // print table footer (the third column)
+ Table1.PrintColumn(2);
+ Table1.PrintRows();
+
+
+
+ // print the first row with all its columns
+ Table1.PrintRow(0);
+ // print header column
+ Table1.PrintColumn(0);
+ // print 10 data columns
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ // print footer column
+ Table1.PrintColumn(2);
+
+ // print table body (the second row)
+ for (int i = 0; i < 10; i++)
+ {
+ // print data row with all its columns
+ Table1.PrintRow(1);
+ Table1.PrintColumn(0);
+ for (int j = 0; j < 10; j++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+ }
+
+ // print table footer (the third row)
+ Table1.PrintRow(2);
+ // again print all columns in the table footer
+ Table1.PrintColumn(0);
+ for (int i = 0; i < 10; i++)
+ {
+ Table1.PrintColumn(1);
+ }
+ Table1.PrintColumn(2);
+
+
+ TableCell cell1;
+ PictureObject picture1 = new PictureObject();
+ picture1.Bounds = new RectangleF(0, 0, 32, 32);
+ picture1.Name = "Picture1";
+ cell1.Objects.Add(picture1);
+
+
+ // right-align the table
+ Table1.ResultTable.Left = Engine.PageWidth - Table1.ResultTable.CalcWidth() - 1;
+
+
+ public void Draw(FRPaintEventArgs e)
+ {
+ Brush brush = e.Cache.GetBrush(BackColor);
+ Pen pen = e.Cache.GetPen(BorderColor, 1, BorderStyle);
+ e.Graphics.FillRectangle(brush, Bounds);
+ e.Graphics.DrawRectangle(pen, Bounds);
+ }
+
+