本文介绍了单词,删除incorrects列中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a function in c# that reads a word document by words. First it is placed on the page and then it goes through the words. The words are between columns.
On some pages, by mistake there is a column jump that causes me when requesting the next word, to return the one from the next column. However, the rest of the correct words below the jump of the column are shown on the screen.
I can not remove the wrong codes by hand because they are many pages and also the screen display gets out of control.
 
I need to delete that code by software and the execution will return the next word of the same column without the columns getting out of control. I know by software what the wrong codes are by controlling their vertical position.
 
Word loop on the page:
foreach (Microsoft.Office.Interop.Word.Range word in MyRange.Words)
 
Vertical 
vertical float = word.get_Information (Microsoft.Office.Interop.Word.WdInformation.wdVerticalPositionRelativeToPage);
 
Incorrect Column Break:
if (word.text == "\ u000e" && vertical <650)
...
 
Thanks for your help.

推荐答案

你当前的问题是什么?

既然你可以捕获错误的列中断,你可能只是删除了错误的列中断然后继续循环直到捕获正确的列中断。

Since you could catch the incorrect column break, you could just deleted the incorrect column break and then continue to loop until catch the correct column break.

                if (word.Text == "\u000e" && vertical < 650)
                {                  
                    word.Delete();
                }
                else if (word.Text == "\u000e" && vertical >= 650) {
                    return;
                }
                Debug.Print(word.Text);

最好的问候,

Terry


这篇关于单词,删除incorrects列中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 01:20