diff --git a/Demos/Reports/Barcode.frx b/Demos/Reports/Barcode.frx index 22f87dc6..a2387a00 100644 --- a/Demos/Reports/Barcode.frx +++ b/Demos/Reports/Barcode.frx @@ -1,71 +1,74 @@  - + - - + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + diff --git a/Demos/Reports/reports.xml b/Demos/Reports/reports.xml index e7d10cd3..4609b58f 100644 --- a/Demos/Reports/reports.xml +++ b/Demos/Reports/reports.xml @@ -1,6 +1,6 @@ - + @@ -15,7 +15,7 @@ - + @@ -35,7 +35,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -87,20 +87,20 @@ - + - + - + @@ -109,7 +109,7 @@ - + @@ -126,7 +126,7 @@ - + diff --git a/Extras/Core/FastReport.Data/FastReport.Data.MySql/FastReport.Data.MySql.csproj b/Extras/Core/FastReport.Data/FastReport.Data.MySql/FastReport.Data.MySql.csproj index ce985946..b826cb3f 100644 --- a/Extras/Core/FastReport.Data/FastReport.Data.MySql/FastReport.Data.MySql.csproj +++ b/Extras/Core/FastReport.Data/FastReport.Data.MySql/FastReport.Data.MySql.csproj @@ -25,10 +25,10 @@ all - + - + @@ -38,14 +38,12 @@ - - UserControl - + MySqlConnectionEditor.cs - + MySqlConnectionEditor.cs Designer diff --git a/Extras/Core/FastReport.Data/FastReport.Data.OracleODPCore/FastReport.Data.OracleODPCore.csproj b/Extras/Core/FastReport.Data/FastReport.Data.OracleODPCore/FastReport.Data.OracleODPCore.csproj index 41563cfb..84a78239 100644 --- a/Extras/Core/FastReport.Data/FastReport.Data.OracleODPCore/FastReport.Data.OracleODPCore.csproj +++ b/Extras/Core/FastReport.Data/FastReport.Data.OracleODPCore/FastReport.Data.OracleODPCore.csproj @@ -48,8 +48,6 @@ - - UserControl - + \ No newline at end of file diff --git a/FastReport.Base/Barcode/Barcode2of5.cs b/FastReport.Base/Barcode/Barcode2of5.cs index be7024aa..e18ee9d9 100644 --- a/FastReport.Base/Barcode/Barcode2of5.cs +++ b/FastReport.Base/Barcode/Barcode2of5.cs @@ -6,12 +6,12 @@ namespace FastReport.Barcode { - /// - /// Generates the "2/5 Interleaved" barcode. - /// - public class Barcode2of5Interleaved : LinearBarcodeBase - { - internal static int[,] tabelle_2_5 = { + /// + /// Generates the "2/5 Interleaved" barcode. + /// + public class Barcode2of5Interleaved : LinearBarcodeBase + { + internal static int[,] tabelle_2_5 = { {0, 0, 1, 1, 0}, // 0 {1, 0, 0, 0, 1}, // 1 {0, 1, 0, 0, 1}, // 2 @@ -24,55 +24,152 @@ public class Barcode2of5Interleaved : LinearBarcodeBase {0, 1, 0, 1, 0} // 9 }; - internal override string GetPattern() - { - string text = base.text; - string result = "5050"; //Startcode - string c; - - if (CalcCheckSum) - { - if (text.Length % 2 == 0) - text = text.Substring(1, text.Length - 1); - text = DoCheckSumming(text); - } - else - { - if (text.Length % 2 != 0) - text = "0" + text; - } - - for (int i = 0; i < (text.Length / 2); i++) - { - for (int j = 0; j <= 4; j++) + internal override string GetPattern() { - if (tabelle_2_5[CharToInt(text[i * 2]), j] == 1) - c = "6"; - else - c = "5"; - result += c; - - if (tabelle_2_5[CharToInt(text[i * 2 + 1]), j] == 1) - c = "1"; - else - c = "0"; - result += c; + string text = base.text; + string result = "5050"; //Startcode + string c; + + if (CalcCheckSum) + { + if (text.Length % 2 == 0) + text = text.Substring(1, text.Length - 1); + text = DoCheckSumming(text); + } + else + { + if (text.Length % 2 != 0) + text = "0" + text; + } + + for (int i = 0; i < (text.Length / 2); i++) + { + for (int j = 0; j <= 4; j++) + { + if (tabelle_2_5[CharToInt(text[i * 2]), j] == 1) + c = "6"; + else + c = "5"; + result += c; + + if (tabelle_2_5[CharToInt(text[i * 2 + 1]), j] == 1) + c = "1"; + else + c = "0"; + result += c; + } + } + + result += "605"; // Stopcode + return result; } - } - result += "605"; // Stopcode - return result; + /// + /// Initializes a new instance of the class with default settings. + /// + public Barcode2of5Interleaved() + { + ratioMin = 2; + ratioMax = 3; + } } - /// - /// Initializes a new instance of the class with default settings. + /// Generates the "Deutsche Identcode" barcode. /// - public Barcode2of5Interleaved() + public class BarcodeDeutscheIdentcode : Barcode2of5Interleaved { - ratioMin = 2; - ratioMax = 3; + #region Properties + /// + /// Gets or sets a value that indicates that CheckSum should be printed. + /// + [System.ComponentModel.DefaultValue(true)] + [System.ComponentModel.Category("Appearance")] + public bool PrintCheckSum { get; set; } + + #endregion + + internal override string GetPattern() + { + string result = "5050"; //Startcode + string c; + string text = base.text.Replace(".", "").Replace(" ", ""); + + if(CalcCheckSum) + { + if (text.Length == 11) + text = DoCheckSumming(text); + else if (text.Length != 12) + throw new Exception(Res.Get("Messages,BarcodeLengthMismatch")); + + } + else + { + if(text.Length != 12) + throw new Exception(Res.Get("Messages,BarcodeLengthMismatch")); + } + + for (int i = 0; i < (text.Length / 2); i++) + { + for (int j = 0; j <= 4; j++) + { + if (tabelle_2_5[CharToInt(text[i * 2]), j] == 1) + c = "6"; + else + c = "5"; + result += c; + + if (tabelle_2_5[CharToInt(text[i * 2 + 1]), j] == 1) + c = "1"; + else + c = "0"; + result += c; + } + } + + result += "605"; // Stopcode + + base.text = text.Insert(2, ".").Insert(6, " ").Insert(10, "."); + + if(!PrintCheckSum) + { + base.text = base.text.Substring(0, base.text.Length - 1); + } + else + base.text = base.text.Insert(14, " "); + + + return result; + } + + /// + public override void Assign(BarcodeBase source) + { + base.Assign(source); + + BarcodeDeutscheIdentcode src = source as BarcodeDeutscheIdentcode; + PrintCheckSum = src.PrintCheckSum; + } + internal override void Serialize(FRWriter writer, string prefix, BarcodeBase diff) + { + base.Serialize(writer, prefix, diff); + BarcodeDeutscheIdentcode c = diff as BarcodeDeutscheIdentcode; + + if (c == null || PrintCheckSum != c.PrintCheckSum) + writer.WriteValue(prefix + "DrawVerticalBearerBars", PrintCheckSum); + } + + /// + /// Initializes a new instance of the class with default settings. + /// + public BarcodeDeutscheIdentcode() + { + ratioMin = 2.25F; + ratioMax = 3.5F; + WideBarRatio = 3F; + PrintCheckSum = true; + } } - } + /// /// Generates the "ITF-14" barcode. @@ -108,7 +205,7 @@ public bool DrawVerticalBearerBars internal override string GetPattern() { string result = ""; // Startcode - for(int i = 0; i < 14; i++)//10 for light margin and 4 for vertical bearer bar + for (int i = 0; i < 14; i++)//10 for light margin and 4 for vertical bearer bar { result += "0"; } @@ -175,7 +272,7 @@ public override void Assign(BarcodeBase source) } public override void DrawBarcode(IGraphicsRenderer g, RectangleF displayRect) - { + { base.DrawBarcode(g, displayRect); float bearerWidth = WideBarRatio * 2 * zoom; using (Pen pen = new Pen(Color, bearerWidth)) @@ -216,78 +313,78 @@ public BarcodeITF14() /// Generates the "2/5 Industrial" barcode. /// public class Barcode2of5Industrial : Barcode2of5Interleaved - { - internal override string GetPattern() { - string text = base.text; - string result = "606050"; // Startcode - - if (CalcCheckSum) - { - text = DoCheckSumming(text); - } - - for (int i = 0; i < text.Length; i++) - { - for (int j = 0; j <= 4; j++) + internal override string GetPattern() { - if (tabelle_2_5[CharToInt(text[i]), j] == 1) - result += "60"; - else - result += "50"; - } - } + string text = base.text; + string result = "606050"; // Startcode - result += "605060"; //Stopcode - return result; - } - } - - /// - /// Generates the "2/5 Matrix" barcode. - /// - public class Barcode2of5Matrix : Barcode2of5Interleaved - { - internal override string GetPattern() - { - string text = base.text; - string result = "705050"; // Startcode - char c; - - if (CalcCheckSum) - { - text = DoCheckSumming(text); - } - - for (int i = 0; i < text.Length; i++) - { - for (int j = 0; j <= 4; j++) - { - if (tabelle_2_5[CharToInt(text[i]), j] == 1) - c = '1'; - else - c = '0'; - - if ((j % 2) == 0) - c = (char)((int)c + 5); - result += c; - } - result += '0'; - } + if (CalcCheckSum) + { + text = DoCheckSumming(text); + } - result = result + "70505"; // Stopcode + for (int i = 0; i < text.Length; i++) + { + for (int j = 0; j <= 4; j++) + { + if (tabelle_2_5[CharToInt(text[i]), j] == 1) + result += "60"; + else + result += "50"; + } + } - return result; + result += "605060"; //Stopcode + return result; + } } /// - /// Initializes a new instance of the class with default settings. + /// Generates the "2/5 Matrix" barcode. /// - public Barcode2of5Matrix() + public class Barcode2of5Matrix : Barcode2of5Interleaved { - ratioMin = 2.25f; - ratioMax = 3; - WideBarRatio = 2.25f; + internal override string GetPattern() + { + string text = base.text; + string result = "705050"; // Startcode + char c; + + if (CalcCheckSum) + { + text = DoCheckSumming(text); + } + + for (int i = 0; i < text.Length; i++) + { + for (int j = 0; j <= 4; j++) + { + if (tabelle_2_5[CharToInt(text[i]), j] == 1) + c = '1'; + else + c = '0'; + + if ((j % 2) == 0) + c = (char)((int)c + 5); + result += c; + } + result += '0'; + } + + result = result + "70505"; // Stopcode + + return result; + } + + /// + /// Initializes a new instance of the class with default settings. + /// + public Barcode2of5Matrix() + { + ratioMin = 2.25f; + ratioMax = 3; + WideBarRatio = 2.25f; + } } - } } diff --git a/FastReport.Base/Barcode/BarcodeObject.cs b/FastReport.Base/Barcode/BarcodeObject.cs index 11f8c81b..830de168 100644 --- a/FastReport.Base/Barcode/BarcodeObject.cs +++ b/FastReport.Base/Barcode/BarcodeObject.cs @@ -656,6 +656,7 @@ public BarcodeItem(Type objType, string barcodeName) new BarcodeItem(typeof(Barcode2of5Interleaved), "2/5 Interleaved"), new BarcodeItem(typeof(Barcode2of5Industrial), "2/5 Industrial"), new BarcodeItem(typeof(Barcode2of5Matrix), "2/5 Matrix"), + new BarcodeItem(typeof(BarcodeDeutscheIdentcode), "Deutsche Identcode"), new BarcodeItem(typeof(BarcodeITF14), "ITF-14"), new BarcodeItem(typeof(BarcodeCodabar), "Codabar"), new BarcodeItem(typeof(Barcode128), "Code128"), diff --git a/FastReport.Base/Code/AssemblyDescriptor.cs b/FastReport.Base/Code/AssemblyDescriptor.cs index d90ff99e..3e18f37d 100644 --- a/FastReport.Base/Code/AssemblyDescriptor.cs +++ b/FastReport.Base/Code/AssemblyDescriptor.cs @@ -477,6 +477,57 @@ private bool HandleCompileErrors(CompilerParameters cp, CompilerResults cr, out { errors = string.Empty; List assemblyList = new List(4); + Regex regex; + + if (Config.WebMode && Config.EnableScriptSecurity) + { + for (int i=0; i < cr.Errors.Count; ) + { + CompilerError ce = cr.Errors[i]; + if (ce.ErrorNumber == "CS1685") // duplicate class + { + cr.Errors.Remove(ce); + continue; + } + else if (ce.ErrorNumber == "CS0436") // user using a forbidden type + { + const string pattern = "[\"'](\\S+)[\"']"; + regex = new Regex(pattern, RegexOptions.Compiled); + string typeName = regex.Match(ce.ErrorText).Value; + + const string res = "Web,ScriptSecurity,ForbiddenType"; + string message = Res.TryGet(res); + if(string.Equals(res, message)) + message = "Please, don't use the type " + typeName; + else + message = message.Replace("{typeName}", typeName); //$"Please, don't use the type {typeName}"; + + ce.ErrorText = message; + + } + else if (ce.ErrorNumber == "CS0117") // user using a forbidden method + { + const string pattern = "[\"'](\\S+)[\"']"; + regex = new Regex(pattern, RegexOptions.Compiled); + MatchCollection mathes = regex.Matches(ce.ErrorText); + if(mathes.Count > 1) + { + string methodName = mathes[1].Value; + + const string res = "Web,ScriptSecurity,ForbiddenMethod"; + string message = Res.TryGet(res); + if (string.Equals(res, message)) + message = "Please, don't use the method " + methodName; + else + message = message.Replace("{methodName}", methodName); //$"Please, don't use the method {methodName}"; + + ce.ErrorText = message; + } + } + + i++; + } + } foreach (CompilerError ce in cr.Errors) { @@ -486,7 +537,7 @@ private bool HandleCompileErrors(CompilerParameters cp, CompilerResults cr, out try { const string pattern = @"'(\S{1,}),"; - Regex regex = new Regex(pattern); + regex = new Regex(pattern, RegexOptions.Compiled); string assemblyName = regex.Match(ce.ErrorText).Groups[1].Value; // Groups[1] include string without ' and , symbols if (!assemblyList.Contains(assemblyName)) assemblyList.Add(assemblyName); diff --git a/FastReport.Base/Data/JsonConnection/JsonDataSourceConnection.cs b/FastReport.Base/Data/JsonConnection/JsonDataSourceConnection.cs index 28d28bfe..21374a96 100644 --- a/FastReport.Base/Data/JsonConnection/JsonDataSourceConnection.cs +++ b/FastReport.Base/Data/JsonConnection/JsonDataSourceConnection.cs @@ -208,11 +208,13 @@ private void InitConnection(bool rebuildSchema) req.Headers.Add(header.Key, header.Value); } - using (var response = req.GetResponse()) + using (var response = req.GetResponse() as HttpWebResponse) { - byte[] data = new byte[2048]; - response.GetResponseStream().Read(data, 0, data.Length); - jsonText = Encoding.UTF8.GetString(data); + var encoding = Encoding.GetEncoding(response.CharacterSet); + + using (var responseStream = response.GetResponseStream()) + using (var reader = new System.IO.StreamReader(responseStream, encoding)) + jsonText = reader.ReadToEnd(); } } diff --git a/FastReport.Base/PictureObject.cs b/FastReport.Base/PictureObject.cs index fc8754b4..d45c0d0d 100644 --- a/FastReport.Base/PictureObject.cs +++ b/FastReport.Base/PictureObject.cs @@ -56,7 +56,7 @@ public partial class PictureObject : PictureObjectBase private bool shouldDisposeImage; private Bitmap grayscaleBitmap; private int grayscaleHash; - + private ImageFormat imageFormat; #endregion #region Properties @@ -84,10 +84,35 @@ public virtual Image Image UpdateAutoSize(); UpdateTransparentImage(); ResetImageIndex(); + imageFormat = CheckImageFormat(); ShouldDisposeImage = false; } } + /// + /// Gets or sets the expansion of image. + /// + [Category("Data")] + public virtual ImageFormat ImageFormat + { + get { return imageFormat; } + set + { + if (image == null) + return; + bool wasC = false; + using (MemoryStream stream = new MemoryStream()) + { + wasC = ImageHelper.SaveAndConvert(Image, stream, value); + imageData = stream.ToArray(); + } + if (!wasC) + return; + ForceLoadImage(); + imageFormat = CheckImageFormat(); + } + } + /// /// Gets or sets a value indicating that the image should be displayed in grayscale mode. /// @@ -229,7 +254,47 @@ protected override float ImageHeight #endregion #region Private Methods - + private ImageFormat CheckImageFormat() + { + if (Image == null || Image.RawFormat == null) + return null; + ImageFormat format = null; + if (ImageFormat.Jpeg.Equals(image.RawFormat)) + { + format = ImageFormat.Jpeg; + } + else if (ImageFormat.Gif.Equals(image.RawFormat)) + { + format = ImageFormat.Gif; + } + else if (ImageFormat.Png.Equals(image.RawFormat)) + { + format = ImageFormat.Png; + } + else if (ImageFormat.Emf.Equals(image.RawFormat)) + { + format = ImageFormat.Emf; + } + else if (ImageFormat.Icon.Equals(image.RawFormat)) + { + format = ImageFormat.Icon; + } + else if (ImageFormat.Tiff.Equals(image.RawFormat)) + { + format = ImageFormat.Tiff; + } + else if (ImageFormat.Bmp.Equals(image.RawFormat) || ImageFormat.MemoryBmp.Equals(image.RawFormat)) + { + format = ImageFormat.Bmp; + } + else if (ImageFormat.Wmf.Equals(image.RawFormat)) + { + format = ImageFormat.Wmf; + } + if (format != null) + return format; + return ImageFormat.Bmp; + } private void UpdateTransparentImage() { @@ -277,6 +342,7 @@ public override void Assign(Base source) if (src.Image == null && src.imageData != null) imageData = src.imageData; ShouldDisposeImage = true; + ImageFormat = src.ImageFormat; } } @@ -399,6 +465,8 @@ public override void Serialize(FRWriter writer) writer.WriteFloat("Transparency", Transparency); if (Tile != c.Tile) writer.WriteBool("Tile", Tile); + if (ImageFormat != c.ImageFormat) + writer.WriteValue("ImageFormat", ImageFormat); // store image data if (writer.SerializeTo != SerializeTo.SourcePages) { @@ -417,7 +485,7 @@ public override void Serialize(FRWriter writer) { using (MemoryStream stream = new MemoryStream()) { - ImageHelper.Save(Image, stream, ImageFormat.Png); + ImageHelper.Save(Image, stream, imageFormat); bytes = stream.ToArray(); } } @@ -589,5 +657,6 @@ public PictureObject() SetFlags(Flags.HasSmartTag, true); ResetImageIndex(); } + } } \ No newline at end of file diff --git a/FastReport.Base/Utils/ImageHelper.cs b/FastReport.Base/Utils/ImageHelper.cs index e5c86c54..6da565c9 100644 --- a/FastReport.Base/Utils/ImageHelper.cs +++ b/FastReport.Base/Utils/ImageHelper.cs @@ -27,7 +27,7 @@ public static Bitmap CloneBitmap(Image source) public static void Save(Image image, Stream stream) { - Save(image, stream, ImageFormat.Png); + Save(image, stream, image.GetImageFormat()); } public static void Save(Image image, string fileName, ImageFormat format) @@ -43,7 +43,12 @@ public static void Save(Image image, Stream stream, ImageFormat format) if (image == null) return; if (image is Bitmap) - image.Save(stream, format); + { + if (format == ImageFormat.Icon) + SaveAsIcon(image, stream, true); + else + image.Save(stream, format); + } else if (image is Metafile) { Metafile emf = null; @@ -61,6 +66,65 @@ public static void Save(Image image, Stream stream, ImageFormat format) } } + public static bool SaveAndConvert(Image image, Stream stream, ImageFormat format) + { + if (image == null) + return false; + if(format == ImageFormat.Jpeg || format == ImageFormat.Gif + || format == ImageFormat.Tiff || format == ImageFormat.Bmp + || format == ImageFormat.Png + || format == ImageFormat.MemoryBmp) + { + if(image is Bitmap) + { + if (format == ImageFormat.MemoryBmp) + throw new Exception(Res.Get("Export,Image,ImageParceFormatException")); + image.Save(stream, format); + return true; + } + //from mf to bitmap + using (Metafile metafile = image as Metafile) + using (Bitmap bitmap = new Bitmap(image.Width, image.Height)) + { + bitmap.SetResolution(96F, 96F); + using (Graphics g = Graphics.FromImage(bitmap)) + { + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + g.DrawImage(metafile, 0, 0, (float)image.Width, (float)image.Height); + g.Dispose(); + } + bitmap.Save(stream, format); + } + return true; + + } + else if(format == ImageFormat.Icon) + { + return SaveAsIcon(image, stream, true); + } + else if(format == ImageFormat.Wmf || format == ImageFormat.Emf) + { + if (image is Metafile) + { + Metafile emf = null; + using (Bitmap bmp = new Bitmap(1, 1)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + emf = new Metafile(stream, hdc); + g.ReleaseHdc(hdc); + } + using (Graphics g = Graphics.FromImage(emf)) + { + g.DrawImage(image, 0, 0); + } + return true; + } + } + //throw new Exception(Res.Get("Export,Image,ImageParceFormatException")); // we cant convert image to exif or from bitmap to mf + return false; + } + public static byte[] Load(string fileName) { if (!String.IsNullOrEmpty(fileName)) @@ -169,5 +233,131 @@ public static Bitmap GetGrayscaleBitmap(Image source) return grayscaleBitmap; } + + /// + /// Converts a PNG image to a icon (ico) + /// + /// The input image + /// The output stream + /// Preserve the aspect ratio + /// Wether or not the icon was succesfully generated + public static bool SaveAsIcon(Image image, Stream output, bool preserveAspectRatio = false) + { + int size = 256; + float width = size, height = size; + if (preserveAspectRatio) + { + if (image.Width > image.Height) + height = ((float)image.Height / image.Width) * size; + else + width = ((float)image.Width / image.Height) * size; + } + + var newBitmap = new Bitmap(image, new Size((int)width, (int)height)); + if (newBitmap == null) + return false; + + // save the resized png into a memory stream for future use + using (MemoryStream memoryStream = new MemoryStream()) + { + newBitmap.Save(memoryStream, ImageFormat.Png); + + var iconWriter = new BinaryWriter(output); + if (output == null || iconWriter == null) + return false; + + // 0-1 reserved, 0 + iconWriter.Write((byte)0); + iconWriter.Write((byte)0); + + // 2-3 image type, 1 = icon, 2 = cursor + iconWriter.Write((short)1); + + // 4-5 number of images + iconWriter.Write((short)1); + + // image entry 1 + // 0 image width + iconWriter.Write((byte)width); + // 1 image height + iconWriter.Write((byte)height); + + // 2 number of colors + iconWriter.Write((byte)0); + + // 3 reserved + iconWriter.Write((byte)0); + + // 4-5 color planes + iconWriter.Write((short)0); + + // 6-7 bits per pixel + iconWriter.Write((short)32); + + // 8-11 size of image data + iconWriter.Write((int)memoryStream.Length); + + // 12-15 offset of image data + iconWriter.Write((int)(6 + 16)); + + // write image data + // png data must contain the whole png data file + iconWriter.Write(memoryStream.ToArray()); + + iconWriter.Flush(); + } + + return true; + } + + + } + + public static class ImageExtension + { + /// + /// Returns an Image format. + /// + public static ImageFormat GetImageFormat(this Image bitmap) + { + if (bitmap == null || bitmap.RawFormat == null) + return null; + ImageFormat format = null; + if (ImageFormat.Jpeg.Equals(bitmap.RawFormat)) + { + format = ImageFormat.Jpeg; + } + else if (ImageFormat.Gif.Equals(bitmap.RawFormat)) + { + format = ImageFormat.Gif; + } + else if (ImageFormat.Png.Equals(bitmap.RawFormat)) + { + format = ImageFormat.Png; + } + else if (ImageFormat.Emf.Equals(bitmap.RawFormat)) + { + format = ImageFormat.Emf; + } + else if (ImageFormat.Icon.Equals(bitmap.RawFormat)) + { + format = ImageFormat.Icon; + } + else if (ImageFormat.Tiff.Equals(bitmap.RawFormat)) + { + format = ImageFormat.Tiff; + } + else if (ImageFormat.Bmp.Equals(bitmap.RawFormat) || ImageFormat.MemoryBmp.Equals(bitmap.RawFormat)) // MemoryBmp format raises a GDI exception + { + format = ImageFormat.Bmp; + } + else if (ImageFormat.Wmf.Equals(bitmap.RawFormat)) + { + format = ImageFormat.Wmf; + } + if (format != null) + return format; + return ImageFormat.Bmp; + } } } diff --git a/FastReport/Resources/en.xml b/FastReport/Resources/en.xml index 96f28b48..b3727b78 100644 --- a/FastReport/Resources/en.xml +++ b/FastReport/Resources/en.xml @@ -21,6 +21,7 @@ + @@ -2130,31 +2131,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2250,6 +2252,7 @@ + @@ -2621,6 +2624,10 @@ + + + + diff --git a/UsedPackages.version b/UsedPackages.version index f5d9f505..08293db0 100644 --- a/UsedPackages.version +++ b/UsedPackages.version @@ -3,7 +3,7 @@ - 2020.3.7 + 2020.3.8 2020.3.8