Error on prepare

Hi,

I'm trying to use the below template


<?xml version="1.0" encoding="utf-8"?>

<Report ScriptLanguage="CSharp" ReportInfo.Created="01/06/2022 16:35:51" ReportInfo.Modified="01/09/2022 10:46:17" ReportInfo.CreatorVersion="2022.1.0.0">

 <Dictionary>

   <BusinessObjectDataSource Name="DiaryPDF" ReferenceName="DiaryPDF" DataType="null" Enabled="true">

     <Column Name="DairyDate" DataType="System.DateTime"/>

     <Column Name="Type" DataType="System.String"/>

     <Column Name="Forename" DataType="System.String"/>

     <Column Name="surname" Alias="Surname" DataType="System.String"/>

     <Column Name="EMail" DataType="System.String"/>

     <Column Name="Telephone" DataType="System.String"/>

     <Column Name="CarRegistration" DataType="System.String"/>

     <Column Name="CarMake" DataType="System.String"/>

     <Column Name="CarModel" DataType="System.String"/>

     <Column Name="CarColour" DataType="System.String"/>

   </BusinessObjectDataSource>

 </Dictionary>

 <ReportPage Name="Page1" Watermark.Font="Arial, 60pt">

   <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="47.25">

     <TextObject Name="Text1" Top="9.45" Width="708.75" Height="28.35" Text="MOT Diary - [FormatDateTime([DiaryPDF.DairyDate],&quot;d MMMM yyyy&quot;)]" HorzAlign="Center" Font="Bahnschrift Light, 16pt, style=Bold"/>

   </ReportTitleBand>

   <PageHeaderBand Name="PageHeader1" Top="51.25" Width="718.2" Height="37.8" Border.Lines="Bottom">

     <TextObject Name="Text2" Left="9.45" Top="9.45" Width="94.5" Height="18.9" Text="Time" Font="Bahnschrift Light, 12pt, style=Bold"/>

     <TextObject Name="Text4" Left="113.4" Top="9.45" Width="94.5" Height="18.9" Text="Vehicle" Font="Bahnschrift Light, 12pt, style=Bold"/>

     <TextObject Name="Text5" Left="396.9" Top="9.45" Width="94.5" Height="18.9" Text="Customer" Font="Bahnschrift Light, 12pt, style=Bold"/>

   </PageHeaderBand>

   <DataBand Name="Data1" Top="93.05" Width="718.2" Height="56.7">

     <TextObject Name="Text3" Left="9.45" Top="9.45" Width="94.5" Height="18.9" Text="[FormatDateTime([DiaryPDF.DairyDate],&quot;hh:mm&quot;)]" Font="Bahnschrift Light, 10pt"/>

     <HtmlObject Name="Html1" Left="113.4" Top="9.45" Width="274.05" Height="47.25" Text="[DiaryPDF.CarRegistration]&#13;&#10;[DiaryPDF.CarMake][DiaryPDF.CarModel]&#13;&#10;[DiaryPDF.CarColour]"/>

     <TextObject Name="Text6" Left="396.9" Top="9.45" Width="311.85" Height="47.25" Text="[DiaryPDF.Forename] [DiaryPDF.surname]&#13;&#10;E: [DiaryPDF.EMail]&#13;&#10;T: [DiaryPDF.Telephone]" Font="Bahnschrift Light, 10pt"/>

   </DataBand>

   <PageFooterBand Name="PageFooter1" Top="153.75" Width="718.2" Height="28.35" Border.Lines="Top">

     <TextObject Name="Text7" Top="9.45" Width="170.1" Height="18.9" Text="[PageNofM]" Font="Bahnschrift Light, 8pt"/>

     <TextObject Name="Text8" Left="538.65" Top="9.45" Width="170.1" Height="18.9" Text="Generated [FormatDateTime([Date],&quot;dd/MM/yyyy hh:mm&quot;)]" HorzAlign="Right" Font="Bahnschrift Light, 10pt"/>

   </PageFooterBand>

 </ReportPage>

</Report>

But everytime I run the following I get an error on the Prepare() line


WebReport WebReport = new WebReport();

                       FastReport.Report report = new FastReport.Report();

                       WebReport.Width = "1000";

                       WebReport.Height = "1000";

                       WebReport.Debug = true;

                       report.Dictionary.RegisterData(data, "DiaryPDF", true);

                       report.Load(reportPath);

                       report.Prepare();

                       PDFSimpleExport pdfExport = new PDFSimpleExport();


The error is

{"(Text1): Error CS1026: ) expected\r\n(Text1): Error CS1002: ; expected\r\n(Text1): Error CS1513: } expected\r\n(Text1): Error CS1002: ; expected\r\n(Text1): Error CS1513: } expected\r\n(Text3): Error CS1026: ) expected\r\n(Text3): Error CS1002: ; expected\r\n(Text3): Error CS1513: } expected\r\n(Text3): Error CS1002: ; expected\r\n(Text3): Error CS1513: } expected\r\n(Text1): Error CS1501: No overload for method 'FormatDateTime' takes 0 arguments\r\n(Text1): Error CS0103: The name 'DiaryPDF' does not exist in the current context\r\n(Text3): Error CS1501: No overload for method 'FormatDateTime' takes 0 arguments\r\n(Text3): Error CS0103: The name 'DiaryPDF' does not exist in the current context\r\n"}

Leave a Comment