There are two questions in the process of getting data on the spreadsheet.

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

스프레드시트 오류복.png


// the tap with sroll bar

스프레드시트 오류보고.png


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.

데이터 Range 문의3.png

//The shape I want.

데이터 Range 문의2.png

데이터 Range 문의1.png


=========================================================

----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.




1 Reply

TS Thaneegairaj Sankar Syncfusion Team December 10, 2021 05:11 PM UTC

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.


  1. Please share the dummy excel file or dummy data variables to replicate issue in our end.

  2. 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


Loader.
Up arrow icon