Guide for VB.NET
Core Document Formats
Get to Start - Create, Load, Save
Additional Features

VB.NET Word - Word Creating, Loading & Saving

How to Get Start with VB.NET Word Document Processing Control SDK

VB.NET
Home > .NET Imaging SDK > VB.NET > Start with Word Project
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

RasterEdge VB.NET Word Document Add-On is designed to help developers manipulate Microsoft Word document through VB.NET programming. Developers are able to create an empty Word document file, quickly load and open existing Word document and save edited Word document based on own needs by using this Word Document Add-On for VB.NET. vb.net pdf viewer component, azure ocr pdf, barcode reader vb.net source code, add watermark image to pdf using itextsharp c#, create pdf thumbnail image c#, c# decode qr code. When using this Add-On to create, load and save Word document, you may ask:
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
  • After downloading your RasterEdge.DocImageSDK, which dlls should I use to create, load and save Word file in VB.NET?
  • What classes will be used to create, load and save Word document in .NET application using Visual Basic language?
  • How to create blank Word document file by using your product in Visual Basic .NET project?
  • How to load an existing Microsoft Word document from stream or local file through VB.NET programming?
  • How to save edited Word document file based on my own needs with your Word Document Add-On for VB.NET?
In the following sections, you will find detailed answers to all of the above questions on Word document creating, loading and saving in VB.NET applications. vb.net code to convert excel to pdf, itextsharp split pdf vb.net, how to delete a page from a pdf in c#, convert pdf to text using itextsharp in vb.net, c# create pdf preview, merge multiple file types into one pdf in c#, convert pdf to png vb.net.
DLLs
In this section, we will give you brief introductions on dlls that will used to create, load and save Word document in VB.NET application. They are RasterEdge.Imaging.Basic.dll and RasterEdge.Imaging.MSWordDocx.dll. pdf editor asp.net, asp.net remove image from pdf file, pdf preview in asp.net c#, asp net replace text fro pdf free, best pdf viewer control for asp.net, asp.net mvc pdf viewer free, asp.net view excel in browser. You just need to locate these two dlls to your VB.NET project references.
RasterEdge.Imaging.Basic.dll offers basic functions for VB.NET programmers to manage document pages & manipulate image effects. And RasterEdge.Imaging.MSWordDocx.dll is our Word document processing dll, with which programmers are able to create, load, convert, process and save Word document in VB.NET applications.
Classes
Our VB.NET Word Document Add-On assembly provides two Office Word document processing classes and they are DOCXDocument and DOCXPage.
At the heart of our Word document processing dll (RasterEdge.Imaging.MSWordDocx.dll) is a class called DOCXDocument. This class refers to abstract Word document and it contains all document information of Word file. It is an extension of REDocument which is in turn an extension of BaseDocument. When a DOCXDocument object is created through VB.NET programming, you can easily extract information about the Word document pages and other document structures.
DOCXPage is an abstraction of Word document page contained in DOCXDocument object. Each DOCXPage is corresponding to a single Word document page in VB.NET application. DOCXPage uses REPage and BasePage as prototypes.
Note: This VB.NET Word Document Add-On only supports Word document of .docx file extension.
Create
VB.NET developers can use the following API and sample code to create empty Microsoft Office Word document and you can specify the number of empty pages in the Word document.
Private Sub New(pageCount As Integer)
End Sub
Public Function CreateEmptyDOCXDocumentDemo(pageCount As Integer) As DOCXDocument
Return New DOCXDocument(pageCount)
End Function
After you have created the Word document, you can use API and VB.NET demo code below to count the number of Word document pages.
Private Function GetPageCount() As Integer Implements DOCXDocument.GetPageCount
End Function
Public Function GetPageCountDemo(filePath As [String]) As Integer
Dim doc As New DOCXDocument(filePath)
Return doc.GetPageCount()
End Function
Load & Open
APIs below can be used to load and open an existing Word document from stream or specific native file in VB.NET project.
Private Sub New(filePath As [String])
End Sub
Private Sub New(s As Stream)
End Sub

VB.NET Sample Code to Load Word Doc from Stream

''' <summary>
''' Load a Word Document from stream
''' </summary>
''' <returns></returns>
Public Function LoadDOCXDocumentFromStreamDemo(s As Stream) As DOCXDocument
Return New DOCXDocument(s)
End Function

Demo Code to Load Word Doc from Local File in VB.NET

''' <summary>
''' Load existing Word file of specific file path
''' </summary>
''' <param name="filePath"></param>
''' <returns></returns>
Public Function LoadDOCXDocumentFromFileDemo(filePath As [String]) As DOCXDocument
Return New DOCXDocument(filePath)

'or
'return ( DOCXDocument)REFile.OpenDocumentFile(filePath);
End Function
You can load an existing Word document by invoking the constructor of DOCXDocument. The constructor takes an input String and the parameter String presents the path of the Word file you want to open.
Save
After you have created or edited your Word document, you can use the following APIs and VB.NET demo codes to save your document to stream or local file.

APIs

Private Sub Save(s As Stream) Implements DOCXDocument.Save
End Sub
Private Sub Save(filePath As [String]) Implements DOCXDocument.Save
End Sub
Private Sub EncodeDocument(document As BaseDocument, fileIOMgr As FileIOMgr) Implements DOCXEncoder.EncodeDocument
End Sub

Code for Saving to Stream in VB.NET

''' <summary>
''' Save DOCXDocument to stream
''' </summary>
''' <param name="doc"></param>
''' <param name="s"></param>
Public Sub SaveDOCXDocumentToStreamDemo(doc As DOCXDocument, s As Stream)
doc.Save(s)
' or

'DOCXEncoder test = new DOCXEncoder();

'byte[] buffer = new byte[s.Length];

'MemoryStream ms = new MemoryStream();

'test.EncodeDocument(doc, new FileIOMgr(ms));
'ms.Read(buffer, 0, (int)ms.Length);
's.Write(buffer, 0, (int)ms.Length);
End Sub

Code for Saving to Local File in VB.NET

''' <summary>
''' Save DOCXDocument to file
''' </summary>
''' <param name="doc"></param>
''' <param name="filePath"></param>

Public Sub SaveDOCXDocumenttoFileDemo(doc As DOCXDocument, filePath As [String])
doc.Save(filePath)
'or
'REFile.SaveDocumentFile(doc, filePath, new DOCXEncoder());
End Sub
After you load & open a Word document file, you may need to edit or manipulate this Word file. Here we recommend you some Microsoft Word document processing controls, such as VB.NET Word annotator control to add text & graphics annotations on Word file and VB.NET Word barcode drawing component to insert barcode images into Word page.


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-2024 Raster Edge.com