You are viewing limited content. For full access, please sign in.

Question

Question

Error: 80040154 Class not registered

asked on April 20, 2018

Hi,

I getting error as below when I run script in workflow:

"Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))." 

Please assist me on this issue. 

 

Kindly refer code as below :

namespace WorkflowActivity.Scripting.SDKScript
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Excel = Microsoft.Office.Interop.Excel;
    using System.Runtime.InteropServices;
    using System.IO;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.CSharp;
    using System.Windows.Forms;
    using Laserfiche.RepositoryAccess;
    using Laserfiche.DocumentServices;

    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class Script1 : RAScriptClass102
    {
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {
            // Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
            // Write your code here.
            string edoctoken = GetTokenValue("DownloadElectronicDocument_Result File").ToString();
            edoctoken=edoctoken.Replace(@":",@"");
            string path="C:\\ProgramData\\Laserfiche\\WF\\ServerData\\"+edoctoken;

            
            //use excel library to read and get the data
            Excel.Application xlApp = new Excel.ApplicationClass();
            Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(path);

            // Sheet 1
            Excel.Worksheet xlWorksheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkbook.Sheets[1];
            Excel.Range xlRange = xlWorksheet.UsedRange;

            try
            {

                int rowCount = xlRange.Rows.Count;
                SetTokenValue("Row Values",rowCount);

                int colCount = xlRange.Columns.Count;
                SetTokenValue("Column Values",colCount);

                
                //CIF No.
                List<string> CIFList = new List<string>();
                for(int i=2;i<=rowCount;i++)
                {
                    string CIFNo = Convert.ToString((xlRange.Cells[i,1]as Excel.Range).Value2);
                    if (CIFNo!=null)
                    {
                        CIFList.Add(CIFNo);
                    }
                }
                SetMultiValueToken("CIF No.",CIFList, true);

                //ACF No.
                List<string> ACFList = new List<string>();
                for(int i=2;i<=rowCount;i++)
                {
                    string ACFNo = Convert.ToString((xlRange.Cells[i,2]as Excel.Range).Value2);
                    if (ACFNo!=null)
                    {
                        ACFList.Add(ACFNo);
                    }
                }
                SetMultiValueToken("ACF No.",ACFList, true);

                //Customer Name
                List<string> CustList = new List<string>();
                for(int i=2;i<=rowCount;i++)
                {
                    string CustName = Convert.ToString((xlRange.Cells[i,3]as Excel.Range).Value2);
                    if (CustName!=null)
                    {
                        CustList.Add(CustName);
                    }
                }
                SetMultiValueToken("Customer Name",CustList, true);

                //Financing Amount
                List<string> FinanceAmountList = new List<string>();
                for(int i=2;i<=rowCount;i++)
                {
                    string FinancingAmount = Convert.ToString((xlRange.Cells[i,4]as Excel.Range).Value2);
                    if (FinancingAmount!=null)
                    {
                        FinanceAmountList.Add(FinancingAmount);
                    }
                }
                SetMultiValueToken("Financing Amount",FinanceAmountList, true);

                //Company Registration
                List<string> ComRegList = new List<string>();
                for(int i=2;i<=rowCount;i++)
                {
                    string ComReg = Convert.ToString((xlRange.Cells[i,5]as Excel.Range).Value2);
                    if (ComReg!=null)
                    {
                        ComRegList.Add(ComReg);
                    }
                }
                SetMultiValueToken("Company Registration No",ComRegList, true);

                 //IC Number
                List<string> ICNoList = new List<string>();
                for(int i=2;i<=rowCount;i++)
                {
                    string ICNo = Convert.ToString((xlRange.Cells[i,6]as Excel.Range).Value2);
                    if (ICNo!=null)
                    {
                        ICNoList.Add(ICNo);
                    }
                }
                SetMultiValueToken("I.C No",ICNoList, true);


                //Document Type
                List<string> DocTypeList = new List<string>();
                for(int i=2;i<=rowCount;i++)
                {
                    string DocType = Convert.ToString((xlRange.Cells[i,7]as Excel.Range).Value2);
                    if (DocType!=null)
                    {
                        DocTypeList.Add(DocType);
                    }
                }
                SetMultiValueToken("Document Type",DocTypeList, true);
                */

            xlWorkbook.Save();
            }
            catch
            {

            }
            finally
            {
                Marshal.ReleaseComObject(xlRange);
                Marshal.ReleaseComObject(xlWorksheet);

                xlWorkbook.Close();
                Marshal.ReleaseComObject(xlWorkbook);

                xlApp.Quit();
                Marshal.ReleaseComObject(xlApp);
            }
        }
    }
}

 

0 0

Replies

replied on April 20, 2018

Hi Jeff,

Do you have registered the dll files ( sample: Microsoft.Office.Interop.Excel)  that you use in Workflow Administration Console?

 

regards,

Marco.

0 0
replied on April 23, 2018

Hi,

After I add the dll to scripting and I get error like this "    4/23/2018 12:04:49 AM    Script    Exception from HRESULT: 0x800A03EC".

 

Please assist me on this

 

0 0
replied on April 25, 2018

This is not a Laserfiche error.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.