Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Error in save file ...

Error in save file ...

Scheduled Pinned Locked Moved C#
helpcom
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mostafa_h
    wrote on last edited by
    #1

    Hi All ! I imported an excel file in a datagridview and then Filter it by ... , then I save as it in any my computer , when want to the save in another computer , I Recieve this Error :

    Old Format or Invalid Type library(Exception from HRESULT:0x80028018...

    Here in my code :

    ...
    Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application();
    ExcelApp.Application.Workbooks.Add(Type.Missing);
    Microsoft.Office.Interop.Excel.Workbook excelBook = ExcelApp.Workbooks.Add(XlSheetType.xlWorksheet);
    Microsoft.Office.Interop.Excel.Worksheet excelWorksheet = (Worksheet)(excelBook.Worksheets[1]);
    excelWorksheet.DisplayRightToLeft = true;
    ...

    Thank u for any help

    s_mostafa_h

    S L 2 Replies Last reply
    0
    • M mostafa_h

      Hi All ! I imported an excel file in a datagridview and then Filter it by ... , then I save as it in any my computer , when want to the save in another computer , I Recieve this Error :

      Old Format or Invalid Type library(Exception from HRESULT:0x80028018...

      Here in my code :

      ...
      Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application();
      ExcelApp.Application.Workbooks.Add(Type.Missing);
      Microsoft.Office.Interop.Excel.Workbook excelBook = ExcelApp.Workbooks.Add(XlSheetType.xlWorksheet);
      Microsoft.Office.Interop.Excel.Worksheet excelWorksheet = (Worksheet)(excelBook.Worksheets[1]);
      excelWorksheet.DisplayRightToLeft = true;
      ...

      Thank u for any help

      s_mostafa_h

      S Offline
      S Offline
      souidi abderrahman
      wrote on last edited by
      #2

      what is the excel version you use?? 2003 or 2007??:confused::confused:

      M 1 Reply Last reply
      0
      • S souidi abderrahman

        what is the excel version you use?? 2003 or 2007??:confused::confused:

        M Offline
        M Offline
        mostafa_h
        wrote on last edited by
        #3

        it's 2003

        s_mostafa_h

        1 Reply Last reply
        0
        • M mostafa_h

          Hi All ! I imported an excel file in a datagridview and then Filter it by ... , then I save as it in any my computer , when want to the save in another computer , I Recieve this Error :

          Old Format or Invalid Type library(Exception from HRESULT:0x80028018...

          Here in my code :

          ...
          Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application();
          ExcelApp.Application.Workbooks.Add(Type.Missing);
          Microsoft.Office.Interop.Excel.Workbook excelBook = ExcelApp.Workbooks.Add(XlSheetType.xlWorksheet);
          Microsoft.Office.Interop.Excel.Worksheet excelWorksheet = (Worksheet)(excelBook.Worksheets[1]);
          excelWorksheet.DisplayRightToLeft = true;
          ...

          Thank u for any help

          s_mostafa_h

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          It is possible that error is caused by different versions of Excel Interop assemblies. Anyway, you should try to avoid Excel Interop. I use GemBox.Spreadsheet .NET Excel component for generating reports in my company. Here is an example how to import/export DataGrid to Excel using GemBox.Spreadsheet.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups