I am writing a program that creates stand out reports, currently using the Microsoft.Interop.Excel reference. My dev computer has Excel on it, but the end user might or may not have Office installed. Will this tool stop working if Office isn’t really installed on the end users computer system, or is this interop service different from the actual application?
Unless you have actually Excel installed on the Server/PC or utilize an external tool (which is possible without utilizing Excel Interop, see Create Excel (. XLS and.XLSX) file from C#, it will fail. Using the interop needs Excel to be set up.
If you have an interest in making.xlsx (Office 2007 and beyond) files, you’re in luck. Office 2007+ utilizes OpenXML which for lack of a more apt description is XML files within a zip named.xlsx
Take a stand out file (2007+) and rename it to.zip, you can open it up and take a look. If you’re using.NET 3.5 you can utilize the System.IO.Packaging library to manipulate the relationships & zipfile itself, and linq to xml to have fun with the xml (or just DOM if you’re more comfy).
Otherwise id reccomend DotNetZip, a powerfull library for control of zipfiles.
After that you have to have office installed in the set up PC which is actually an unnecessary dependence + if you forget to do away with at that point you’ll overcharge memory, if you prep on utilizing office.interop.excel. There are actually other libraries available where you PLACE ON”T requirement Office put in, and also are much less complicated to utilize: NPOI, ClosedXml and also EPPlus being actually some well-liked options. I will definitely leave behind the audience to opt for which is optimum depending on to their specific requirements, nevertheless I would absolutely recommend awful of those 3 over the office.interop dll.
In this case of course, it will stop working to manage since it hinges on succeed, you’re simply contacting succeed functions., if they do certainly not have it mounted
Clearly they will be actually capable to open it if the consumer performs certainly not possess Excel however has a tool that will definitely inspect out Excel (like Open Office). Microsoft has a free Excel viewers available for those individuals that perform certainly not have Excel.
Great for brand-new data, nonetheless drawback listed here is ClosedXML’s absence of intellect to improve or alter information in an existing worksheet. If it has anything considerable like a chart, a popular use case is actually to start along with a layout template and also use relevant information to it; ClosedXML is going to likely crack the layout theme.
OpenXMLDeveloper has large amounts of information regarding OpenXML and also you can easily find more there.
Utilizing the Interop will definitely need that the Excel be put together on the creator coming from which it is actually running. In a hosting server side solution, this are going to be actually horrific. Somewhat, you should make use of a tool like the ones above that allows you construct an Excel data without Excel being actually mounted.
If you want.xls (2003 as well as listed here) you are actually visiting require to browse through 3rd celebration collections or even probably discover the report style on your own to accomplish this without stand up out prepared up
An interop calls another thing, it is actually an interoperability installation, thus you’re inter-operating with one thing … in this situation Excel, the true installed Excel.