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(MsSqlDataConnection));
// 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;
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);
CrossViewObject crossView;
// change the fill color of the first matrix cell
crossView.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
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;
// 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);
}
Designer designer = new Designer();
designer.Parent = form1;
designer.Report = report1;
DesignerControl designer = new DesignerControl();
designer.MdiMode = true;
designer.ShowDialog();
Designer designer;
DesignerMenu menu = designer.Plugins.FindType("DesignerMenu") as DesignerMenu;
DesignerPlugins.Add(typeof(MyToolbar));
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;
}
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);
}
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");
Designer designer;
MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
DesignerPlugins.Add(typeof(MyToolWindow));
DesignerPlugins.Add(typeof(MyToolbar));
MessagesWindow window = designer.Plugins.Find("MessagesWindow") as MessagesWindow;
MessagesWindow window = designer.Plugins.FindType("MessagesWindow") as MessagesWindow;
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";
}
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();
report1.Preview = previewControl1;
report1.Show();
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();
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;
}
// 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;
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());
// 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;
myPictureObject.Image = new Bitmap("file.bmp");
myPictureObject.ShouldDisposeImage = 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);
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;
}
Config.PreviewSettings.Buttons = PreviewButtons.Open |
PreviewButtons.Save |
PreviewButtons.Find |
PreviewButtons.Zoom |
PreviewButtons.Outline |
PreviewButtons.PageSetup |
PreviewButtons.Edit |
PreviewButtons.Watermark |
PreviewButtons.Navigator |
PreviewButtons.Close;
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);
}