0

I would need to open from C# a word document which I know contains a certain text in an AsPose desktop control. And I need the text to be already searched in the word document (as if you manually searched the document for "text").

Does anyone know if this is achievable and how?

Rand Random
  • 7,300
  • 10
  • 40
  • 88
cristi71000
  • 1,094
  • 2
  • 10
  • 16
  • To open Word, You can use System.Diagnostics.Process class and Process.Start(string, string) to start the given application as first parameter and second parameter as command line arguments. From there I would imagine you could do what you need. – Ryan Wilson Feb 20 '18 at 16:03
  • Did you have code you've created so far for this task? Otherwise, [This may be useful](https://stackoverflow.com/questions/16253215/open-and-modify-word-document) – Jimmy Smith Feb 20 '18 at 16:04
  • Thanks, opening Word is not the main issue. The problem is to open it with the searched term in place. – cristi71000 Feb 20 '18 at 16:07
  • https://www.codeproject.com/Tips/220074/Search-and-Highlight-the-Text-in-Word-through-Csha – Hackerman Feb 20 '18 at 16:42
  • I'm not clear on what you mean by "the searched term in place" or "I need the text to be already searched"? Do you mean 1) Open the document then 2) Find and select the term in the document then 3) show it to the user? And do please show us the code you're using to start Word and open the document. – Cindy Meister Feb 20 '18 at 17:14
  • Hi Cindy, what I want to happen is this: 1) Open Word document 2) "Tell" word to search something I expect word to behave in the same way as if you would manually search that term (show a search summary with that text occurrences) – cristi71000 Feb 21 '18 at 07:58
  • Since technically your question is "too broad" here are some tips to get you started. If you get stuck in the code you find, come back with a more specific question :-) Google for: "new Word.Application();" "Find.Execute" to locate code samples (problems - but the code has the basics is you're asking for). Also search Find.Execute on this MSDN page: https://msdn.microsoft.com/en-us/library/office/aa192495%28v=office.11%29.aspx?f=255&MSPPError=-2147217396 – Cindy Meister Feb 21 '18 at 16:49

0 Answers0