473,505 Members | 13,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft Word formating

How can I create and use Tables in Microsoft word document through VB .net?

I've been using the following code for printing an envelope using
paragraphs. Tables have to be used for better formatting.

----------------------------------------------------------------------

Dim w As New Microsoft.Office.Interop.Word.Application

Dim d As Microsoft.Office.Interop.Word.Document = w.Documents.Add

w.Visible = False

d.PageSetup.PaperSize =
Microsoft.Office.Interop.Word.WdPaperSize.wdPaperE nvelope10

d.PageSetup.VerticalAlignment =
Microsoft.Office.Interop.Word.WdVerticalAlignment. wdAlignVerticalCenter

d.PageSetup.Orientation =
Microsoft.Office.Interop.Word.WdOrientation.wdOrie ntLandscape

With w.Selection

..Font.Name = "Verdana"

..Font.Size = "11"

..ParagraphFormat.Alignment =
Microsoft.Office.Interop.Word.WdParagraphAlignment .wdAlignParagraphCenter

..TypeText(String.Format("To,{0}{1}{2}{3}", vbNewLine, ComboBox1.Text,
vbNewLine, toAdd.Text))

..TypeParagraph()

..ParagraphFormat.Alignment =
Microsoft.Office.Interop.Word.WdParagraphAlignment .wdAlignParagraphRight

..TypeText(String.Format("From:{0}{1}{2}{3}", vbNewLine, TextBox2.Text,
vbNewLine, TextBox1.Text))

End With

d.PrintOut(True, True)

d.Close(Microsoft.Office.Interop.Word.WdSaveOption s.wdDoNotSaveChanges)

w.Quit()

--------------------------------------

Regards,

Nitin
Nov 21 '05 #1
0 2161

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2501
by: Preston Crawford | last post by:
I'm working on a site where one of the requirements is the ability to do a newsletter. This newsletter would either be composed with or pasted into some kind of WYSIWYG web-based editor OR they'd...
1
2120
by: dave | last post by:
I have an html document created through MS Word (save as html). I would like to find a regular expression that can be used to remove all of the formatting. Any help would be greatly appreciated....
4
2511
by: Marion Neubauer | last post by:
Hi! I'm using the RTF2 Control from Lebans web site with MS Access 2000. It's working very good. Now i want to create a letter with the formated text of the RTF2 control in MS Word 2000, but it...
0
1038
by: timullrich | last post by:
Hello, We are trying to design a new website around an Access database that allows employees to enter articles via Word into the database while dynamically formating the text and page formatting...
5
3038
by: mik18 | last post by:
I'm having trouble with exporting reports to Word in the rtf format and I'm hoping someone has a solution. The reports are losing their formats. Not all the formating is lost but some is and of...
3
1844
by: John Bailey | last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great. The formview and detailview contorls would automatically layout the controls for you, the update methods were...
6
8624
by: Justin | last post by:
Hi all, i need some help over here... i found the solution to export file from mysql db into *.csv. but is there anyway to convert the contents into *.doc and save in my webserver and providing a...
1
4185
by: amit | last post by:
Hey guys I am trying to develop an application which would open an word file (.doc) and split it into multiple files. I want to create seperate file for tables, so the application should just...
0
2064
by: greylensman | last post by:
I know you can export an Access 2007 report to a Word .rft tab delimited file but that's not what I need. I'd like to get/put together the VBA (if possible) to export the Access Report directly to a...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7366
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...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
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
5610
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,...
1
5026
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.