Search code examples
c#excelwindows-mobile-6.5

Error while trying to create an excel file in C#


Good morning, I'm trying to create Excel file in C#, I looked to the way to do it, and I found a tutorial, here is the code I tried:

        Microsoft.Office.Interop.Excel.Application excel;  
        Microsoft.Office.Interop.Excel.Workbook worKbooK;
        Microsoft.Office.Interop.Excel.Worksheet worksheet;  
        Microsoft.Office.Interop.Excel.Range celLrangE;

        excel = new Microsoft.Office.Interop.Excel.Application();
        excel.Visible = false;
        excel.DisplayAlerts = false;  

Well, I have this error on initializing the variable excel

COM object with CLSID '{00020819-0000-0000-C000-000000000046}' cannot be created due to the following error: Class not registered .

I searched for this error, what I found is solution to problems in cases, but none has the problem in Excel operations, so ... ?

PS: I'm creating an application for Windows Mobile 6.5, but I think it's supposed to work on it, if it works of course.

For the vote down hungers, well ... unleash yourselves, I can't stop you :) but believe me, I tried a lot, there's so many ways to create Excel files, but whatever I try, the same error is summoning, I think it's not the problem of library, or code, but something else I can't find.

Thanks in advance !


Solution

  • Maybe use another Library: https://code.google.com/archive/p/excellibrary/

    Found in this question: Create Excel (.XLS and .XLSX) file from C#