Skip to content
Merged
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
45 changes: 29 additions & 16 deletions FastReport.Base/Export/ExportBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,6 @@ protected virtual void Start()
this.Report.OnExportParameters(new ExportParametersEventArgs(this));
}

/*
/// <summary>
/// This method is called for each exported page. Function is DEPERCATED!!!
/// </summary>
/// <param name="pageNo">Page number to export.</param>
/// <remarks>
/// To get a page, use the following code:
/// <code>
/// ReportPage page = Report.PreparedPages.GetPage(pageNo);
/// </code>
/// </remarks>
protected virtual void ExportPage(int pageNo)
{
//need to delete this
}*/

/// <summary>
/// This method is called at the start of exports of each page.
/// </summary>
Expand Down Expand Up @@ -478,6 +462,35 @@ public void Export(Report report, Stream stream)
}
}

public void InstantExportStart(Report report, Stream stream)
{
SetReport(report);
this.stream = stream;
GeneratedFiles.Clear();
if (!String.IsNullOrEmpty(FileName))
GeneratedFiles.Add(FileName);
Start();
}

public void InstantExportBeginPage(ReportPage page)
{
ExportPageBegin(page);
}

public void InstantExportExportBand(BandBase band)
{
ExportBand(band);
}

public void InstantExportEndPage(ReportPage page)
{
ExportPageEnd(page);
}

public void InstantExportFinish()
{
Finish();
}
internal void ExportPageNew(int pageNo)
{
PreparedPage ppage = Report.PreparedPages.GetPreparedPage(pageNo);
Expand Down
93 changes: 69 additions & 24 deletions FastReport.Base/Export/ExportUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal static bool ParseTextToPercent(string text, FormatBase format, out deci
return false;
}

internal static string GetExcelFormatSpecifier(FormatBase format, bool useLocale = false)
internal static string GetExcelFormatSpecifier(FormatBase format, bool useLocale = false, bool currencyToAccounting = false)
{
if (format is CurrencyFormat)
{
Expand All @@ -110,7 +110,7 @@ internal static string GetExcelFormatSpecifier(FormatBase format, bool useLocale
f = (format as CurrencyFormat).GetNumberFormatInfo();
f.CurrencyDecimalDigits = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalDigits;
}

string fm_str = "#,##0";
if (f.CurrencyDecimalDigits > 0)
{
Expand All @@ -124,32 +124,77 @@ internal static string GetExcelFormatSpecifier(FormatBase format, bool useLocale

switch (f.CurrencyPositivePattern)
{
case 0: positive_pattern = currency_symbol + fm_str; break; // $n
case 1: positive_pattern = fm_str + currency_symbol; break; // n$
case 2: positive_pattern = currency_symbol + " " + fm_str; break; // $ n
case 3: positive_pattern = fm_str + " " + currency_symbol; break; // n $
case 0: positive_pattern = currency_symbol + fm_str; break; // $n
case 1: positive_pattern = fm_str + currency_symbol; break; // n$
case 2: positive_pattern = currency_symbol + " " + fm_str; break; // $ n
case 3: positive_pattern = fm_str + " " + currency_symbol; break; // n $
}

switch (f.CurrencyNegativePattern)
{
case 0: negative_pattern = "(" + currency_symbol + fm_str + ")"; break; // ($n)
case 1: negative_pattern = "-" + currency_symbol + fm_str; break; // -$n
case 2: negative_pattern = currency_symbol + "-" + fm_str; break; // $-n
case 3: negative_pattern = currency_symbol + fm_str + "-"; break; // $n-
case 4: negative_pattern = "(" + currency_symbol + fm_str + ")"; break; // (n$)
case 5: negative_pattern = "-" + fm_str + currency_symbol; break; // -n$
case 6: negative_pattern = fm_str + "-" + currency_symbol; break; // n-$
case 7: negative_pattern = fm_str + currency_symbol + "-"; break; // n$-
case 8: negative_pattern = "-" + fm_str + " " + currency_symbol; break; // -n $
case 9: negative_pattern = "-" + currency_symbol + " " + fm_str; break; // -$ n
case 10: negative_pattern = fm_str + " " + currency_symbol + "-"; break; // n $-
case 11: negative_pattern = currency_symbol + " " + fm_str + "-"; break; // $ n-
case 12: negative_pattern = currency_symbol + " -" + fm_str; break; // $ -n
case 13: negative_pattern = fm_str + "- " + currency_symbol; break; // n- $
case 0: negative_pattern = "(" + currency_symbol + fm_str + ")"; break; // ($n)
case 1: negative_pattern = "-" + currency_symbol + fm_str; break; // -$n
case 2: negative_pattern = currency_symbol + "-" + fm_str; break; // $-n
case 3: negative_pattern = currency_symbol + fm_str + "-"; break; // $n-
case 4: negative_pattern = "(" + currency_symbol + fm_str + ")"; break; // (n$)
case 5: negative_pattern = "-" + fm_str + currency_symbol; break; // -n$
case 6: negative_pattern = fm_str + "-" + currency_symbol; break; // n-$
case 7: negative_pattern = fm_str + currency_symbol + "-"; break; // n$-
case 8: negative_pattern = "-" + fm_str + " " + currency_symbol; break; // -n $
case 9: negative_pattern = "-" + currency_symbol + " " + fm_str; break; // -$ n
case 10: negative_pattern = fm_str + " " + currency_symbol + "-"; break; // n $-
case 11: negative_pattern = currency_symbol + " " + fm_str + "-"; break; // $ n-
case 12: negative_pattern = currency_symbol + " -" + fm_str; break; // $ -n
case 13: negative_pattern = fm_str + "- " + currency_symbol; break; // n- $
case 14: negative_pattern = "(" + currency_symbol + " " + fm_str + ")"; break; // ($ n)
case 15: negative_pattern = "(" + fm_str + " " + currency_symbol + ")"; break; // (n $)
}

if (currencyToAccounting)
{
string financeSymbol = "";

switch (f.CurrencySymbol)
{
case "₽": financeSymbol = "[$₽-419]"; break;
case "$": financeSymbol = "[$$-409]"; break;
case "\u20AC": financeSymbol = "[$€-2]"; break;
case "\u00A3": financeSymbol = "[$£-809]"; break;
case "\u20B9": financeSymbol = "[$₹-4009]"; break;
}

switch (f.CurrencyPositivePattern)
{
case 0: positive_pattern = @"_-* " + financeSymbol + fm_str + "_-;"; break; // $n
case 1: positive_pattern = @"_-* " + fm_str + financeSymbol + "_-;"; break; // n$
case 2: positive_pattern = @"_-* " + financeSymbol + " " + fm_str + "_-;"; break; // $ n
case 3: positive_pattern = @"_-* " + fm_str + " "+ financeSymbol + "_-;"; break; // n $
}

switch (f.CurrencyNegativePattern)
{
case 0: negative_pattern = @"_-* " + "(" + financeSymbol + fm_str + ")" + "_-;"; break; // ($n)
case 1: negative_pattern = @"_-* " + "-" + financeSymbol + fm_str + "_-;"; break; // -$n
case 2: negative_pattern = @"_-* " + financeSymbol + "-" + fm_str + "_-;"; break; // $-n
case 3: negative_pattern = @"_-* " + financeSymbol + fm_str + "-" + "_-;"; break; // $n-
case 4: negative_pattern = @"_-* " + "(" + fm_str + financeSymbol + ")" + "_-;"; break; // (n$)
case 5: negative_pattern = @"_-* " + "-" + fm_str + financeSymbol + "_-;"; break; // -n$
case 6: negative_pattern = @"_-* " + fm_str + "-" + financeSymbol + "_-;"; break; // n-$
case 7: negative_pattern = @"_-* " + fm_str + financeSymbol + "-" + "_-;"; break; // n$-
case 8: negative_pattern = @"_-* " + "-" + fm_str + " " + financeSymbol + "_-;"; break; // -n $
case 9: negative_pattern = @"_-* " + "-" + financeSymbol + " " + fm_str + "_-;"; break; // -$ n
case 10: negative_pattern = @"_-* " + fm_str + " " + financeSymbol + "-" + "_-;"; break; // n $-
case 11: negative_pattern = @"_-* " + financeSymbol + " " + fm_str + "-" + "_-;"; break; // $ n-
case 12: negative_pattern = @"_-* " + financeSymbol + " " + "-" + fm_str + "_-;"; break; // $ -n
case 13: negative_pattern = @"_-* " + fm_str + "- " + financeSymbol + "_-;"; break; // n- $
case 14: negative_pattern = @"_-* " + "(" + financeSymbol + " " + fm_str + ")" + "_-;"; break; // ($ n)
case 15: negative_pattern = @"_-* " + "(" + fm_str + " " + financeSymbol + ")" + "_-;"; break; // (n $)
}

string financeFormat_Options = @"_-* &quot;-&quot;??\ " + financeSymbol + "_-;_-@_-";

return positive_pattern + negative_pattern + financeFormat_Options;
}
return positive_pattern + ";" + negative_pattern;
}
else if (format is NumberFormat)
Expand Down Expand Up @@ -177,10 +222,10 @@ internal static string GetExcelFormatSpecifier(FormatBase format, bool useLocale
switch (f.NumberNegativePattern)
{
case 0: negative_pattern = "(" + fm_str + ")"; break; // (n)
case 1: negative_pattern = "-" + fm_str; break; // -n
case 2: negative_pattern = "- " + fm_str; break; // - n
case 3: negative_pattern = fm_str + "-"; break; // n-
case 4: negative_pattern = fm_str + " -"; break; // n -
case 1: negative_pattern = "-" + fm_str; break; // -n
case 2: negative_pattern = "- " + fm_str; break; // - n
case 3: negative_pattern = fm_str + "-"; break; // n-
case 4: negative_pattern = fm_str + " -"; break; // n -
}

return positive_pattern + ";" + negative_pattern;
Expand Down
6 changes: 2 additions & 4 deletions FastReport.Base/Gauge/Linear/LinearPointer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ private void DrawHorz(FRPaintEventArgs e)
path.AddLines(p);
path.AddLine(p[4], p[0]);

g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);
}

private void DrawVert(FRPaintEventArgs e)
Expand Down Expand Up @@ -134,8 +133,7 @@ private void DrawVert(FRPaintEventArgs e)
path.AddLines(p);
path.AddLine(p[4], p[0]);

g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);
}

#endregion // Private Methods
Expand Down
44 changes: 13 additions & 31 deletions FastReport.Base/Gauge/Radial/RadialGauge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public override void Draw(FRPaintEventArgs e)
float y1 = y + dy;

Pen pen = e.Cache.GetPen(Border.Color, Border.Width * e.ScaleX, Border.DashStyle);
Brush brush = null;
Brush brush;
if (Fill is SolidFill)
brush = e.Cache.GetBrush((Fill as SolidFill).Color);
else
Expand All @@ -272,29 +272,23 @@ public override void Draw(FRPaintEventArgs e)

if (type == RadialGaugeType.Circle)
{
g.FillEllipse(brush, x, y, dx, dy);
g.DrawEllipse(pen, x, y, dx, dy);
g.FillAndDrawEllipse(pen, brush, x, y, dx, dy);
}
else if (type == RadialGaugeType.Semicircle)
{
float semiOffset = (Width / 16f /2f + 2f) * semicircleOffsetRatio * e.ScaleY;
PointF[] points = new PointF[4];
if (position == RadialGaugePosition.Top)
{
g.FillPie(brush, x, y, dx, dy, -180, 180);
g.DrawArc(pen, x, y, dx, dy, -180, 180);

PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, -90 * RAD, center)[0];

PointF[] points = new PointF[4];
points[0] = new PointF(startPoint.X, startPoint.Y - 1 * e.ScaleY);
points[1] = new PointF(startPoint.X, startPoint.Y + semiOffset);
points[2] = new PointF(startPoint.X + dx, startPoint.Y + semiOffset);
points[3] = new PointF(startPoint.X + dx, startPoint.Y - 1 * e.ScaleY);
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);

}
else if(position == RadialGaugePosition.Bottom)
{
Expand All @@ -303,15 +297,10 @@ public override void Draw(FRPaintEventArgs e)

PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, 90 * RAD, center)[0];

PointF[] points = new PointF[4];
points[0] = new PointF(startPoint.X, startPoint.Y + 1 * e.ScaleY);
points[1] = new PointF(startPoint.X, startPoint.Y - semiOffset);
points[2] = new PointF(startPoint.X - dx, startPoint.Y - semiOffset);
points[3] = new PointF(startPoint.X - dx, startPoint.Y + 1 * e.ScaleY);
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);
}
else if (position == RadialGaugePosition.Left)
{
Expand All @@ -320,15 +309,10 @@ public override void Draw(FRPaintEventArgs e)

PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, 180 * RAD, center)[0];

PointF[] points = new PointF[4];
points[0] = new PointF(startPoint.X - 1 * e.ScaleX, startPoint.Y);
points[1] = new PointF(startPoint.X + semiOffset, startPoint.Y);
points[2] = new PointF(startPoint.X + semiOffset, startPoint.Y - dy);
points[3] = new PointF(startPoint.X - 1 * e.ScaleX, startPoint.Y - dy);
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);
}
else if (position == RadialGaugePosition.Right)
{
Expand All @@ -337,15 +321,17 @@ public override void Draw(FRPaintEventArgs e)

PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, -180 * RAD, center)[0];

PointF[] points = new PointF[4];
points[0] = new PointF(startPoint.X + 1 * e.ScaleX, startPoint.Y);
points[1] = new PointF(startPoint.X - semiOffset, startPoint.Y);
points[2] = new PointF(startPoint.X - semiOffset, startPoint.Y - dy);
points[3] = new PointF(startPoint.X + 1 * e.ScaleX, startPoint.Y - dy);
}

if(position != RadialGaugePosition.None)
{
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);
}
}
else if (type == RadialGaugeType.Quadrant)
Expand All @@ -366,8 +352,7 @@ public override void Draw(FRPaintEventArgs e)
points[4] = new PointF(startPoint.X + dx / 2 - 1 * e.ScaleX, y);
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);

}
else if (RadialUtils.IsBottom(this) && RadialUtils.IsLeft(this))
Expand All @@ -385,10 +370,9 @@ public override void Draw(FRPaintEventArgs e)
points[4] = new PointF(x + dx / 2 - 1 * e.ScaleX, y + dy);
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);
}
else if (RadialUtils.IsTop(this) && RadialUtils.IsRight(this))
else if (RadialUtils.IsTop(this) && RadialUtils.IsRight(this))
{
g.FillPie(brush, x, y, dx, dy, -90, 90);
g.DrawArc(pen, x, y, dx, dy, -90, 90);
Expand All @@ -403,8 +387,7 @@ public override void Draw(FRPaintEventArgs e)
points[4] = new PointF(x + dx / 2 + 1 * e.ScaleX, y);
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);
}
else if (RadialUtils.IsBottom(this) && RadialUtils.IsRight(this))
{
Expand All @@ -421,8 +404,7 @@ public override void Draw(FRPaintEventArgs e)
points[4] = new PointF(x + dx / 2 + 1 * e.ScaleX, y + dy);
GraphicsPath path = new GraphicsPath();
path.AddLines(points);
g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);
}
}

Expand Down
6 changes: 2 additions & 4 deletions FastReport.Base/Gauge/Radial/RadialPointer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,9 @@ private void DrawHorz(FRPaintEventArgs e)
path.AddLines(p);
path.AddLine(p[3], p[0]);

g.FillEllipse(brush, pointerCircle);
g.DrawEllipse(pen, pointerCircle);
g.FillAndDrawEllipse(pen, brush, pointerCircle);

g.FillPath(brush, path);
g.DrawPath(pen, path);
g.FillAndDrawPath(pen, brush, path);
}

#endregion // Private Methods
Expand Down
Loading