Hi Rames,
Thank you for using Syncfusion products.
Yes. In Spreadsheet control, we can view the MS Excel files [formats - “XLSX, XLS”] in web browsers by using Ribbon ‘FILE’=>‘Open’ menu option or using ‘import()’ client-side method. We have also provided the support to import the pivot table contained Excel files too.
For your convenience, we have prepared a sample to demonstrate your requirement “Viewing pivot table contain Excel file in MVC Spreadsheet” and the same can be downloaded from the following sample link. Please refer the following code example to achieve your requirement.
VIEW
@(Html.EJ().Spreadsheet<object>("Spreadsheet")
.EnablePivotTable(true)
//...
.ImportSettings(import =>
{
import.ImportMapper("Home/Import");
})
.ClientSideEvents(events => events.LoadComplete("onLoadComplete"))
)
<script type="text/javascript">
function onLoadComplete(args) {
if (!this.isImport)
this.import({ url: "Sample_PivotTableData.xlsx" });
}
</script>
|
CONTROLLER
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Import(ImportRequest importRequest)
{
if (importRequest.File == null)
importRequest.Url = Request.Url.ToString().Replace(Request.Url.LocalPath, "") + "/Files/" + importRequest.Url;
return importRequest.SpreadsheetActions();
}
|
For more information, please refer the below online Spreadsheet pivot sample and API help documentation links.
Regards,
Silambarasan I