AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed Rizwan Muhammad Rizvi
Expertise
I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.

Experience
Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > Entering Data in a Word table

Topic: VB.NET



Expert: Syed Rizwan Muhammad Rizvi
Date: 4/6/2008
Subject: Entering Data in a Word table

Question
Hi Rizwan,
        Iam using visual studio 2008. I have a word template  which has a table and I would like to know how to insert text in each cell from 'windows form' or 'user interface'. Would be thankful to you if you could help me in this regard or if you could provide a code for this.

Thanks and Regards,
Kiran Malladi

Answer
This link should have you up and running:
http://www.builderau.com.au/program/dotnet/soa/Easily-utilise-Microsoft-Word-fun...

The code that you need to use to insert value in a cell would be similar to this:
   ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, NumColumns:= _
       4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
       wdAutoFitFixed
   With Selection.Tables(1)
       If .Style <> "Table Grid" Then
           .Style = "Table Grid"
       End If
       .ApplyStyleHeadingRows = True
       .ApplyStyleLastRow = False
       .ApplyStyleFirstColumn = True
       .ApplyStyleLastColumn = False
       .ApplyStyleRowBands = True
       .ApplyStyleColumnBands = False
   End With
   Selection.TypeText Text:="asdasd"
   Selection.MoveDown Unit:=wdLine, Count:=1
   Selection.TypeText Text:="asdasd"

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.