C#NET2008 Microsoft WORD 2003

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lenniekuah
    New Member
    • Oct 2006
    • 126

    #1

    C#NET2008 Microsoft WORD 2003

    Hullo Good Friends,
    I need your help. Please help me.

    I am using C#NET2008 to develop Window application

    I am trying to retrieve Sales Transaction and print it on WORD Document as statement of account.

    this coding created error message listed below:
    objWord = new Microsoft.Offic e.Interop.Word. Words();

    Error message:
    Error 1 Cannot create an instance of the abstract class or interface 'Microsoft.Offi ce.Interop.Word .Words'

    Code:
    using Microsoft.Office.Core;
    using Microsoft.Office;
    using Microsoft.Office.Interop.Word;
    
    namespace CSharpDelegatePractice
    {
      public partial class FrmCustomerMaint : Form
      {
      private Microsoft.Office.Interop.Word.Words  objWord;
      private Microsoft.Office.Interop.Word.Document objDoc;
    
    
     private void WordToolStripMenuItem_Click(object sender, EventArgs e)
     {
      string strsql = "Select * from TblSales "
      objWord = new Microsoft.Office.Interop.Word.Words();  <- Error
               
     objDoc = new Microsoft.Office.Interop.Word.Document();
            }
    
       }
    }
  • Anton Zinchenko
    New Member
    • Sep 2010
    • 16

    #2
    I think it should be something like this:
    Code:
    Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
    Microsoft.Office.Interop.Word.Document wordDoc = wordApp.Documents.Add(...);

    Comment

    • lenniekuah
      New Member
      • Oct 2006
      • 126

      #3
      Hi Anton,
      thank you for your sample coding. That is just awesome and wonderful in sharing information with me. Appreciate that very much.

      Cheers,
      Lennie

      Comment

      Working...