Hi, SyncfusionTeam
I have two problems in the process of importing data into the spreadsheet.
first,
In the imported Excel tab, one tab has a scroll bar that fits the range of data, but the other tab has not.
// the tap without scroller bar
// the tap with sroll bar
Second,
When the imported data appears in the cell, I hope all the data will come out as shown in the following image.
I would appreciate it if you could answer if there is any souce to refer to.
//The form that appeared.
//The shape I want.
=========================================================
----cshtml-----
<h4>DESIGN BASIS UPDATE</h4>
<br />
<br />
<div class="row">
<button id="SaveBtn" class="e-btn" type="button" style="float: right; font-size: 12px; height: 30px; width: 90px; " onclick="SaveBtnClick(this)">SAVE</button>
<button id="DownloadBtn" class="e-btn" type="button" style="float: right; font-size: 12px; height: 30px; width: 90px; text-align: center; margin-left: 5px" onclick="DownloadBtnClick(this)">DOWNLOAD</button>
</div>
<br />
<div class="control-section">
<ejs-spreadsheet id="spreadsheet" openUrl="Open" allowOpen="true" created="created" showRibbon="false" showFormulaBar="false">
</ejs-spreadsheet>
</div>
------------------------------------------
---script-----------
function created() {
var spreadsheet = ej.base.getComponent(document.getElementById('spreadsheet'), 'spreadsheet');
fetch("@ViewBag.filename") // fetch the remote url
.then((response) => {
response.blob().then((fileBlob) => { // convert the excel file to blob
var file = new File([fileBlob], "Design Basis.xls"); //convert the blob into file
spreadsheet.open({ file: file }); // open the file into Spreadsheet
})
})
}
-------------------------
-------------controller-------------
public class DesignBasisController : Controller
{
IHostingEnvironment _hostingEnvironment;
public DesignBasisController(IHostingEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
public IActionResult DesignBasis()
{
//string filename = _hostingEnvironment.WebRootPath + @"\TEMPLATE\Design Basis.xls";
string filename = "https://localhost:44303/TEMPLATE/Design Basis.xls";
ViewBag.filename = filename;
return View();
}
public IActionResult Open(IFormCollection openRequest)
{
OpenRequest open = new OpenRequest();
open.File = openRequest.Files[0];
return Content(Workbook.Open(open));
}
}
----------------------------------------
Thank you in advance for answering the long article.
I hope you have a good day.
Hi TaeWook
Thanks for contacting Syncfusion support.
Query1: In the imported Excel tab, one tab has a scroll bar that fits the range of data, but the other tab has not.
Ans: We have checked your reported issue. We suspect that imported excel file has predefined row count. So before proceed further we would like to know the following details to replicate your reported issue in our end.
Please share the dummy excel file or dummy data variables to replicate issue in our end.
If possible, please share the issue reproducible sample.
Could you please check the above details and get back to us with the above requested information based on that we will check provide you a better solution quickly.
Query2: When the imported data appears in the cell, I hope all the data will come out as shown in the following image.
Ans: We have checked your reported requirement. We can be able to achieve your requirement in sample level, please find the below code snippets
|
<ejs-spreadsheet id="spreadsheet" openUrl="http://localhost:55367/Home/Open" saveUrl="http://localhost:55367/Home/Save" height="900px" created="createdHandler" dataBound="onDataBound">
</ejs-spreadsheet>
function onDataBound(args) { var spreadsheet = ej.base.getComponent(document.getElementById('spreadsheet'), 'spreadsheet'); spreadsheet.autoFit("A:B"); } |
For your reference we have prepared a sample,
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ASP.NET_CORE-314224763
Please let us know, if you need any further assistance.
Regards,
Thaneegairaj S