Home:ALL Converter>Copy content of word document Sections

Copy content of word document Sections

Ask Time:2014-03-11T13:58:30         Author:Sarin Vadakkey Thayyil

Json Formatter

In my application, am using Microsoft.Office.Interop.Word, for writing contents to a word document.

        var wordApplication = new Word.Application { Visible = true };
        var document = wordApplication.Documents.Add();
        document.Activate();

In every 1 minutes, i will write few lines to the document in a new section. i.e, a new section will be added in word document at starting of every 5 minute and move cursor to that section, then write content.

        document.Sections.Add();
        wordApplication.ActiveWindow.Selection.GoTo(Word.WdGoToItem.wdGoToPage, Word.WdGoToDirection.wdGoToLast);

After every 10 minutes, I need to run a Thread in Background and copy contents available in each sections to different text files in a remote location.

My problem is, i am not able to access individual sections. Suggest a method to copy text in each section to separate variable or in an array.

Author:Sarin Vadakkey Thayyil,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/22317596/copy-content-of-word-document-sections
yy