banner



How To Install Microsoft Office Interop Excel Dll In Gac

  • Remove From My Forums

 locked

Install Interop.Microsoft.Office.Interop.Excel.dll on GAC .net 4.0 windows server 2008

  • Question

  • Howdy I need to add together the Interop.Microsoft.Office.Interop.Excel.dll in to the gac, this is because I create a Excl file on my ASP folio for download, only I can't found the GAC for .net 4.0 I try to use the gac on C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX iv.0 Tools

    and C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\

    and not works I have this consequence:

    Microsoft (R) .NET Global Associates Cache Utility.  Version 3.v.30729.1
    Copyright (c) Microsoft Corporation.  All rights reserved.

    Failure calculation assembly to the enshroud: Endeavour to install an assembly without a potent name

    I  try with the steps on http://sujeetji.wordpress.com/2011/01/09/assign-change-strong-proper noun-to-existing-assembly/ but the I accept this effect:

    'ilasm' is not recognized every bit an internal or external command, operable plan or batch file.

    when I search 'ilasm'  on the server I found on:

    C:\Windows\Microsoft.Internet\Framework64\v4.0.30319

    I run but I continue with the same issue, please let me know if you know other way,

    my server is Windows 2008 and I tin can't install function or Visual studio on my server, please let me know if you lot know how I can' brand this.

    Best Regards.

Answers

  • See if the lawmaking beneath works.  I had trouble with it on a car that didn't have excel installed just information technology may work for you . Information technology uses the oledb class with Extended properties for Excel.  I thought this would piece of work on a automobile that did't accept excel installed, but now I'm not certain since the problem I had this week.  Allow me know if it works and so I will know if my problem was solely due to excel not being installed.

                          grade Workbook : IDisposable         {             OleDbConnection conn;             OleDbCommand cmd;             string connectionStr;             const int MAX_COLUMN_WIDTH = 255;             List<ColumnHeader> columnDefinitions = new Listing<ColumnHeader>();             long rowCount = 0;             int sheetCount = 0;             public Boolean CreateWorkbook(string filename)             {                 Boolean succesful = true;                 FileInfo file = new FileInfo(filename);                 DialogResult answer = new DialogResult();                 answer = DialogResult.Yes;                 if (file.Exists == truthful)                 {                     // If the workbooks already be, prompt to delete.                     answer = MessageBox.Show(                        "Delete existing workbooks (" + filename + ")?",                        "Workbook Exists",                     MessageBoxButtons.YesNo);                     if (answer == DialogResult.Yeah)                     {                         attempt                         {                             file.Delete();                             Application.DoEvents();                         }                         catch                         {                             MessageBox.Evidence("Cannot Delete file");                             succesful = false;                         }                     }                 }                 if (succesful)                 {                                                          connectionStr = string.Format(                        "Provider=Microsoft.Jet.OLEDB.4.0;" +                        @"Data Source={0};" +                        "Extended Properties=\"Excel 8.0;HDR=Aye\"",                        filename);                     try                     {                         conn = new OleDbConnection();                         conn.ConnectionString = connectionStr;                         conn.Open();                         cmd = new OleDbCommand();                         cmd.Connectedness = conn;                         Application.DoEvents();                     }                     catch (Exception e)                     {                         MessageBox.Bear witness("Cannot create Excel workbook");                         succesful = false;                     }                 }                 return succesful;             }             public Boolean CreateHeaders(DataTable table)             {                 Boolean succesful = true;                 string columnFormatText = "";                 string newcolFormat = "";                 foreach (DataColumn col in table.Columns)                 {                     switch (col.DataType.Name)                     {                         instance "Byte":                             newcolFormat = "'" + col.ColumnName + "' byte";                             interruption;                         case "Int16":                             newcolFormat = "'" + col.ColumnName + "' integer";                             break;                         case "Int32":                             newcolFormat = "'" + col.ColumnName + "' integer";                             suspension;                         instance "Int64":                             newcolFormat = "'" + col.ColumnName + "' long";                             break;                         case "Double":                             newcolFormat = "'" + col.ColumnName + "' double";                             pause;                         case "Guid":                         case "Cord":                             newcolFormat = "'" + col.ColumnName + "' char(" + MAX_COLUMN_WIDTH.ToString() + ")";                             break;                         case "DateTime":                             newcolFormat = "'" + col.ColumnName + "' date";                             break;                         default:                             break;                     }                     if (columnFormatText.Length == 0)                     {                         columnFormatText = newcolFormat;                     }                     else                     {                         columnFormatText += "," + newcolFormat;                     }                     ColumnHeader newColHeader = new ColumnHeader();                     newColHeader.proper name = col.ColumnName;                     newColHeader.format = newcolFormat;                     columnDefinitions.Add together(newColHeader);                 } //end foreach                 try                 {                     sheetCount += 1;                     rowCount = 1;                     cmd.CommandText = string.Format("CREATE TABLE Results_{0} ({one})",                          sheetCount.ToString(), columnFormatText);                     cmd.ExecuteNonQuery();                     rowCount += 1;                     Application.DoEvents();                                     }                 catch (Exception e)                 {                     MessageBox.Show("Cannot add together columns to Excel workbook ({0})", e.Message);                     succesful = false;                 }                              return succesful;             }             public Boolean WriteData(DataTable tabular array)             {                    Boolean succesful = true;                 string columnValuesText = "";                 string columnValues = "";                 int rownumber = 0;                 cord columnsHeaderText;                 foreach (DataRow row in tabular array.Rows)                 {                     endeavour                     {                         int colIndex = 0;                         columnValuesText = "";                         columnsHeaderText = "";                         foreach (var colText in row.ItemArray)                         {                             if (!(colText is DBNull))                             {                                 if (columnsHeaderText.Length == 0)                                 {                                     columnsHeaderText = "'" + columnDefinitions[colIndex].proper name + "'";                                 }                                 else                                 {                                     columnsHeaderText += "," + "'" + columnDefinitions[colIndex].name + "'";                                 }                                 if (colText.GetType().ToString() == "System.String")                                 {                                     columnValues = (cord)colText;                                     if (columnValues.Length > (MAX_COLUMN_WIDTH - 2))                                     {                                         columnValues = columnValues.Substring(0, MAX_COLUMN_WIDTH - two);                                     }                                     //Mar thirteen, 2022 changed from: columnValues to: columnValuesText                                      if (columnValuesText.Length == 0)                                     {                                         columnValuesText = "'" + columnValues + "'";                                     }                                     else                                     {                                         columnValuesText += ",'" + columnValues + "'";                                     }                                 }                                 else                                 {                                     if (columnValuesText.Length == 0)                                     {                                         columnValuesText = "'" + colText + "'";                                     }                                     else                                     {                                         columnValuesText += ",'" + colText + "'";                                     }                                 }                             }                             colIndex += 1;                         }                         if (rowCount > 65536)                         {                             CreateHeaders(tabular array);                         }                         cmd.CommandText = cord.Format("INSERT INTO Results_{0} ({i}) values ({two})",                             sheetCount.ToString(), columnsHeaderText, columnValuesText);                         rowCount += 1;                         cmd.ExecuteNonQuery();                     }                     catch (Exception e)                     {                         string errormsg = string.Format("Cannot cannot add together row to Excel workbook {0}",                             east.Message);                         MessageBox.Show("Cannot cannot add row to Excel workbook");                         succesful = false;                     }                     rownumber++;                 }                 return succesful;             }             public void Dispose()             {                 conn.Close();                 columnDefinitions = null;             }         }


    jdweng

    • Proposed as answer by Monday, May twenty, 2022 2:47 PM
    • Marked as reply by Mike Feng Th, May 23, 2022 1:44 PM

Source: https://social.msdn.microsoft.com/Forums/lync/en-US/647c0db8-0cd2-42aa-a9b1-faa7214011fe/install-interopmicrosoftofficeinteropexceldll-on-gac-net-40-windows-server-2008?forum=netfxbcl

Posted by: lomonacogotal1994.blogspot.com

0 Response to "How To Install Microsoft Office Interop Excel Dll In Gac"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel