Chào mừng đến với Diễn đàn lập trình - Cộng đồng lập trình.
Kết quả 1 đến 2 của 2
  1. #1
    Ngày tham gia
    Sep 2015
    Bài viết
    0

    lỗi khi sử dụng Microsoft.Office.Interop.Word

    Mình có 1 đoạn code như sau:

    Microsoft.Office.Interop.Word.Application _WordApp = new Microsoft.Office.Interop.Word.Application();
    Microsoft.Office.Interop.Word.Document _ExportDoc = null;

    object missing = Type.Missing;
    object readOnly = false;
    object isVisible = false;
    _WordApp.Visible = false;

    _ExportDoc = _WordApp.Documents.Open(strPathCopyed, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);

    object matchCase = true;
    object matchWholeWord = true;
    object matchWildCards = false;
    object matchSoundLike = false;
    object matchAllFOrms = false;
    object forward = true;
    object format = false;
    object matchKashida = false;
    object matchDiacritics = false;
    object matchAlefHamza = false;
    object matchControl = false;
    object replace = 2;
    object wrap = 1;

    pWordApp.Selection.Find.Execute("[findtext]",ref matchCase,ref matchWholeWord, ref matchWildCards,ref matchSoundLike, ref matchAllFOrms, ref forward, ref wrap, ref format, ref "[Replacetext]", ref replace, ref matchKashida, ref matchDiacritics, ref matchAllFOrms, ref matchControl);
    .........

    Khi mình chạy trên máy mình thì ok. Nhưng khi publish và đưa lên máy sever, và sử dụng thì phát sinh ra lỗi:"Object reference not set to an instance of an object" ở dòng pWordApp.Selection.Find.Execute
    Các bạn giúp mình khắc phục với

  2. #2
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    http://diendan.congdongcviet.com/threads/t220341::microsoft-office-interop-excel-khong-chay-tren-iis.cpp

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •