0
votes

I am Using Kendo UI and exporting report to excel. The codes are as follows Kendo UI Grid:

   <html>
     @(Html.Kendo().Grid<Futuresteps.Media.Models.WorkingTargetInDoorDetail>()
    .Name("grid")
    .Columns(columns =>
    {

                columns.Bound(indoor => indoor.ID).Width(100).HtmlAttributes(new { @class = "tdid" });
                columns.ForeignKey(indoor => indoor.MediaTypeID, (System.Collections.IEnumerable)ViewBag.MediaTypeID, "RegistrationID", "MediaTypeName").Width(200).Title("Media");
                columns.ForeignKey(indoor => indoor.channel, (System.Collections.IEnumerable)ViewBag.ChannelID, "RegistrationID", "ChannelName").Width(200).Title("Channel");
                columns.Bound(indoor => indoor.EntryDate).Width(200).Format("{0:d}").Title("Entry Date");
      })
     .ToolBar(toolBar =>
      {
           toolBar.Excel();
    })
    .Excel(excel => excel
        .FileName("Indoor Media Report.xlsx")
        .Filterable(true)
        .ProxyURL(Url.Action("Excel_Export_Save", "WorkingTargetInDoorDetail"))
      )
    </html>

MVC export method : [HttpPost] public ActionResult Excel_Export_Save(string contentType, string base64,string fileName) { var fileContents = Convert.FromBase64String(base64); return File(fileContents, contentType, fileName); }

It is working and I get the correct excel file report but this excel file contains only the grid , I want to add some more information before the grid in excel file , example table Caption,Channel name before grid in excel file can any one help me please?

1

1 Answers

0
votes

The approach from the other thread is viable for the current task too. The excelExport event could be used to modify the exported workbook and add the required information.