C# (C Sharp) - ASP.NET

Kodla Büyü
C# da word otomasyonu yapmaya çalışıyorum. Bende Office 2003 yüklü. Word 11.0 COM nesnesi kütüphanesine referans veriyorum. MSDN den aldığım örnek bir word dosyası oluşturma ve içine bilgi yazma kodu var. Bunu denediğimde InvalidCastException hatası veriyor ve belirtilen nesne belirtilen arayüz-arabirime atanamadı hatası veriyor. 2003 PIA ları yeniden yükledim ama sorun çözülmedi. İlgilenen arkadaşlardan yardım bekliyorum..
Kodlar aşağıdadır...
Hata oWord.Visible = true; satırında çıkıyor
Kod:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Word = Microsoft.Office.Interop.Word;
using System.Reflection;
using Microsoft.Office.Core;


namespace WindowsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            object oMissing = System.Reflection.Missing.Value;
            object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */

            //Start Word and create a new document.
            Word._Application oWord;
            Word._Document oDoc;
            oWord = new Word.ApplicationClass();
            oWord.Visible = true; 
            oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,
                ref oMissing, ref oMissing);

........................... diye devam ediyor
 
BBNET
Geri
Üst