Puede añadir el diseñador del FastReport.NET para los usarios finales y para eso no se necesita comprar una licencia adicional. Esto quiere decir que puede añadir el generador de informes sólo a productos sin código fuente y fuera del ambiente de desarrollo
Sobre los componentes Enterprise consulta el siguiente apartado: http://www.fast-report.com/pbc_download/EnterpriseEn.pdf
Básicamente nuestros productos tienen tres tipos de licencia: licencia Single, licencia Team y licencia Site. La licencia Single es una licencia sólo para un desarrollador; la licencia Team, que también incluye licencia para el Build servidor, es para cuatro desarroladores; la licencia Site, que también incluye licencia para Build servidor, es para un número de desarrolladores ilimitado.
Renew a subscription You can renew a subscription in your control panel. The subscription includes the technical support and product updates. It is available at a 1/3 of the full price per year. When your subscription is expired, you have two options: - renew a subscription. This will allow you to get a technical support and product updates. - continue to use the FastReport .NET. In this case, you will not able to use recent product updates and get technical support.
Pediremos a nuestro distribuidor que le devuelva la cantidad del descuento. Debería ponerse en contacto con el servicio al cliente.
Debería ponerse en contacto con el servicio al cliente. Quizás haya ocurrido un error al registrar su perfil.
Vamos a realizarlo. Póngase en contacto con el servicio al cliente.
Puede obtener un discuento de 30 % para la licencia Single. El precio de la licencia Team - 30 % de la licencia Single = su precio. Póngase en contacto con el servicio al cliente para más información. Le vamos a enviar el pedido.
Debería añadir FastReport.Editor.dll, FastReport.VSDesign.dll, FastReport.Web y FastReport.dll a GAC. Para ello, abra la carpeta Visual studio tools (C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts), abra Developer Command Prompt for..., y escriba en la línea de comandos gacutil -i "reference path+ name.dll"(gacutil -i "Program Files\FastReports\FastReport.Net\Framework 4.0\FastReport.dll"). Más información sobre GAC puede encontrar aquí:
https://msdn.microsoft.com/en-us/library/dkkx7f79(v=vs.110).aspx
A continuación añada los elementos de control a Visual Studio Toolbox: haga clic en Toolbox -> Choose Items -> Choose FastReport.dll desde GAC y pulse OK.
Si invoca la propiedad del objeto .Height (Text1.Height), el resultado será la altura del objeto en el modelo de informe.
A la hora de compilar un informe la altura se cambiará y para determinar la altura en el informe preparado debería utilizar el método CalcHeight(Text1.CalcHeight()). Para calcular la anchura también se utiliza el método CalcWidth.
Asegúrese de que el proyecto incluya hipervínculos a las bibliotecas necesarias(FastReport.dll, FastReport.Web.dll). Revise la versión de .NET Framework que tuilizan el proyecto y las bibliotecas conectadas.
Debería desinstalar la versión Trial. A continuación, compruebe los directorios C:\Windows\assembly y C:\Windows\Microsoft.NET\assembly\GAC_MSIL. No debe incluir las bibliotecas FastReport.NET. Si no es así, elimínalos. Ahora puede instalar la versión completa de FastReport.NET.
Utilizando este fragmento:
Report report = new Report();
report.Load(...);
report.RegisterData(...);
report.Prepare();
PDFExport pdfExport = new PDFExport();
EmailExport export = new EmailExport();
// set up Account properties...
export.Account.Host = "...";
export.Account.Address = "...";
// set up email properties...
export.Address = "...";
export.Subject = "...";
export.MessageBody = "...";
// send email
export.Export = pdfExport;
export.SendEmail(report);
Añada el control EnvironmentSettings a su formulario.
A continuación, antes de invocar report.Design(), añada las siguientes líneas:
1 2 |
EnvironmentSettings1.DesignerSettings.Restrictions.DontCreateData = True; EnvironmentSettings1.DesignerSettings.Restrictions.DontEditData = True; |
Si utiliza DesignerControl, añada estas líneas:
1 2 |
designerControl1.Restrictions.DontCreateData = true; designerControl1.Restrictions.DontEditData = true; |
De esta manera los elementos de control Data se desactivarán.
1. Cree un nuevo informe:
Report report = new Report();
2. Añada el evento CustomLoadEventHandler para cargar el informe básico:
report.LoadBaseReport += new CustomLoadEventHandler(FReport_LoadBaseReport);
3. Carga el informe que se herede:
report.Load("InheritReport.frx");
4. Elimine CustomLoadEventHandler:
report.LoadBaseReport -= new CustomLoadEventHandler(FReport_LoadBaseReport);
5. Ahora puede mostrar el informe o abrirlo en el diseñador. Contiene el informe que se hereda y el que hereda el informe básico:
report.Show();
También tiene que crear un evento para cargar el informe básico:
1 2 3 4 5 6 |
private void FReport_LoadBaseReport(object sender, CustomLoadEventArgs e) { // e.FileName contains the name of base report. It may be the file name, or an ID in the database, // it depends on how you load the main report e.Report.Load("C:\\Users\\InheritReport\\bin\\Debug\\Title2.frx"); } |
Y el código completo:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Report report = new Report(); report.LoadBaseReport += new CustomLoadEventHandler(FReport_LoadBaseReport); report.Load("InheritReport.frx"); report.LoadBaseReport -= new CustomLoadEventHandler(FReport_LoadBaseReport); report.Show(); } private void FReport_LoadBaseReport(object sender, CustomLoadEventArgs e) { // e.FileName contains the name of base report. It may be the file name, or an ID in the database, // it depends on how you load the main report e.Report.Load("C:\\Users\\InheritReport\\bin\\Debug\\Title2.frx"); } } |
Si desea cargar un informe de la base de datos, remplace el método Load() por LoadFromString().
Puede escribir un código JS en el objeto TextObject.Huperlink object(javascript:alert('¡Ha hecho un clic!!')).
O escribir la función en el fichero *.aspx(cshtml):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestInheritReports._Default" %> <%@ Register assembly="FastReport.Web" namespace="FastReport.Web" tagprefix="cc2" %> <script type="text/javascript"> function count_rabbits() { for(var i=1; i<=3; i++) { alert("Pull out from hat rabbit " + i +" !") } } </script> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">; <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> <cc2:WebReport ID="WebReport1" runat="server" /> </form> </body> </html> |
Y invocar la función:
TextObject1.Hyperlink = "javascript:count_rabbits()";
Añada el control EnvironmentSettings a tu formulario.
A continuación, antes de la invocación de report.Design(), añada la siguiente línea:
environmentSettings1.DesignerSettings.Restrictions.DontEditCode = true;
Debería utilizar el control WindowsFormsHost:
0) Añada hipervínculo a FastReport.dll;
1) Añada atributo en la etiqueta Window(Page): xmlns:fr="clr-namespace:FastReport.Preview;assembly=FastReport" if you want to use PreviewControl, xmlns:fr1="clr-namespace:FastReport.Design;assembly=FastReport" - if DesignerControl;
2) Añada la etiqueta WindowsFormsHost en su marca XAML:
1 2 3 |
<WindowsFormsHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="3"> </WindowsFormsHost> |
3) Añada etiqueta hijo en WindowsFormsHost: <fr:PreviewControl></fr:PreviewControl> or <fr1:Designer></fr1:Designer>.
La marca completa se tiene que ver como este fragmento:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="WpfApplication1.MainWindow" Title="MainWindow" Height="375.977" Width="939.258" xmlns:fr="clr-namespace:FastReport.Preview;assembly=FastReport"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <WindowsFormsHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="3"> <fr:PreviewControl></fr:PreviewControl> </WindowsFormsHost> </Grid> </Window> |
You can do this in script or in your project using this code:
1 2 3 4 5 |
FastReport.Format.NumberFormat format = new FastReport.Format.NumberFormat(); format.UseLocale = false; format.DecimalDigits = 2; format.DecimalSeparator = "."; format.GroupSeparator = ","; |
and following that:
1 2 |
textObject.Formats.Clear(); textObject.Formats.Add(format); |
En MSChartObject debería crear el objeto básico para Series System.Windows.Forms.DataVisualization.Charting.Series y luego crear una línea allí. A continuación, debería asignar la serie creada para el objeto básico para MSChartObject (MSChart1.Chart.Series.Add(series); No se olvide añadir la biblioteca System.Windows.Forms.DataVisualization.dll (en el menú Informe -> Script) y el área de nombres System.Windows.Forms.DataVisualization.Charting.
Es un ejemplo de una línea con campos:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
. . using System.Windows.Forms.DataVisualization.Charting; namespace FastReport { public class ReportScript { private void MSChart1_BeforePrint(object sender, EventArgs e) { Series series = new Series("sample"); series.ChartType = SeriesChartType.Line; series.BorderWidth = 2; series.MarkerSize = 5; series.Points.Add(new DataPoint(0, 1)); series.Points.Add(new DataPoint(1, 2)); DataPoint dp = new DataPoint(2, double.NaN); dp.IsEmpty = true; series.Points.Add(dp); series.Points.Add(new DataPoint(3, 5)); series.Points.Add(new DataPoint(4, 8)); MSChart1.Chart.Series.Add(series); } } } |
Result:
1. Create new MSChart object, set width, height and legend:
2. Create ChartArea object, set name, axes titles and assign created ChartArea to MSChart:
1 2 3 4 5 |
ChartArea chartArea1 = new ChartArea(); chartArea1.Name = "ChartArea1"; chartArea1.Axes[0].Title = "X name"; chartArea1.Axes[1].Title = "Y name"; MSChart1.Chart.ChartAreas.Add(chartArea1); |
3. Create Series object, set chart type, border width, add points and assign series to chart:
1 2 3 4 5 6 7 8 9 |
Series series = new Series("sample"); series.ChartType = SeriesChartType.Line; series.BorderWidth = 2; series.Points.Add(new DataPoint(0, 1)); series.Points.Add(new DataPoint(1, 2)); series.Points.Add(new DataPoint(3, 5)); series.Points.Add(new DataPoint(4, 8)); MSChart1.Chart.Series.Add(series); |
4. Assign created MSChart to DataBand:
1 2 3 4 5 |
Report report = new Report(); report.Load("ok.frx"); DataBand db = report.FindObject("Data1") as DataBand; MSChart1.Parent = db; |
And full snippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
MSChartObject MSChart1 = new MSChartObject(); MSChart1.Width = 300; MSChart1.Height = 300; MSChart1.Chart.Legends.Add(new Legend() { Name = "Legend1", Title="Legend title"}); ChartArea chartArea1 = new ChartArea(); chartArea1.Name = "ChartArea1"; chartArea1.Axes[0].Title = "X name"; chartArea1.Axes[1].Title = "Y name"; MSChart1.Chart.ChartAreas.Add(chartArea1); Series series = new Series("sample"); series.ChartType = SeriesChartType.Line; series.BorderWidth = 2; series.Points.Add(new DataPoint(0, 1)); series.Points.Add(new DataPoint(1, 2)); series.Points.Add(new DataPoint(3, 5)); series.Points.Add(new DataPoint(4, 8)); MSChart1.Chart.Series.Add(series); Report report = new Report(); report.Load("ok.frx"); DataBand db = report.FindObject("Data1") as DataBand; MSChart1.Parent = db; |
Result:
Send us an email about this on support.fast-report.com and we'll give you the nearest accessible for you version.
Puede desactivar ProgressForm en EnvironmentSettings
Report report = new Report();
report.LoadPrepared("1.fpx");
EnvironmentSettings s = new EnvironmentSettings();
s.ReportSettings.ShowProgress = false;
report.Show();
You should delete FastReport.config file from C:\Users\"Your user's name"\AppData\Local\FastReport folder.
You could find needed localization *.frl file in FastReports\FastReport.Net\Localization folder and improve it. Ask us (support.fast-report.com) for english localization file, if there is no fields in needed file. Add fields according to english version. Then send your improved translation to us and get reward!
Send us an email about this on tz@fast-report.com or support.fast-report.com and we'll give you the english localization file for creating needed localization. Send us your localization file (*.frl) and we'll add it in the new build and also will give you a reward!
You should use the following snippet:
Report.Dictionary.Connections[0].Tables[0].Parameters[0].Value.ToString();
Use this snippet for it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
Report report = new Report(); report.LoadPrepared("preparedreport.fpx"); HTMLExport htmlExport = new HTMLExport() { SubFolder = false, Navigator = false, Pictures = true, EmbedPictures = true, SinglePage = true, Layers = true, HasMultipleFiles = false }; EmailExport email = new EmailExport(); //email mailer settings email.Account.Address = "Email@gmail.com"; email.Account.Name = "Usename"; email.Account.Host = "smtp.yandex.ru"; email.Account.Port = 25; email.Account.UserName = "Email"; email.Account.Password = "password"; email.Account.MessageTemplate = "Test"; email.Account.EnableSSL = true; //email addressee settings email.Address = "Destinationaddress@gmail.com"; email.Subject = "Embedding of html"; email.Export = htmlExport; //Set export type email.SendEmail(report); //Send email |
If you can't run demos from Demos\C#\Web folder, then you should:
1. Repair NuGet packages;
2. Add all necessary references from "packages";
3. Change build versions on the current in Web.Config from root folder and in Views.
You should use for it this snippets.
For desktop version:
1 2 3 4 5 6 7 8 |
Report report = new Report(); report.Load(Path.GetFullPath(@"..\..\Report1.frx")); report.Prepare(true); report.Load(Path.GetFullPath(@"..\..\Report2.frx")); report.Prepare(true); report.Load(Path.GetFullPath(@"..\..\Report3.frx")); report.Prepare(true); report.ShowPrepared(); |
For web version:
1 2 3 4 5 6 7 8 |
webReport.Report.Load(Path.GetFullPath(@"..\..\Report1.frx")); webReport.Report.Prepare(true); webReport.Report.Load(Path.GetFullPath(@"..\..\Report2.frx")); webReport.Report.Prepare(true); webReport.Report.Load(Path.GetFullPath(@"..\..\Report3.frx")); webReport.Report.Prepare(true); webReport.ShowRefreshButton = false; webReport.ReportDone = true; |
Load report into application resources:
1)Go to Visual Studio Resourses tab ( Project -> Properties -> Resources);
2) Set name (report) and set resources content ( from myreport.frx file);
Call report from resources:
1 2 3 |
Report report = new Report(); report.ReportResourceString = Resources.report; report.Show(); |
Use this snippet:
1 2 3 |
Report report = new Report;
List<string> assmbly = new List<string>(report.ReferencedAssemblies); assmbly.Add("Newtonsoft.Json.dll"); //replace to your dll's name report.ReferencedAssemblies = assmbly.ToArray(); |
Be sure, that added dll placed in a same folder that FastReport.dll.
Now you can call methods from connected dll. E.g., you can add this expression into TextObject - [Newtonsoft.Json.ConstructorHandling.Default.ToString()].
Use this snippet to set all tables from your data source as enable:
1 2 3 4 |
foreach (FastReport.Data.DataSourceBase tbl in report.Dictionary.DataSources) { tbl.Enabled = true; } |
Then add relations:
1 2 3 4 |
for (int i = 0; i < ds.Relations.Count; i++) { report.RegisterData(ds.Relations[i], "relation" + i); } |
And set relations enabled:
1 2 3 4 |
foreach (FastReport.Data.Relation rl in report.Dictionary.Relations) { rl.Enabled = true; } |
And full code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Report report = new Report(); DataSet ds = new DataSet(); ds.ReadXml("EstimateFile.xml"); report.RegisterData(ds, "ds"); foreach (FastReport.Data.DataSourceBase tbl in report.Dictionary.DataSources) { tbl.Enabled = true; } for (int i = 0; i < ds.Relations.Count; i++) { report.RegisterData(ds.Relations[i], "relation" + i); }
foreach (FastReport.Data.Relation rl in report.Dictionary.Relations) { rl.Enabled = true; } |
FastReport .NET Enterprise consist of:
FastReport .NET Professional and Online Designer.
Add components to a Toolbox manually:
Click "Choose items" in toolbox and choose FastReport.dll from GAC folder (C:\Windows\Microsoft.NET\assembly\GAC_MSIL\FastReport).
We decided to stop supporting the old framework and Visual Studio 2005. We have some difficulties with supporting various code snippets for legacy framework. If you continue to use .NET Framework 2.0 in your applictions, please write to us or use the version of FastReport .NET 2020.2 or earlier.