Guide for VB.NET
Core Document Formats
Additional Features

VB.NET Word - Drawing Image or Text on Word

Draw and Define Text and .NET Graphics on Word Page in VB Class

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

Word Drawing Overview in VB.NET
Based on the core technologies of RasterEdge .NET Imaging SDK, VB.NET Word Drawing library is featured with the high flexibility on drawing and writing text and .NET graphics on Word page in VB Windows & Web applications.
Using text drawing methods on Word page in VB image project, users can quickly and accurately write single or multiple text contents on certain Word page that can consist of word, phrase and sentence. Besides, using our provided VB Word drawing APIs, users even can draw text at specific area of the Word page, the top, bottom or any designed location.
As for .NET graphics drawing on Word document, RasterEdge .NET Imaging Drawing DLL provides the variable options of image drawing forms and shapes by using given sample VB code. Users can directly add ellipse, rectangle, line, rubber stamp, and more shapes on Word page.
In this Word page drawing article, users can get following instructions:
  • Word page text and image writing and drawing feature and benefit list in VB application
  • Overview on the VB.NET sample code to draw text content on single Word page
  • Detailed VB demo code to draw .NET graphics on Word page within the VB.NET Word Drawing application
Word Text and Image Drawing Features in VB Project
  • RasterEdge Word Drawing library is compatible with VB.NET Windows imaging application
  • VB sample methods to write text content on Word page, which can be a word, phrase or sentence
  • After creating text on Word page, users are able to define text, like resizing, rotating, changing font style, etc.
  • Easy to use APIs to add and draw .NET graphics at certain location of current Word page in VB program
  • Variable image processing applications for editing the drawn image, such as, image rotating, resizing, saving, and more
  • Flexible imaging handling options for deleting any improper text or image by using VB class
  • .NET Imaging Saving method for users to save created text or image as the separate document file
  • Store the Word document with drawn text and image with the same name
How to Draw Text on Word Page in VB.NET Project
Before you can use following available VB sample code, you are supposed to finish these operations:
First, you need to download RaterEdge online free evaluation .NET Image SDK and activate your granted developer license which can ensure that grant you to use all our provided .NET imaging libraries successfully; and then, make sure that you have installed any Microsoft Visual Studio and .NET Framework version on your computer; last, you can create the Word drawing project and embed required references within your Visual Studio project in VB class.
Now, you can implement following sample VB code directly to create and customize Word text drawing.
Public Shared FolderName As String = "c:/"

Private Sub button1_Click(sender As Object, e As EventArgs)
Dim fileName As String = FolderName & "Sample.docx"

Dim doc As REDocument = REFile.OpenDocumentFile(fileName, New WordDecoder())
'use WordDecoder open a wordfile
Dim pageCount As Integer = doc.GetPageCount()
'get word's page count
Debug.WriteText("Page Count: " & pageCount)

Dim newText As BasePage = doc.CreateEmptyText()
'create a Text by REDocument
doc.AddText(newText, 2)
'add a new Text to REDocument
pageCount = doc.GetPageCount()
'get word's page count
Debug.WriteText("Page Count: " & pageCount)

REFile.SaveDocumentFile(doc, fileNameadd, New WordEncoder())
'save word
End Sub
How to Draw Image on Word Page in VB.NET Project
Like drawing text on Word page in VB program, users who want to draw image on Word page also need to create a VB Windows sample project and implement all the image drawing and Word Docx references at first. And please note that when you create an image drawing to Word document, you are supposed to begin with inserting a Word drawing canvas, which can help you process your image drawing, like arranging, resizing, ect. For detailed guide, please refer to following sample code.
Public Shared FolderName As String = "c:/"

Private Sub button1_Click(sender As Object, e As EventArgs)
Dim fileName As String = FolderName & "Sample.docx"

Dim doc As REDocument = REFile.OpenDocumentFile(fileName, New WordDecoder())
'use WordDecoder open a wordfile
Dim pageCount As Integer = doc.GetPageCount()
'get word's page count
Debug.WriteImage("Page Count: " & pageCount)

Dim newImage As BasePage = doc.CreateImage ()
'create a Image by REDocument
doc.AddImage (newImage, 2)
'add a new Image to REDocument
pageCount = doc.GetPageCount()
'get word's page count
Debug.WriteImage ("Page Count: " & pageCount)

REFile.SaveDocumentFile(doc, fileNameadd, New WordEncoder())
'save word
End Sub
Apart from Word drawing function in VB.NET program, RasterEdge still provides users many other Word viewing and operating applications in VB platform. For detailed guide on each Word document function, please link to Word document web, Window and mobile viewers summary in VB.NET, how to annotate Word page by using VB imaging annotation methods and VB.NET sample code to convert Word document page.


Recommend this to Google+