How can I create a new Word document pro grammatically using Visual Studio Tools for Office?
Feb 19, 2015 Your question might be a possible duplicate of: extract image from word file However, based on my previous answer to your question regarding how to programmatically compare an external image with inline shapes in Word ( see Compare picture in Word file and in a folder?) - you can make a couple of simple adjustments and use almost the exact same sample code to export each inline shape. Aug 08, 2006 Activate Your Word Documents with VSTO: Page 2. Within Visual Studio.NET you can create a new Word Document containing C# code behind using the File — New Project dialog, selecting 'Office' as the application type and selecting 'Word Document' as the template as in Figure 2.
GravitonGraviton
3 Answers
What you are actually after is Office Automation using the PIA's (Primary Interop Assemblies).
VSTO is actually a set of Managed .net extensions which make writing add-ins for Office far easier. For external interaction VSTO is not used at all (though you can still reference VSTO libraries and use some of the helpers if you wanted to).
![Adding picture to word document Adding picture to word document](http://blogs.msmvps.com/wordmeister/files/2012/09/CMT_SDK_Form.png)
Have a look at http://support.microsoft.com/kb/316384 to get you started. And google 'word interop create document'
Jake GinnivanJake Ginnivan
For a VSTO app-level add-in, you can do something like this:
where
objTemplate
can be a template of documentSee Documents.Add Method
Luke
Now, I might be wrong on this, but I don't believe you can actually make a new Word doc using VSTO. I'm not intimately familiar with VSTO, so forgive me if I'm incorrect on that point.
I do know that you can use Office Interop libraries to do this, however.
To download the libraries, just do a search for 'office interop assemblies,' possibly including the Office version you want (ex: 'office interop assemblies 2007').
Once you've included the Word Interop assembly into your application (using Add Reference), you can do something like:
Hope that helps!
Tim RidgelyTim Ridgely
Not the answer you're looking for? Browse other questions tagged ms-wordvstoms-office or ask your own question.
How to select a range of pages from whole document in Word
If you want to select any page ranges in a Word document, how many ways can you get it done? Now, I introduce some tricks for you to select a range of pages in Microsoft Word.
Select a range of pages with Kutools for Word
![Vsto extract pictures in a word document pdf Vsto extract pictures in a word document pdf](https://cdn.e-iceblue.com/images/art_images/get_height_1.png)
Select a range of pages or specific pages as you need If you want to select a range of pages or specific pages from a Word document, Kutools for Word's Select Pages feature can help you to select any page that you need. Kutools for Word: with more than 100 handy Word add-ins, free to try with no limitation in 60 days. Click to Download and free trial Now! |
Select a range of pages with holding Shift in Word
Amazing! Use Efficient Tabs in Word (Office) like Chrome, Firefox and New Internet Explorer!
Click on the start of the page and hold Shift, scroll to the end of the page and click on the end of the content of this page. Now the pages are selected.
Select a range of pages with VBA
1. Press Alt+F11 to open the Microsoft Visual Basic for Applications window;
2. Click Module from Insert tab, copy and paste the following VBA code into the Module window;
VBA code: select a range of pages from a Word document:
3. Press F5 to run this code, an the pages from page 2 to page 6 are selected at once.
Note: Here you can change Count:=2 and Count:=6to meet your needs. In this VBA code, we select the page range from page 2 to page 6.
Select a range of pages with Kutools for Word
With Kutools for Word’s Select Pages utility, you can quickly select any page ranges you want in the document. Just one click will help you finish the page selection.
Kutools for Word: with more than 100 handy Word add-ins, free to try with no limitation in 60 days. |
1. Click Kutools > Pages > Select Pages, see screenshot:
2. In the pop-up dialog, you can specify the page range by typing the number in the field under Select pages according to range section. Or you can select specific pages as you need in the Select pages according to selection list box. See screenshot:
3. Click OK or Apply button to select your desired pages.
Click to download Kutools for Word and free trial now!
Demo: Select A Range Of Pages From a Word document
Kutools for Word: with more than 100 handy Word add-ins, free to try with no limitation in 60 days. Download and free trial now!
Relative articles:
Recommended Word Productivity Tools
Kutools For Word - More Than 100 Advanced Features For Microsoft Word, Save Your50% Time
- Complicated and repeated operations can be done one-time processing in seconds.
- Insert multiple images across folders into Word document at once.
- Merge and combine multiple Word files across folders into one with your desired order.
- Split the current document into separate documents according to heading 1, section break or other criteria.
- Convert files between Doc and Docx, Docx and PDF, collection of tools for common conversions and selection, and so on...
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.