C# to excel
-
Hello, I can write code to read and write to excel and word.But I face problems with versions.A certain version works at my end and doesnt work at the client end. I have included Microsoft Excel 12.0 Object Library at my end and found that the client didnt have this library .He had Microsoft Excel 5.0 Object Library .So I coded According to version 5.0 but still at the client end I am getting the error saying the Interop file doesnt exist.It works fine with me. Can you tell me how do I nail down version problems and Is the COM coding for Microsoft Excel Word different for different versions. Thanks Pritha
-
Hello, I can write code to read and write to excel and word.But I face problems with versions.A certain version works at my end and doesnt work at the client end. I have included Microsoft Excel 12.0 Object Library at my end and found that the client didnt have this library .He had Microsoft Excel 5.0 Object Library .So I coded According to version 5.0 but still at the client end I am getting the error saying the Interop file doesnt exist.It works fine with me. Can you tell me how do I nail down version problems and Is the COM coding for Microsoft Excel Word different for different versions. Thanks Pritha
-
prithaa wrote:
saying the Interop file doesnt exist.I
If your code creates an interop file, that file needs to be available on your client's system.
My signature "sucks" today
-
Hello, I can write code to read and write to excel and word.But I face problems with versions.A certain version works at my end and doesnt work at the client end. I have included Microsoft Excel 12.0 Object Library at my end and found that the client didnt have this library .He had Microsoft Excel 5.0 Object Library .So I coded According to version 5.0 but still at the client end I am getting the error saying the Interop file doesnt exist.It works fine with me. Can you tell me how do I nail down version problems and Is the COM coding for Microsoft Excel Word different for different versions. Thanks Pritha
Excel 5.0 came out 'way back in 1993 IIRC... I wouldn't be surprised if you had some trouble getting it to work - there aren't any Primary Interop Assemblies for it and working with it directly through COM can be iffy. If your Word and Excel files are not too complex, I would advise you to use NPOI[^] to read from and generate the files. NPOI does not depend on Word or Excel in order to work - so there are no version problems, and you don't even have to worry if the machine your code is running on even has Office at all. It supports formatting like fonts, font styles, colors, tables, formulas, col and row sizing and autosizing, document properties, etc.
-
Thanks for your reply Which files do I need check ? I am sending the exe file of my working project. Pritha
-
Excel 5.0 came out 'way back in 1993 IIRC... I wouldn't be surprised if you had some trouble getting it to work - there aren't any Primary Interop Assemblies for it and working with it directly through COM can be iffy. If your Word and Excel files are not too complex, I would advise you to use NPOI[^] to read from and generate the files. NPOI does not depend on Word or Excel in order to work - so there are no version problems, and you don't even have to worry if the machine your code is running on even has Office at all. It supports formatting like fonts, font styles, colors, tables, formulas, col and row sizing and autosizing, document properties, etc.