none
How to skip "Sentence"s which contains just some special characters? RRS feed

  • Question

  • Hi,

    I get sentences of a word file using Word "Sentences" Object.

    Sentence currentSentence = sentences.Item(index);

    Some times it gives me something that has some special characters as its text and has no English character in it. Is there any way provided by Word to skip these kind of "Sentence"s? 

     

    Tuesday, January 18, 2011 6:10 AM

Answers

  • Hi Hamidreza

    Nothing built into Word, I'm afraid, no.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Hamidreza G Wednesday, January 19, 2011 2:04 PM
    Tuesday, January 18, 2011 1:20 PM
    Moderator

All replies

  • Hi Hamidreza

    Nothing built into Word, I'm afraid, no.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Hamidreza G Wednesday, January 19, 2011 2:04 PM
    Tuesday, January 18, 2011 1:20 PM
    Moderator
  • Dear Cindy,

    As your suggestions have been always helpful for me, I would like to ask you to give a suggestion in order to skip these sentences.

    Regards,

    Hamidreza Ghader

    Tuesday, January 18, 2011 8:28 PM
  • As your suggestions have been always helpful for me, I would like to ask you to give a suggestion in order to skip these sentences.


    If I'd had one, I'd have mentioned it :-) However, it's very difficult for me to even guess what you mean by "special characters". It also makes a difference whether we're talking about Unicode fonts or ANSI fonts. In addition, I'm not familiar with the C# commands to identify the character code (in VB-speak it's Asc(<string>).

    Given all that, if you're talking about not wanting anything outside the core 257 characters, then you'd want to find out if the sentence.Text contains any character identification greater than 257. But I can't give you any code sample for achieving that because it goes beyond the scope of my present knowledge of C#


    Cindy Meister, VSTO/Word MVP
    Wednesday, January 19, 2011 3:47 PM
    Moderator