Pallav Kumar
Pallav Kumar

Reputation: 19

How to save .xls file using OpenXML in dot net core?

I want to create a .xls file using OpenXML SDK. I am able to create .xlsx and .xlsm files but when i save it as .xls and open in my system it pops an error. Then I have to do save as again for it to work properly. Is there any way to save files directly in .xls format?

Upvotes: 0

Views: 910

Answers (1)

Durga Prasad
Durga Prasad

Reputation: 989

Simple answer is No, you cannot do it.

The reason being .xls format is proprietary to Microsoft. OpenXml SDK cannot understand or write to that format. If you want to store data in .xls format, then you need to use Microsoft office excel interop objects.

Excel namespace interop

If you indeed want to take the route of adding interops to your application to save to .xls format, I would also suggest you to look into following SO answer because adding reference to interop objects in .NET core is not straight forward.

ms interop in .net core

Upvotes: 1

Related Questions