2

I have an MVC app that uploads an XLS file and imports it. Ther main issue is that these will often be password protected. Unfortunately we can't have Office on the server so interop is not an option server side. I was thinking that when the user browses to the file via their browser and clicks import that I could some how transform the file into plain old CSV before it actually gets to the server at which point I could do the main import. It's an intranet app so the clients will have Office.

So the question is, is there anypoint between the users selecting the file annd clicking upload where the file will be available for me to process on the browser side (where interop would be available) to transform the file?

AntDC
  • 1,807
  • 14
  • 23
  • 1
    Just in case you are considering to install Office on the web server: Don't do that, it's [not officially supported](http://stackoverflow.com/a/8709255/87698). You *will* need a third-party library. – Heinzi Nov 09 '15 at 08:57

3 Answers3

1

No. You can't interact with programs on the clients machine (except with browser addons like ActiveX, don't go there). And you should definitely NOT use Interop on the server.

I would suggest to use EPPlus. It can read/write Excel files, without actually the need of interop. It only works with XLSX documents, so I hope it suits you. Else you might need a third-party library that is capable of reading XLS files.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
0

As per Patricks answer you can't interact with a program on a client machine. An alternative to EPPlus is NPOI which is similar in that it removes the need for interop however it works with either XLS or XLSX documents.

connectedsoftware
  • 6,987
  • 3
  • 28
  • 43
0

Ended up using Syncfusion which does the job nicely.

AntDC
  • 1,807
  • 14
  • 23
  • After being bombarded with uinreasonable license fee demands we have dropped synfusion in favour of TMS FlexCel and it is far easier to use. – AntDC Feb 17 '17 at 17:14