Guide for VB.NET
Core Document Formats
Additional Features

VB.NET Word - Word Doc Page(s) Extraction Tutorial

Demo Code to Extract Word Pages Using VB.NET DOCX Page Extracting Control

VB.NET
Home > .NET Imaging SDK > VB.NET > Extract Page from Document
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

If you are asked to arrange materials by citing useful pages from a large number of Word document files programmatically, this VB.NET Word page extracting control add-on will bring you great convenience. Using this VB.NET Word page extraction library SDK, developers can easily find answers for following several questions.
Related .net document control helps:
asp.net image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net tiff viewer: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net edit pdf image: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
  • What VB.NET APIs can I use to extract one or multiple pages from single or a list of Word documents?
  • What VB.NET demo code can I apply to extract Word page(s) and combine extracted page(s) into one Word file?
  • What benefits can I get by using RasterEdge VB.NET Word page extractor control plug-in?
APIs for Word Page Extraction
This VB.NET Word page extractor control add-on enables developers to extract one or a list of pages from Word document file.

APIs to Extract Multiple Word Pages

Using following VB.NET Word page extracting APIs, you can easily get multiple pages out of source Word file which may exist in the form of .docx file or memory stream.
Private Sub ExtractPagesFromDocument(sourceFilePath As [String], pageIdxes As List(Of Integer), destnFilePath As [String]) Implements DOCXDocument.ExtractPagesFromDocument
End Sub
Private Sub ExtractPagesFromDocument(sourceFilePath As [String], pageIdxes As List(Of Integer), destnStream As Stream) Implements DOCXDocument.ExtractPagesFromDocument
End Sub

APIs to Extract Single Word Page

If you only need to extract one page from target Word file, those two VB.NET APIs may be more suitable.
Private Sub GetOnePageDocument(sourceFilePath As [String], index As Integer, destnStream As Stream) Implements DOCXDocument.GetOnePageDocument
End Sub
Private Sub GetOnePageDocument(sourceFilePath As [String], index As Integer, destnFilePath As [String]) Implements DOCXDocument.GetOnePageDocument
End Sub
NOTE: The DOCXDocument appearing in above VB.NET Word page extracting APIs is a RasterEdge self-defined programming class, which is used to represent one Word file. As for one Word page, RasterEdge uses DOCXPage class to represent it.
Demo VB.NET Code
In this section, we provide users with two independent snippets of VB.NET demo codes.
Using the VB.NET demo code below, developers can not only extract multiple pages from two different Word document files, but also merge extracted Word pages into one new Word .docx file.
''' <summary>
''' Two Word documents are available and we want to combine some pages of document 1 and some pages of document 2 to form a new Word document
''' </summary>
''' <returns></returns>
Public Sub ExtractPagesToFormNewDocument(filePath1 As [String], filePath2 As [String], pageList1 As List(Of Integer), pageList2 As List(Of Integer), destnPath As [String])
' two temporary strings to store the extracted documents file paths
Dim tmpFilePath1 As [String] = "c:\tmpFile1"
Dim tmpFilePath2 As [String] = "c:\tmpFile2"
DOCXDocument.ExtractPagesFromDocument(filePath1, pageList1, tmpFilePath1)
DOCXDocument.ExtractPagesFromDocument(filePath2, pageList2, tmpFilePath2)
Dim docPathList As List(Of [String]) = New List(Of String)()
docPathList.Add(tmpFilePath1)
docPathList.Add(tmpFilePath2)
DOCXDocument.Combine(docPathList, destnPath)
End Sub
This VB.NET sample code is used to extract only one page from source Word file. From the demo code below, you will know that the index of extracted Word page can be accurately determined using VB.NET code. For instance, if you want to draw the 4th page from original Word file, you just need to input the index value as 3 using GetOnePageDocument method.
''' <summary>
''' Extract a single page and form a new document
''' </summary>
''' <param name="filePath"></param>
''' <param name="indx"></param>
''' <returns></returns>
Public Sub GetOnePageDocument(sourceFilePath As [String], index As Integer, destnFilePath As [String])
DOCXDocument.GetOnePageDocument(sourceFilePath, index, destnFilePath)
End Sub
Why to Use
This VB.NET Word page extraction control add-on, written in managed C# code, has a lot of outstanding features. And here we just make a brief list of its main VB.NET Word page extracting benefits.

Extremely Easy to Install

VB.NET programmers can integrate this Word page extraction control plug-in into .NET Word processing applications by adding several small-size RasterEdge dlls if they have installed .NET Framework 2.0 or later versions and Microsoft Visual Studio 2005 or greater versions in their VB.NET projects.

Support Multiple .NET Programming Languages

Developed specifically for .NET developing applications, this VB.NET Word page extractor add-on also owns high compatibility with Visual C# .NET code.

Compatible with Several Word Document Versions

As this VB.NET Word page extracting control add-on is designed to process Word file that ends with .docx suffix, developers can use it to extract pages from Word 2007 or later versions.

Able to Conduct Other Word Page Processing Functions

Apart from this VB.NET Word page extracting feature, this VB.NET Word page extractor add-on can be also used to merge / split Word file, add / delete Word page, sort Word page order or insert image into Word page in .NET class application.

Work Perfectly with Other Word Manipulating Toolkits

Besides above mentioned Word page processing functions, VB.NET developers are also allowed to apply other Word manipulating features, like conversion, annotation, barcode reading, barcode generation, web viewing and watermarking, into Word editing application by integrating this VB.NET Word page extracting library with other Word reading and editing controls.


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com