I'm coding an add-in for word , On the following code I take all the words that is in the file and put them in a dictionary.
`
Dictionary<string, string> motRap = new Dictionary<string, string>();
Microsoft.Office.Interop.Word.Application application = new Microsoft.Office.Interop.Word.Application();
Document document = application.Documents.Open("monfichiertxt.docx");
// Loop through all words in the document.
int count = document.Words.Count;
for (int i = 1; i <= count; i++)
{
// Write the word.
string text = document.Words[i].Text;
//motRapport.Add(text);
motRap.Add(text, "blabla");
}
// Close word.
application.Quit();
And I want the file name of the docx that is currently running, instead of writing "monfichiertxt.docx".
Can someone help me please Thank you.