D
D
Dmitry Gavrilenko2017-03-19 16:07:56
.NET
Dmitry Gavrilenko, 2017-03-19 16:07:56

FastReport.NET Error in Format expression?

Hello. There is a line in the *.frx report file

<TextObject Name="Text1" Width="614.25" Height="28.35" Text="[Format(&quot;{0:dd.MM.yyyy}&quot;,[InvoiceDate])]" Font="Arial, 14pt"/>

What's going on: The InvoiceDate variable is of type DateTime. The Format(string format, params object[] args) method receives a string (format) of the form {0:dd.MM.yyyy} and the DateTime itself (InvoiceDate). When printing this file, everything falls into place and works as it should, but when exporting, there is a frank game.
Here is the method
protected void ExportReport(
           string reportPath, ExportBase exportBase, Action<Report> setParameters, Stream streamImport)
        {
            var reprotStream = GetReportStream(reportPath);
            using (var report = new Report())
            {
                report.Load(reprotStream);
                setParameters(report);
                report.Prepare();
                report.Export(exportBase, streamImport);
            }
        }

Throws error " Text1: Error in expression: Format("{0:MM/dd/yyyy}", [InvoiceDate]) "

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question