I am trying to read/parse a word document for information. Inside the word document, it contains the name, email address, subject, message (let's leave out attachments for now if it complicates things). I have each info on a separate line to make things simple. After it has been read, it should dispatch the email to the email address with the corresponding subject, message and attachment (leave attachment if complicated) to the email address.
This is also a console application where processWord.dll will handle the processing and dispatching.
For starters, this is what I have so far inside my Program.cs that loops through all the words in the document and prints it to the console:
using Microsoft.Office.Interop.Word;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project
{
class Program
{
static void Main(string[] args)
{
Microsoft.Office.Interop.Word.Application application = new Microsoft.Office.Interop.Word.Application();
Document document = application.Documents.Open("C:\\Users\\name\\Desktop\\word.docx");
int count = document.Words.Count;
for (int i = 1; i <= count; i++)
{
string text = document.Words[i].Text;
Console.WriteLine("Word {0} = {1}", i, text);
}
}
}
}