How to import a paragraph selected from Microsoft Word 2007 to add-in?Hi all,<br/> I'm writing a add-in for Microsoft Word 2007. A problem is happen, I don't know how to import a paragraph selected from Microsoft Word 2007  to my add-in. Help me please!<br/> Thanks all!© 2009 Microsoft Corporation. All rights reserved.Thu, 09 Jul 2009 13:17:20 Za447ba72-2dcf-4fb7-9f39-1d76e37777cahttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#a447ba72-2dcf-4fb7-9f39-1d76e37777cahttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#a447ba72-2dcf-4fb7-9f39-1d76e37777caSunrise VNhttp://social.msdn.microsoft.com/Profile/en-US/?user=Sunrise%20VNHow to import a paragraph selected from Microsoft Word 2007 to add-in?Hi all,<br/> I'm writing a add-in for Microsoft Word 2007. A problem is happen, I don't know how to import a paragraph selected from Microsoft Word 2007  to my add-in. Help me please!<br/> Thanks all!Fri, 03 Jul 2009 12:35:16 Z2009-07-03T12:35:16Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#f53ecd01-4b69-4dcf-9742-032babe258c8http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#f53ecd01-4b69-4dcf-9742-032babe258c8Cindy Meisterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cindy%20MeisterHow to import a paragraph selected from Microsoft Word 2007 to add-in?Please provide more information. I don't understand what you mean by &quot;importa a paragraph to [your] add-in.&quot; What, more specifically, do you need to do with the paragraph the user has selected in the document?<hr class="sig">Cindy Meister, VSTO/Word MVPSat, 04 Jul 2009 10:32:53 Z2009-07-04T10:32:53Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#0bbbc059-2ba1-4173-b174-eda45fe4d163http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#0bbbc059-2ba1-4173-b174-eda45fe4d163Sunrise VNhttp://social.msdn.microsoft.com/Profile/en-US/?user=Sunrise%20VNHow to import a paragraph selected from Microsoft Word 2007 to add-in?<blockquote>Please provide more information. I don't understand what you mean by &quot;importa a paragraph to [your] add-in.&quot; What, more specifically, do you need to do with the paragraph the user has selected in the document? <hr class=sig> Cindy Meister, VSTO/Word MVP</blockquote> <br/> Instead of copying and paste a paragraph to my add-in, user can select a paragraph and press Ctrl + right mouse click it will auto importing to my add-inMon, 06 Jul 2009 13:19:31 Z2009-07-06T13:19:31Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#f0cf6377-8799-4006-b4b1-5cb6d7d7326chttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#f0cf6377-8799-4006-b4b1-5cb6d7d7326cCindy Meisterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cindy%20MeisterHow to import a paragraph selected from Microsoft Word 2007 to add-in?I still do not understand what you want help with.<br/><br/>FWIW VSTO provides no way for you to assign a keyboard shortcut to a command in your add-in. Keyboard shortcuts can only be mapped to VBA macros within a Word document. If you want to link the keyboard to your add-in you must use the Windows API to hook into the keyboard messaging.<hr class="sig">Cindy Meister, VSTO/Word MVPMon, 06 Jul 2009 14:15:39 Z2009-07-06T14:15:39Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#241ea5f2-860c-4ae1-a4bb-3f8186464a18http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#241ea5f2-860c-4ae1-a4bb-3f8186464a18Sunrise VNhttp://social.msdn.microsoft.com/Profile/en-US/?user=Sunrise%20VNHow to import a paragraph selected from Microsoft Word 2007 to add-in?That is my problem. I don't know how to use the Windows API to hook into the keyboard messaging. Can you help me?<br/> Thanks!<br/>Tue, 07 Jul 2009 03:26:49 Z2009-07-07T03:26:49Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#2072003a-fd3b-44bb-9af5-e35f4aaad2bchttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#2072003a-fd3b-44bb-9af5-e35f4aaad2bcRabinarayan Biswalhttp://social.msdn.microsoft.com/Profile/en-US/?user=Rabinarayan%20BiswalHow to import a paragraph selected from Microsoft Word 2007 to add-in?Hi <div><br/></div> <div>If I understood you question, you want to get some selected text from a Word document in your add-in and process it .</div> <div><br/></div> <div>you can write a function that reads selected text from the document and returns a string . </div> <div> <div> <div> <pre lang="x-c#"> private string GetDocumentText() { try { Word.Selection s = this.Application.Selection; return s.Text; } catch { System.Windows.Forms.MessageBox.Show(&quot;Error reading document !&quot;); } return string.Empty; } </pre> <br/></div> </div> </div>Thu, 09 Jul 2009 06:09:23 Z2009-07-09T06:09:23Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#1715d135-849b-4f8c-8207-9e8c51efdc4ahttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/a447ba72-2dcf-4fb7-9f39-1d76e37777ca#1715d135-849b-4f8c-8207-9e8c51efdc4aTim Lihttp://social.msdn.microsoft.com/Profile/en-US/?user=Tim%20LiHow to import a paragraph selected from Microsoft Word 2007 to add-in?Hello,<br/><br/>Here's a sample of working with Windows API in VSTO please check it out:<br/><a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/74a87306-f7ea-4410-9cbb-6d772d94c8c2/">http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/74a87306-f7ea-4410-9cbb-6d772d94c8c2/</a><br/><br/>Thanks<hr class="sig">We have published a VSTO FAQ recently, you can view them from the entry thread <a href="http://social.msdn.microsoft.com/Forums/en/vsto/thread/31b1ffbf-117b-4e8f-ad38-71614437df59">VSTO FAQ</a>.<br/> If you have any feedbacks or suggestions on this FAQ, please feel free to write us emails to colbertz@microsoft.com.<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help. <br/> <a href="http://cfx.codeplex.com/">Welcome to the All-In-One Code Framework!</a> If you have any feedback, please tell us.Thu, 09 Jul 2009 07:13:26 Z2009-07-09T07:13:26Z