|
<template>
<ejs-spreadsheet :saveUrl="saveUrl" :allowSave="true">
<e-sheets>
<e-sheet>
<e-ranges>
<e-range :dataSource="dataSource"></e-range>
</e-ranges>
<e-columns>
<e-column :width="width1"></e-column>
<e-column :width="width2"></e-column>
<e-column :width="width2"></e-column>
<e-column :width="width1"></e-column>
<e-column :width="width2"></e-column>
<e-column :width="width3"></e-column>
</e-columns>
</e-sheet>
</e-sheets></ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
import { data } from './data.js';
Vue.use(SpreadsheetPlugin);
export default {
data: () => {
return {
dataSource: data,
width1: 180,
width2: 130,
width3: 120,
saveUrl: 'https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save',
//saveUrl: 'http://localhost:59166/api/spreadsheet/save’ // Please provide your localhost link
}
}
}
</script> |
|
<template>
<ejs-spreadsheet
:saveUrl="saveUrl"
:allowSave="true" >
<e-sheets>
<e-sheet>
<e-ranges>
<e-range :dataSource="dataSource"></e-range>
</e-ranges>
<e-columns>
<e-column :width="width1"></e-column>
<e-column :width="width2"></e-column>
<e-column :width="width2"></e-column>
<e-column :width="width1"></e-column>
<e-column :width="width2"></e-column>
<e-column :width="width3"></e-column>
</e-columns>
</e-sheet> </e-sheets
></ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
import { data } from "./data.js";
Vue.use(SpreadsheetPlugin);
export default {
data: () => {
return {
dataSource: data,
height: 600,
width1: 180,
width2: 130,
width3: 120,
saveUrl: "https://localhost:44347/Home/save",
//saveUrl: 'https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save',
};
},
methods: {},
};
</script>
|
|
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
public IActionResult Open(IFormCollection openRequest)
{
OpenRequest open = new OpenRequest();
open.File = openRequest.Files[0];
return Content(Workbook.Open(open));
}
public IActionResult Save(SaveSettings saveSettings)
{
return Workbook.Save(saveSettings);
}
}
|