473,657 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a word document and print parts of it?

Hi to everyone,
I need to create and print (from within a c# application) a MS Word
document starting from an Access db.
Half of this document must be written and printed in, let's say,
January, then some data will be added to the db and, let's say in
June, a second part must be written and printed on the same sheet of
the first one.
In other words, the second time I print the document only some
specified parts (everytime the same) of it must be printed.
Moreover, I need to print this document on a pre-printed template, so
I've to put some text and tables on well defined places: I know how to
place text (using bookmarks), but I'm not able to insert tables
correctly (they are placed at the same height of the bookmark, but
always on the left margin of the page).
This is a piece of the code I've written to manage tables:

Word.Document aDoc = WordApp.Documen ts.Open(....);
..
..
..

object bknTableName = "Table1";
Word.Table table = aDoc.Tables.Add (aDoc.Bookmarks .get_item(ref
bknTableName).R ange, 3, 2, ref missing, ref missing);

The questions are:
1) How can I place tables on the page respecting the layout of the
template?
2) How can I print specified parts of the document, ignoring the
remaining ones?

Thank you

May 14 '07 #1
0 1710

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

Similar topics

1
7967
by: Eager-Learner | last post by:
Through window.open or window.showmodaldialog, I want to open a word or excel document in Print Preview mode. Bcos I don't want the user to make any changes or save it but the user can ONLY VIEW OR take a print out. Can anyone help me out ? Thanks in advance for any help / guideline
5
3329
by: Stefania Scott | last post by:
I am trying to print a word document from Access. The code I've written works well in my computer but does not in the one were it is needed. Here the piece of code: 'doc path strObjectPath = "P:\2004worksheets\IIS_WS.doc" Set oWord = New Word.Application oWord.Documents.Add (strObjectPath) oWord.PrintOut
3
479
by: di | last post by:
I have a Access Database, and I would like to create a word document that (preferable would filter)links to ACCESS table or query. I would like to print the word document on the filtered record that I have selected in Access. for example if I have customer number (201) that I would like to merge over to a Word document. The word document is a template that I would like to use regularly. Thanks so Much for anyone that can WALK me thru...
2
2146
by: Bruno Alexandre | last post by:
I guys, I need your help finding a solution to my problem... With thousands of PDF objects in the internet, and because It's the first time I will use an object that does not beow to the framework itself (not counting with Atlas), I need you advice in getting a nice component with an afordable price for ASP.NET 2.0 (using VB.NET). I do not own the web server so it has to be one that can can just upload the dll file to my BIN folder...
2
579
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it. The link to the document is http://www.surveymonkey.com/s.asp?u=689952259313 I have spent 15 hours trying to sort this but to no avail.
0
3998
by: funeeldy | last post by:
I need to locate a particular table in a document. I cannot hardcode the table number since it could be different in every doc. I do have some header text that comes right before it consistently, though. So, I tried to find that text, and then move to the next table. Then I need to add a row to the table which already has 4 columns. I need to maintain the old content of the table too. I think I am pretty close, but having a little trouble...
4
12427
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
8
6705
by: babyangel43 | last post by:
Hello, I have a query set up in Access. I run it monthly, changing "date of test". I would like this query to be merged with a Word document so that the cover letter is created in Word, the fields from Access are automatically filled into the Word document. The query could be anywhere from 0-5000 names, one cover letter per name. AND to this cover letter for each applicant, there has to be attached a two page document. How in the world can...
1
1809
by: mhsasono | last post by:
Hi all, Has anybody experienced with CrystalReport? My question is: Does CrystalReport have capability to print the Microsoft Word document? Reason: I want to know CrystalReport capability since now I am in the middle of developing a system that generate a report or document from various resources, e.g. some parts are Oracle fields and some parts are text of microsoft word object. Thanks in advance.
0
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8718
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.