Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / February 2008

Tip: Looking for answers? Try searching our database.

Excel templates (Old format or invalid type library.)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Filip De Backer - 06 Sep 2005 11:26 GMT
Hi everybody,

Microsoft.Office.Interop.Excel.Workbook ExcelWorkbook =
ExcelWorkbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);

this gives me the following error:
Old format or invalid type library. (Exception from HRESULT: 0x80028018
(TYPE_E_INVDATAREAD))

I've reinstalled my PC with Windows XP, Office XP and VS.net 2005 beta 2.
Even with the VS.NET 2003, it doens't work

The code worked with my Windows 2000 installation and VS.net 2003.

What is the problem here?

thanks!!

Filip
Vis - 07 Sep 2005 10:29 GMT
Try this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2003_ta
/html/odc_VSTMultCR.asp


> Hi everybody,
>
[quoted text clipped - 15 lines]
>
> Filip
Marwa - 21 Feb 2008 09:21 GMT
I have a similar problem

Dear all
I build a new application using c#.net2005 to read excel file I write the following code but it gives me a run time error
((Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))

can any one help me

using System;
using System.Reflection; // For Missing.Value and BindingFlags
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Resources;
using Microsoft.Office.Core;
using System.IO;
using System.Configuration;
using System.Data.SqlClient;
using Excel;

namespace ReadExcelFiletest
{
   public partial class Form1 : Form
   {
       private Excel.Application ExcelObj = null;
       private string strConn = "";
       private string[,] myArray = new string[5000, 2];
       private int myarrayindex;
       public Form1()
       {
           InitializeComponent();
       }

       private void btnBrowse_Click(object sender, EventArgs e)
       {
           openFileDialog1.ShowDialog();
           this.txtLocation.Text = openFileDialog1.FileName;
       }

       private void btnUpdate_Click(object sender, EventArgs e)
       {
           // string Path = @"c:\test.xls";
           string MyPath = this.txtLocation.Text.Trim().ToString();

           // initialize the Excel Application class
           Excel.ApplicationClass app = new ApplicationClass();
           // create the workbook object by opening the excel file.
           Excel.Workbook workBook = app.Workbooks.OpenMyPath , 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
           // get the active worksheet using sheet name or active sheet
           Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet;
           int index = 0;
           // This row,column index should be changed as per your need.
           // i.e. which cell in the excel you are interesting to read.
           object rowIndex = 1;
           object colIndex1 = 1;
           object colIndex2 = 2;
           object colIndex3 = 3;
           myarrayindex = 0;

           try
           {
               while (((Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2 != null)
               {

                   rowIndex = index + 1;
                   string PartNO = ((Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2.ToString();
                   string Price = ((Excel.Range)workSheet.Cells[rowIndex, colIndex2]).Value2.ToString();

                   myArray[myarrayindex, 0] = PartNO;
                   myArray[myarrayindex, 1] = Price;
                   ListViewItem lvi = new ListViewItem();
                   lvi.Text = Convert.ToString(index + 1);
                   lvi.SubItems.Add(PartNO);
                   lvi.SubItems.Add(Price);
                   this.listView1.Items.Add(lvi);

                   myarrayindex++;
                   index++;

               }
           }
           catch (Exception ex)
           {
               app.Quit();

           }
       }
   }

From http://www.developmentnow.com/g/21_2005_9_0_0_592882/Excel-templates-Old-format-
or-invalid-type-library-.ht


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.