Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
¿Cómo puedo exportar Excell desde Asp.net Core con Js?

El servicio principal de asp.net devuelve FileContentResult con este formato: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
¿Cómo puedo abrir en el escritorio o descargar en el navegador el archivo de Excel?

back-end

 [HttpPost] public IActionResult ExportCashBoxReportToExcell(List<string> cashFlowDates) { using (var package = new ExcelPackage()) { var worksheet = package.Workbook.Worksheets.Add("CashBox"); var excelData = package.GetAsByteArray(); var contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; var fileName = "MyWorkbook.xlsx"; return File(excelData, contentType, fileName); } }

Interfaz

 $.ajax({ async: false, type: "POST", headers: {"Authorization": window.localStorage.getItem('token')}, contentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', data: { cashFlowDates }, headers: { "accept": "application/json", "content-type": "application/json", "authorization": "Bearer " + window.localStorage.getItem('token') }, url: '/CashBoxReport/ExportCashBoxReportToExcell', success: (response) => { console.log(response) }, error: (error) => { alert("Hata") } }); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!