root/Baza Reklam 2 - Faktury/Classes/WordHandler.cs @ 96

Wersja 65, 1.6 KB (wprowadzona przez dorota, 17 years temu)
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5
6namespace Baza_Reklam
7{
8    class WordHandler
9    {
10        Object oMissing = System.Reflection.Missing.Value;
11        Object oTrue = true;
12        Object oFalse = false;
13        Word.Application oWord;
14        Word.Document oWordDoc;
15
16        public WordHandler() {
17            oWord = new Word.Application();                 
18        }
19
20        public void openFile(string filename){
21
22            Object oPlik = filename;
23            oWordDoc = oWord.Documents.Open(ref oPlik, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oTrue);
24        }
25
26        public void setWordVisible() {
27            if (!oWord.Visible) oWord.Visible = true;
28        }
29
30        public void findAndReplace(string _strFind, string _strReplace)
31        {
32            Object oFindText = _strFind;
33            Object oReplaceText = _strReplace;
34            Object oReplace = (Object)Word.WdReplace.wdReplaceAll;
35            bool _boolToF = oWordDoc.Content.Find.Execute(ref oFindText, ref oFalse, ref oFalse, ref oFalse, ref oFalse, ref oFalse, ref oFalse, ref oMissing, ref oFalse, ref oReplaceText, ref oReplace, ref oFalse, ref oFalse, ref oFalse, ref oFalse);
36        }
37
38        public void saveAs(string filename)
39        {
40            Object oFileNameAs = filename;
41            oWordDoc.SaveAs(ref oFileNameAs, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
42        }       
43
44    }
45}
Notatka: Zobacz TracBrowser aby uzyskać więcej informacji.