Ejemplo n.º 1
0
        // TODO:
        private void ButtonParse_Click(object sender, EventArgs e)
        {
            object oMissing = System.Reflection.Missing.Value;

            fileNamePath = WordFunc.GetFilePath(openFileDialog1);


            oWord = new Word.Application {
                Visible = false
            };

            // TODO: Take into account of other cases such as when the user close the dialog instead of choosing a file
            try {
                oDoc = oWord.Documents.Open(fileNamePath, false, false, false);
            }
            catch {
                return;
            }

            WordFunc.ParseDocument(this, oDoc);
            bodyText = oDoc.Content.Text;

            //oDoc.SaveAs2(GetFilePath(saveFileDialog1));
            WordFunc.CloseWordFile(oWord, oDoc);
        }
Ejemplo n.º 2
0
        // TODO:
        private void ButtonAutoFill_Click(object sender, EventArgs e)
        {
            // Populate the dictionary's Values with input from the textboxes
            WordFunc.FillNewTextInput(this);

            // Retrieve new text with replaced fields
            bodyText = WordFunc.ReplaceText(this, bodyText);
            //Console.Out.WriteLine(bodyText);

            oWord = new Word.Application {
                Visible = true
            };

            oDoc = oWord.Documents.Open(fileNamePath);
            Console.Out.WriteLine(String.Format("{0}: {1}", fileNamePath, fileNamePath.Substring(0, fileNamePath.LastIndexOf('\\'))));
            oDoc.SaveAs2(fileNamePath.Substring(0, fileNamePath.LastIndexOf('\\')) + @"\outDoc.doc");
            oDoc.Content.Text = bodyText;
            Console.Out.WriteLine(oDoc.Content.Text);

            WordFunc.CloseWordFile(oWord, oDoc);
        }