Hi sir
I want to export my grid into pdf and excel format with column tamplate and summary . I used the exporting method but it is not working fine.... the normal column is working good but the last 4 column in which I used the column tamplate with summary details is not coming in pdf properly....... all data is showing 0 there ....
I also want to change the oriention of exporting pdf page into landscape.... but unable to do that. The header I'm providing there on document I want to make it on middle but don't know how to do that.
please check the below code and help me for this, it's very urgent. I'm using Ej1 grid of syncfusion version 17.2.0.34 asp.net core 1.1
Here I'm sharing my code here and as an attachment you can find my controller code. grid working fine but exporting functionality not working
Views
----
<ej-grid id="TicketDataGrid" allow-sorting="true" export-to-excel-action="@Url.Action("ExportToExcel_Ticket","TransportNReports")" toolbar-click="toolBarClick" export-to-pdf-action="@Url.Action("ExportToPdf_Ticket","TransportNReports")" export-to-word-action="@Url.Action("ExportToWord_Ticket","TransportNReports")" datasource="ViewBag.ticket" locale="fr-FR" allow-paging="true" allow-filtering="true" show-summary="true" show-column-chooser="true" filter-settings="new Syncfusion.JavaScript.Models.FilterSettings() {FilterType=Syncfusion.JavaScript.FilterType.Excel}">
<e-summary-rows>
<e-summary-row title="Total Amount">
<e-summary-columns>
<e-summary-column summary-type="Sum" display-column="TotalAmountK" template="#TotalTemplate" datamember="TotalAmountK" />
</e-summary-columns>
</e-summary-row>
<e-summary-row title="Total Discount">
<e-summary-columns>
<e-summary-column summary-type="Sum" display-column="DiscountAmount" template="#DiscountTemplate" datamember="DiscountAmount" />
</e-summary-columns>
</e-summary-row>
<e-summary-row title="Total Cancelled Amount">
<e-summary-columns>
<e-summary-column summary-type="Sum" display-column="CancelledAmountk" template="#CancelledTemplate" datamember="CancelledAmountk" />
</e-summary-columns>
</e-summary-row>
<e-summary-row title="Total Outstanding Amount">
<e-summary-columns>
<e-summary-column summary-type="Sum" display-column="OutStandingAmountk" template="#OutstandingTemplate" datamember="OutStandingAmountk" />
</e-summary-columns>
</e-summary-row>
</e-summary-rows>
<e-toolbar-settings show-toolbar="true" toolbar-items=@(new List<string>() {"excelExport","wordExport","pdfExport","printGrid" })>
</e-toolbar-settings>
<e-page-settings print-mode="CurrentPage" page-size="25"></e-page-settings>
<e-columns>
<e-column field="BookingId" header-text="Booking Id" text-align="Center" visible="false" show-in-column-chooser="true"></e-column>
<e-column field="BookingRefNo" header-text="Booking Ref. No." text-align="Center" width="150"></e-column>
<e-column field="DateofSell" header-text="Date" width="80" format="{0:MM/dd/yyyy}" visible="true" show-in-column-chooser="true"></e-column>
<e-column field="Channel" header-text="Channel" text-align=Center width="100" show-in-column-chooser="true" visible="false"></e-column>
<e-column field="Cashier" header-text="Cashier" text-align=Center width="100" show-in-column-chooser="true" visible="false"></e-column>
<e-column field="NoOfPassengers" header-text="No. Of Passenger" text-align=Center width="75" show-in-column-chooser="true" visible="false"></e-column>
<e-column field="SellStation" header-text="Sell Station" text-align=Center width="80" visible="true" show-in-column-chooser="true"></e-column>
<e-column field="DestStation" header-text="Destination" text-align=Center width="80" visible="true" show-in-column-chooser="true"></e-column>
<e-column field="TicketType" header-text="Ticket Type" text-align=Center width="80" visible="true" show-in-column-chooser="true"></e-column>
<e-column field="TotalAmountK" header-text="Amount" text-align=Center width="85" template="#columntotal" show-in-column-chooser="true" visible="true"></e-column>
<e-column field="DiscountAmount" header-text="Discount Amount" text-align=Center width="80" template="#columndiscount" visible="true" show-in-column-chooser="true"></e-column>
<e-column field="CancelledAmountk" header-text="Cancelled Amount" text-align=Center width="80" template="#columncancelled" visible="true" show-in-column-chooser="true"></e-column>
<e-column field="OutStandingAmountk" header-text="OutStanding Amount" text-align=Center width="80" template="#columnoutstanding" visible="true" show-in-column-chooser="true"></e-column>
</e-columns>
</ej-grid>
<ej-script-manager></ej-script-manager>
<script id="TotalTemplate" type="text/x-jsrender">
XOF {{:summaryValue}}
</script>
<script id="DiscountTemplate" type="text/x-jsrender">
XOF {{:summaryValue}}
</script>
<script id="CancelledTemplate" type="text/x-jsrender">
XOF {{:summaryValue}}
</script>
<script id="OutstandingTemplate" type="text/x-jsrender">
XOF {{:summaryValue}}
</script>
<script id="columntotal" type="text/x-jsrender">
XOF {{:TotalAmountK}}
</script>
<script id="columndiscount" type="text/x-jsrender">
XOF {{:DiscountAmount}}
</script>
<script id="columncancelled" type="text/x-jsrender">
XOF {{:CancelledAmountk}}
</script>
<script id="columnoutstanding" type="text/x-jsrender">
XOF {{:OutStandingAmountk}}
</script>
Controller part
-----------------------------
public ActionResult ExportToPdf_Ticket(string GridModel)
{
PdfExport exp = new PdfExport();
List<SalesReportTicketDetails> sales_ticket_detail = HttpContext.Session.GetObjectFromJson<List<SalesReportTicketDetails>>("SalesTicket");
var DataSource = sales_ticket_detail;
GridProperties gridProp = ConvertGridObjectkd(GridModel);
GridPdfExport pdfExp = new GridPdfExport();
pdfExp.FileName = "Export.pdf";
pdfExp.Theme = "flat-saffron";
pdfExp.IsTemplateColumnIncluded = true;
pdfExp.IncludeDetailRow = true;
pdfExp.IsSummaryRow = true;
pdfExp.HeaderText = "Sales Report Ticket Details";
pdfExp.IsAutoFit = true;
gridProp.PdfDetailTemplateInfo = PdfDetailTemplateInfo;
gridProp.PdfColumnTemplateInfo = PdfTemplateInfo;
pdfExp.PdfDocument.PageSettings.Orientation = PdfPageOrientation.Landscape;
PdfDocument document = new PdfDocument();
document.PageSettings.Orientation = PdfPageOrientation.Landscape; //Sets landscape page orientation.
return exp.Export(gridProp, DataSource, pdfExp);
}
remaining code I'm attaching with text file. please check that and help me for this . I'm using ej1 grid of syncfusion version 17.2.0.34 asp.net core 1.1
Attachment:
code_f2b7fd13.rar