Click here to Skip to main content
15,794,202 members
Articles / Programming Languages / Visual Basic

Having fun with word and Visual basic .Net

Rate me:
Please Sign up or sign in to vote.
2.52/5 (15 votes)
9 Jul 20042 min read 74.6K   3.2K   16   9
Paint portraits with words and colors on a word Document in VB.Net


One day my friend Imam sent me an art work done on a word document which when reduced the font size to very small (2), then the portrait of Aishwaria Rai (Former Miss World) appeared. Initially I thought that it was an art work but after some thinking. I realized later that it is impossible to create such color profile to near photo quality by hand. Then I started working on how this can done. And after 2 days I wrote this program to do the same thing.

This is a small program which can b used for fun …. And nothing more than that …

This program is VB.Net and was developed on VS.Net 2003. This program demonstrates:

  1. Working on word documents from VB.Net.
  2. Changing Font color in a word document. (I spent maximum time on this.)
  3. Reading individual pixel from an image and converting ARGB values to RGB values. As the Color Class in the .Net directly doesn’t give RGB value and Word doesn’t accept ARGB.

When u run the program... it asks for the image to be opened… and double click on the image in the opened form … the write process starts… it’s so simple… I used the double click event to keep the form clean…

I used Word 2003 as reference. If some one wants to use it with earlier versions, simply remove the existing reference to Word Object and point it to the windows 2000 or XP.

How to use it?

1. Run the application .. either double click the exe or run from visualstudio...

2. Select an image.. either jpeg or bmp (color dept doesnt matter)

3. Enter the Text in the text box at the bottom of the opened form. This text is typed repetetively to make the portrait.

4. Double click on the image on the form. A word document is opened and typing proceeds. And the status is displayed as a progress bar.

5. After the image window disappeared reduce the font size to 2 points to see the image ..

just play with that... to get the best image...

One last word… this code is very slow…. I appreciate if anyone suggests a faster way of doing this…

Download Examples (One of the example my photo itself and the other of Aishwaria Rai)


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Written By
President Tradon LLC
United States United States
Private Equity Systems Specialist with diversified systems experience across Manufacturing, Airline, FX, Trading and Financial Industries.
Currently working at an architect role int he private equity industry
Specialties: Private Equity Funds - Waterfall and Fund Accounting Processes Modelling, Implementation, Optimization. Investran Implementation, Systems Integrations.

Comments and Discussions

SuggestionSetting the Font Size and Space before and after, just a suggestion Pin
JimBrown31612-Nov-15 9:33
JimBrown31612-Nov-15 9:33 
GeneralMy vote of 1 Pin
Nasir Razzaq16-Jul-09 7:11
Nasir Razzaq16-Jul-09 7:11 
Questionspeedup ten times? Pin
mbatiri8-Feb-07 3:53
mbatiri8-Feb-07 3:53 
GeneralIncreasing the speed Pin
CoderJ10-Sep-05 12:45
CoderJ10-Sep-05 12:45 
Thanks for this example. It was very good.

I just noticed that it does type the characters very slowly in Word, but if I try to exit Word while the data is still being written, a dialog box pops up to prompt if I want to save the document. While this dialog box is over the Word document, the speed of the data being written to Word increases dramatically.

I run the app and select a picture. I let it start writing the data in Word and then click the exit button. I leave the dialog prompt over the document while the rest of the data is written at least twice as fast and when it is finished I click the cancel button to abort the exit.
Cool | :cool:
GeneralWell Done! Pin
Mitch F.22-Mar-05 17:48
Mitch F.22-Mar-05 17:48 
GeneralGeneration of CV in microsoft word from HTML form. Pin
Member 14952638-Nov-04 8:13
Member 14952638-Nov-04 8:13 
QuestionHow to generate Excel Sheet from SQL Database using VB.Net Pin
Asad Naeem24-Jul-04 5:26
professionalAsad Naeem24-Jul-04 5:26 
GeneralMore detail Pin
Labrat00211-Jul-04 15:13
Labrat00211-Jul-04 15:13 
GeneralRe: More detail Pin
Tradon-Dev11-Jul-04 16:04
Tradon-Dev11-Jul-04 16:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.