473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to add multiple tables to MS word document using vb.net?

i want to know how multiple tables are added to the MS word document using vb.net

i wrote following code to insert one table in MS word document using vb.net
1.opened MS word document
2.inserted one 3x3 table

Dim App As New Word.Application()
Dim Doc As Word.Document = App.Documents.Add()
Dim oTable1 As Word.Table
Dim Range As Word.Range

Range = Doc.Paragraphs.Add().Range
otable1 = Range.Tables.Add(Range:=App.Selection.Range,
NumColumns:=3, NumRows:=3)
With oTable1
.Cell(1, 1).Range.Text = "Code"
.Cell(1, 2).Range.Text = "Description"
.Cell(1, 3).Range.Text = "Units"
.Cell(2, 1).Range.Text = "1"
.Cell(2, 2).Range.Text = "2"
.Cell(2, 3).Range.Text = "3"
.Cell(3, 1).Range.Text = "4"
.Cell(3, 2).Range.Text = "5"
.Cell(3, 3).Range.Text = "6"
End With

MsgBox("saved1")
Doc.SaveAs("f:\qwerty1.doc")
Doc.Close()

i am able to insert one table,but when i am trying to insert multiple tables,
the tables are getting inserted wrongly like,one table is inserted into another table

i want code for inserting multiple tables in MS Word document using vb.net
Nov 21 '08 #1
0 5241

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rameshwari | last post by:
Hi, I would like to read a ms-word document using python. Basically the word document contains number of tables and the rows in each table do not have same number of columns. Does anyone...
1
by: Nikola Pecigos | last post by:
Hi, I have the following problem: We have an Oracle 9.2 with one table "document" which contains a path to the filesystem. If I want to index these files (HTML, PDF, World, Excel, etc.), I...
3
by: svdh2 | last post by:
I have been looking at a problem the entire week in access, I have still not been able to find a solution. Hope that you could maybe tell where to look Concerns the link between Access and Word....
1
by: svdh | last post by:
I have posed a question last saturday and have advanced alot in the meantime. But I am still not there Problem is that I try to merging various fields from various tables in one document in Word...
0
by: JMe9ka | last post by:
I'm looking to export data from my application into a document. The data represented needs to be shown in a table (like a table within a Word document). I am currently using Word automation to...
3
by: m3ckon | last post by:
Hi there, I can succesfully create a word doc from my asp.net page, but I have 2 issues I need to resolve in order to use it in my app: 1) Creating a table: I seem unable to create a table,...
4
by: lesperancer | last post by:
I have 3 tables (office97) tblQuote quoteNbr tblDetails ( quote : 1 <-> M: quoteDetails) quoteNbr detailLine product value
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.