public static IEnumerable <Range> ReadAllParagrahsExceptThoseInStory(Document document, WdStoryType storyTypeToIgnore) { foreach (Range storyRange in document.StoryRanges) { var storyType = storyRange.StoryType; if (storyType == storyTypeToIgnore) { continue; } if (storyType == WdStoryType.wdMainTextStory || storyType == WdStoryType.wdTextFrameStory || storyType == WdStoryType.wdEvenPagesFooterStory || storyType == WdStoryType.wdEvenPagesHeaderStory || storyType == WdStoryType.wdFirstPageFooterStory || storyType == WdStoryType.wdFirstPageHeaderStory || storyType == WdStoryType.wdPrimaryFooterStory || storyType == WdStoryType.wdPrimaryHeaderStory || storyType == WdStoryType.wdEndnotesStory || storyType == WdStoryType.wdCommentsStory) { foreach (Range r in ReadParagrahsInAllInstancesOfStory(document, storyType)) { yield return(r); } } } }
public static IEnumerable <Range> ReadParagrahsInAllInstancesOfStory(Document document, WdStoryType storyType) { Range r = document.StoryRanges[storyType]; while (r != null) { foreach (Range par in ReadParagraphsInCurrentInstanceOfStoryStartingFrom(document, r.Paragraphs[1].Range)) { yield return(par); } r = r.NextStoryRange; } }
public static IEnumerable <Range> ReadWordsInAllInstancesOfStory(Document document, WdStoryType storyType) { Range r = document.StoryRanges[storyType]; while (r != null) { foreach (Range rword in ReadWordsInCurrentInstanceOfStoryStartingFrom(document, r.Words[1])) { yield return(rword); } r = r.NextStoryRange; } }