Create Excel Worksheet, do i need Excel installed on the server?

Turns out I have actually Office mounted in your place, as carries out the Test server, nonetheless, the manufacturing hosting server carries out certainly not have Excel mounted.

I have really generated an use that makes use of Microsoft.Office.Interop.Excel, in my local and testing settings whatever functioned terrific, nevertheless the application does not operate in the creation environment.

I really can’t come back and also transform my code, regardless, I would truly not like to need to put up Excel on the creation hosting server.

Do I possess any various other selections other than putting together Office Excel on the manufacturing web server to get the request working?

In the even more overall situation, you carry out certainly not require Excel to establish worksheets, as well as you need to steer clear of any type of choice that needs it for internet use. That includes office interop: it performs not scale in a web atmosphere.

Office Interop carries out need that Office be set up on the hosting server.

Did you appear for some completely free expense stand out parts for.NET. These two components possess completely complimentary variety for cultivating stand out files:

iditect excel component (xlsx and xls files as much as 150 rows).
excel jetcell net part (without restriction composes text to excel files xls and xlsx).

The Excel interop libraries work by opening the Excel application in the background to process the spreadsheet. So without updating your code, you will need to have actually Excel set up on the server. Using interop is an extremely sluggish and error susceptible solution to working with Excel from ASP.NET, the link Joel gave offers several great options.

i have handled to produce a stand out file with interop, and now i desire that stand out file to be downloaded in web internet browser instead of conserving in drive.

this is what i have tried so far to produce stand out file. require some englightment. “this code conserve stand out file to drive, which is not the result that i want to attain.”.

I utilized to produce stand out and returned a FileStereamResult on my controller action. I believe you can not do that with the Excel library you are using.

public FileStreamResult MyAction(parameters)
var workBook = CreateWorkbook(parameters);
var stream = new MemoryStream();
stream.Position = 0;
return File(stream, "attachment;filename=myfile.xls", "myfile.xls");

You will require to conserve the file on the server temporarily in order to serve it to the client.

You can save it in a temperature course utilizing utilities in System.IO.Path like GetTempPath() to put the file in a location the OS will clean up the file up immediately when it’s not required.
var filePath = System.IO.Path.GetTempFileName();
//then save the file to the filePath
return File(filePath);

I have no idea exactly what web server you’re utilizing but if you’re utilizing MVC you ‘d do something like this to serve the file in your controller.

Leave a Reply

Your email address will not be published. Required fields are marked *