Skip to content

FastReport.OpenSource 2025.2.4 #757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Copyright>Fast Reports Inc.</Copyright>
<Company>Fast Reports Inc.</Company>
<PackageLicenseUrl>https://www.fast-report.com/en/product/fast-report-net/license</PackageLicenseUrl>
<PackageProjectUrl>https://www.fast-report.com/en/product/fast-report-net</PackageProjectUrl>
<PackageLicenseUrl>https://www.fast-report.com/products/fast-report-net/license</PackageLicenseUrl>
<PackageProjectUrl>https://www.fast-report.com/products/fast-report-net</PackageProjectUrl>
<Authors>Fast Reports Inc.</Authors>
<Product>FastReport.Data.MongoDB</Product>
<Description>Represents a connection to MongoDB database</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ public override string[] GetTableNames()
List<string> list = new List<string>();

MongoClient client = new MongoClient(ConnectionString);

if (String.IsNullOrEmpty(dbName))
{
var mongoUrl = new MongoUrl(ConnectionString);
dbName = mongoUrl.DatabaseName;
}

IMongoDatabase db = client.GetDatabase(dbName);
IAsyncCursor<BsonDocument> collections = db.ListCollections();
foreach (var item in collections.ToList<BsonDocument>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Import Project="..\Connections.props" />

<ItemGroup>
<PackageReference Include="MySqlConnector" Version="[2.2.5,)" />
<PackageReference Include="MySqlConnector" Version="[2.4.0,)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetFrameworkMinimum);net6.0</TargetFrameworks>
<PackageLicenseUrl>https://www.fast-report.com/en/product/fast-report-net/license</PackageLicenseUrl>
<PackageLicenseUrl>https://www.fast-report.com/products/fast-report-net/license</PackageLicenseUrl>
<Description>
Represents a plugin to extend PictureObject supports formats, for FastReport.Core.
This package will not be updated. The $(AssemblyName) package now includes a plugin for all versions of the FastReport product: FastReport .NET, FastReport.Core, FastReport.OpenSource, FastReport.CoreWin (.Net Core 3.1 and .Net 5 Windows).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetFrameworkMinimum);net6.0</TargetFrameworks>
<PackageLicenseUrl>https://www.fast-report.com/en/product/fast-report-net/license</PackageLicenseUrl>
<PackageLicenseUrl>https://www.fast-report.com/products/fast-report-net/license</PackageLicenseUrl>
<Description>
Represents a plugin to extend PictureObject supports formats, for FastReport.OpenSource.
This package will not be updated. The $(AssemblyName) package now includes a plugin for all versions of the FastReport product: FastReport .NET, FastReport.Core, FastReport.OpenSource, FastReport.CoreWin (.Net Core 3.1 and .Net 5 Windows).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetFrameworkMinimum);net6.0-windows</TargetFrameworks>
<PackageLicenseUrl>https://www.fast-report.com/en/product/fast-report-net/license</PackageLicenseUrl>
<PackageLicenseUrl>https://www.fast-report.com/products/fast-report-net/license</PackageLicenseUrl>
<Description>
Represents a plugin to extend PictureObject supports formats. Shared Plugin for all versions of FastReport product: FastReport .NET, FastReport.Core, FastReport.OpenSource.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Copyright>Fast Reports Inc.</Copyright>
<Company>Fast Reports Inc.</Company>
<PackageLicenseUrl>https://github.com/FastReports/FastReport/blob/master/LICENSE.md</PackageLicenseUrl>
<PackageProjectUrl>https://www.fast-report.com/en/product/fast-report-net</PackageProjectUrl>
<PackageProjectUrl>https://www.fast-report.com/products/fast-report-net</PackageProjectUrl>
<Authors>Fast Reports Inc.</Authors>
<Product>FastReport</Product>
<PackageId>FastReport.OpenSource.Export.PdfSimple</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion FastReport.Base/Code/CodeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public virtual async Task CompileAsync(CancellationToken token)
descriptor.AddObjects();
descriptor.AddExpressions();
descriptor.AddFunctions();
await descriptor.CompileAsync();
await descriptor.CompileAsync(token);
}
}

Expand Down
6 changes: 5 additions & 1 deletion FastReport.Base/Code/Ms/MsAssemblyDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ private string GetFullAssemblyReference(string relativeReference, string default
}

// See if the required assembly is present locally
string path = Path.Combine(defaultPath, relativeReference + ".dll");
string path = Path.Combine(defaultPath, relativeReference);
if (File.Exists(path))
return path;

path = Path.Combine(defaultPath, relativeReference + ".dll");
if (File.Exists(path))
return path;

Expand Down
4 changes: 2 additions & 2 deletions FastReport.Base/Data/DataConnectionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public virtual void CreateAllTables(bool initSchema)
bool found = false;
foreach (TableDataSource table in Tables)
{
if (String.Compare(table.TableName, tableName, true) == 0)
if (table is not ProcedureDataSource && String.Compare(table.TableName, tableName, true) == 0)
{
found = true;
break;
Expand Down Expand Up @@ -481,7 +481,7 @@ public virtual void CreateAllProcedures()
bool found = false;
foreach (TableDataSource table in Tables)
{
if (String.Compare(table.TableName, procName, true) == 0)
if (table is ProcedureDataSource && String.Compare(table.TableName, procName, true) == 0)
{
found = true;
break;
Expand Down
17 changes: 17 additions & 0 deletions FastReport.Base/Data/XmlConnectionStringBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ public string XsdFile
}
}

/// <summary>
/// Gets or sets the codepage of .xml file.
/// </summary>
public int Codepage
{
get
{
object codepage;
if (TryGetValue("Codepage", out codepage))
{
return int.Parse((string)codepage);
}
return Encoding.Default.CodePage;
}
set { base["Codepage"] = value; }
}

/// <summary>
/// Initializes a new instance of the <see cref="XmlConnectionStringBuilder"/> class with default settings.
/// </summary>
Expand Down
62 changes: 60 additions & 2 deletions FastReport.Base/Data/XmlDataConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Data.Common;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;

namespace FastReport.Data
{
Expand Down Expand Up @@ -62,6 +63,25 @@ public string XmlFile
ConnectionString = builder.ToString();
}
}

/// <summary>
/// Gets or sets the codepage of the .xml file.
/// </summary>
[Category("Data")]
public int Codepage
{
get
{
XmlConnectionStringBuilder builder = new XmlConnectionStringBuilder(ConnectionString);
return builder.Codepage;
}
set
{
XmlConnectionStringBuilder builder = new XmlConnectionStringBuilder(ConnectionString);
builder.Codepage = value;
ConnectionString = builder.ToString();
}
}
#endregion

#region Protected Methods
Expand Down Expand Up @@ -146,7 +166,19 @@ private void ReadXml(DataSet dataset)
{
if (Config.ForbidLocalData)
throw new Exception(Res.Get("ConnectionEditors,Common,OnlyUrlException"));
dataset.ReadXml(XmlFile);

if (Codepage != 1251)
{
//Adding the ability to decode a file from a computer in the selected encoding.
using (var reader = new StreamReader(XmlFile, Encoding.GetEncoding(Codepage)))
{
dataset.ReadXml(reader);
}
}
else
{
dataset.ReadXml(XmlFile);
}
}
else if (uri.OriginalString.StartsWith("http") || uri.OriginalString.StartsWith("ftp"))
{
Expand All @@ -166,7 +198,33 @@ private void LoadXmlFromUrl(DataSet dataset)
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(XmlFile);
using (var response = req.GetResponse() as HttpWebResponse)
{
var encoding = response.CharacterSet.Equals(String.Empty) ? Encoding.UTF8 : Encoding.GetEncoding(response.CharacterSet);
string charset = null;
Encoding encoding;
if (Codepage != 1251)
{
encoding = Encoding.GetEncoding(Codepage);
}
else
{
// Extracting the charset from the Content-Type header, if specified.
var contentType = response.ContentType;
if (!string.IsNullOrEmpty(contentType))
{
var match = Regex.Match(contentType, @"charset=([\w-]+)", RegexOptions.IgnoreCase);
if (match.Success && match.Groups.Count > 1)
charset = match.Groups[1].Value;
}

// Defining the encoding. If omitted or there is an error, we use UTF�8 by default.
try
{
encoding = string.IsNullOrWhiteSpace(charset) ? Encoding.UTF8 : Encoding.GetEncoding(charset);
}
catch
{
encoding = Encoding.UTF8;
}
}

using (var responseStream = response.GetResponseStream())
using (var reader = new System.IO.StreamReader(responseStream, encoding))
Expand Down
5 changes: 3 additions & 2 deletions FastReport.Base/Export/Html/HTMLExportLayers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ private void LayerText(FastString Page, TextObject obj)
else if (obj.VertAlign == VertAlign.Bottom)
{
// (float)(Math.Round(obj.Font.Size * 96 / 72) / 2
// necessary to compensate for paragraph offset error in GetSpanText method below
top = obj.Height - height - obj.Padding.Bottom - (float)(Math.Round(obj.Font.Size * 96 / 72) / 2);
// necessary to compensate for paragraph offset error in GetSpanText method below.
// top margin should be positive when VertAlign == VertAlign.Bottom.
top = Math.Max(obj.Height - height - obj.Padding.Bottom - (float)(Math.Round(obj.Font.Size * 96 / 72) / 2), 0);
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions FastReport.Base/LineObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ public override void Assign(Base source)
public override void Draw(FRPaintEventArgs e)
{
IGraphics g = e.Graphics;
// draw marker when inserting a line
// draw crosshair when inserting a line
if (Width == 0 && Height == 0)
{
g.DrawLine(Pens.Black, AbsLeft * e.ScaleX - 6, AbsTop * e.ScaleY, AbsLeft * e.ScaleX + 6, AbsTop * e.ScaleY);
g.DrawLine(Pens.Black, AbsLeft * e.ScaleX, AbsTop * e.ScaleY - 6, AbsLeft * e.ScaleX, AbsTop * e.ScaleY + 6);
DrawCrossHair(e, AbsLeft, AbsTop);
return;
}

Expand All @@ -112,18 +111,21 @@ public override void Draw(FRPaintEventArgs e)

DrawUtils.SetPenDashPatternOrStyle(DashPattern, pen, Border);

float width = Width;
float height = Height;

if (!Diagonal)
{
if (Math.Abs(Width) > Math.Abs(Height))
Height = 0;
height = 0;
else
Width = 0;
width = 0;
}

float x1 = AbsLeft * e.ScaleX;
float y1 = AbsTop * e.ScaleY;
float x2 = (AbsLeft + Width) * e.ScaleX;
float y2 = (AbsTop + Height) * e.ScaleY;
float x2 = (AbsLeft + width) * e.ScaleX;
float y2 = (AbsTop + height) * e.ScaleY;

if (StartCap.Style == CapStyle.None && EndCap.Style == CapStyle.None)
{
Expand Down
3 changes: 1 addition & 2 deletions FastReport.Base/PolyLineObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ public override void Draw(FRPaintEventArgs e)
x += pointsCollection[0].X;
y += pointsCollection[0].Y;
}
g.DrawLine(Pens.Black, x * e.ScaleX - 6, y * e.ScaleY, x * e.ScaleX + 6, y * e.ScaleY);
g.DrawLine(Pens.Black, x * e.ScaleX, y * e.ScaleY - 6, x * e.ScaleX, y * e.ScaleY + 6);
DrawCrossHair(e, x, y);
break;

default:
Expand Down
4 changes: 4 additions & 0 deletions FastReport.Base/RFIDLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ public bool UseAdjustForEPC
set
{
useAdjustForEPC = value;
if (value)
rewriteEPCbank = false;
}
}

Expand All @@ -370,6 +372,8 @@ public bool RewriteEPCbank
set
{
rewriteEPCbank = value;
if (value)
useAdjustForEPC = false;
}
}

Expand Down
2 changes: 2 additions & 0 deletions FastReport.Base/ShapeObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ public override void Draw(FRPaintEventArgs e)
break;
}

DrawDesign(e);

if (!(Fill is SolidFill))
brush.Dispose();
if (report != null && report.SmoothGraphics)
Expand Down
12 changes: 6 additions & 6 deletions FastReport.Core.Web/Application/Cache/WebReportMemoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ public WebReportMemoryCache(IMemoryCache cache, CacheOptions cacheOptions)
{
_cache = cache;

var callback = new PostEvictionCallbackRegistration
{
EvictionCallback = EvictionCallback
};
_memoryCacheEntryDefaultOptions = GetOptions(cacheOptions);
_memoryCacheEntryDefaultOptions.PostEvictionCallbacks.Add(callback);
}

public void Add(WebReport webReport)
{
if(_cache.TryGetValue(webReport.ID, out _))
if (_cache.TryGetValue(webReport.ID, out _))
{
Debug.WriteLine($"WebReport with '{webReport.ID}' id was added before, but someone is trying to rewrite it");
return;
Expand Down Expand Up @@ -67,11 +62,16 @@ public void Remove(WebReport webReport)

private static MemoryCacheEntryOptions GetOptions(WebReportCacheOptions cacheOptions)
{
var callback = new PostEvictionCallbackRegistration
{
EvictionCallback = EvictionCallback
};
return new MemoryCacheEntryOptions
{
SlidingExpiration = cacheOptions.CacheDuration,
AbsoluteExpirationRelativeToNow = cacheOptions.AbsoluteExpirationDuration,
AbsoluteExpiration = cacheOptions.AbsoluteExpiration,
PostEvictionCallbacks = { callback },
};
}

Expand Down
12 changes: 10 additions & 2 deletions FastReport.Core.Web/Application/DesignerOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System;
using System.Threading.Tasks;
using System.Threading;

#nullable enable

Expand Down Expand Up @@ -36,8 +38,14 @@ public class DesignerOptions

/// <summary>
/// Callback that is invoked after a new <see cref="WebReport"/> is created from the Online Designer.
/// This allows the user to customize or configure the report before it is rendered or processed further.
/// Allows customizing or configuring the report before it is rendered or processed further.
/// </summary>
public Action<WebReport>? OnWebReportCreated { get; set; }
public Action<WebReport, IServiceProvider>? OnWebReportCreated { get; set; }

/// <summary>
/// Asynchronous callback that is invoked after a new <see cref="WebReport"/> is created from the Online Designer.
/// Allows customizing or configuring the report before it is rendered or processed further.
/// </summary>
public Func<WebReport, IServiceProvider, CancellationToken, Task>? OnWebReportCreatedAsync { get; set; }
}
}
Loading