Reputation: 1007
I am tring to implement the below tutorial to create an excel document
http://www.codeproject.com/Articles/20228/Using-C-to-Create-an-Excel-Document
However I recieved the below error
CS1748: Cannot find the interop type that matches the embedded interop type 'Microsoft.Office.Interop.Excel.Application'. Are you missing an assembly reference?
After that I tried to set Embed interop types to false,
This time I recieve below error
CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
However Microsoft.Office.Core reference is already added.
Upvotes: 1
Views: 1047
Reputation: 510
Did you add the reference as explained in the tutorial ? I remember using the same tutorial but I think what I added had a different name, basically I added the one thing that said Microsoft and Excel in it.. (it's probably not the one you mentioned)
And another thing they don't tell you (because they didn't have that problem at that time I guess) is a couple of lines to fix some errors.. Add this before you start making the excel table
System.Globalization.CultureInfo Oldci = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");
and this line after you have finished working with the table.
System.Threading.Thread.CurrentThread.CurrentCulture = Oldci;
This saved me when I needed to create excel files.. and I had a bunch of problems with the tutorials online.
Upvotes: 1
Reputation: 2674
If I may suggest you something, now that you are using c#, try to use this libraries instead, it is the newest format and much easier to work with:
http://www.microsoft.com/en-us/download/details.aspx?id=5124
let me know if it helps,
Upvotes: 3