Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142228 | Jan 23,2019 01:40 PM UTC | Feb 7,2019 10:36 AM UTC | jQuery | 9 |
![]() |
Tags: ejSpreadSheet |
using Syncfusion.XlsIO;
public void ProcessRequest(HttpContext context)
{
string filePath = HttpContext.Current.Server.MapPath("\\Uploads") + "\\Temp\\" + context.Request.Form["filename"].ToString();
ImportRequest importRequest = new ImportRequest();
Stream fileStream = File.Open(filePath, FileMode.Open, System.IO.FileAccess.Read);
//Loads or open an existing workbook through Open method of IWorkbooks
ExcelEngine excelEngine = new ExcelEngine();
IWorkbook workbook = excelEngine.Excel.Workbooks.Open(fileStream);
//Save the workbook as stream
MemoryStream outputStream = new MemoryStream();
workbook.SaveAs(outputStream, ",");//save as csv
outputStream.Position = 0;
workbook = excelEngine.Excel.Workbooks.Open(outputStream);
outputStream.Position = 0;
importRequest.FileStream = outputStream;
importRequest.File = null;
string str = Spreadsheet.Open(importRequest);
fileStream.Close();
fileStream.Dispose();
outputStream.Close();
outputStream.Dispose();
context.Response.Write(str);
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.