By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,711 Members | 2,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,711 IT Pros & Developers. It's quick & easy.

Inserting Variables in a Document

P: n/a
Ok.. here's my situation. I have a program that handles a database full of
people. Users of the program have the ability to send out notifications to
these people. Pretty standard notifications, the program tracks when
notifications are sent out and who sends them. Currently these
notifications are all sent via email.

Now the program users also want the ability to send these notifications via
standard snail mail. (I'll make a popup box come up "Do you want to print
this notification?") I want to allow the users the ability to modify these
notifications as well so that will not have to be done programmatically
if/when notification wording changes. The notifications need to allow for
variables to be insert into the document .. for example, the persons name,
address, salutation, etc. The document needs to have the capability to
print not only the document but a mailing envelope as well so my first
thought as to the document medium is to use Microsoft Word.

Originally my plan was to just have the program save the location (selected
by the user) of a Microsoft Word document. The Word document opens and the
user manually enters the recepient information. This, however, is an
undesirable solution. The users really want the information to be imported
programmatically, somewhat like a Word mail merge (except it only needs to
handle one user at a time). So my next thought is to create a Word document
dynamically every time a user opts for a printable document. Not sure if
this is ideal either because I'm not sure how I'll allow the users to edit
these documents seeing as how they don't exist as a document, I'd probably
save the document body information in a database and allow the users to
modify that. Anyways, just looking for some ideas here. Is there any way
to create a Word document and use variable fields (example: <<First Name>>,
<<Last Name>>, etc.), then have my program open that document and insert the
variable data? Are their any other output solutions (besides Microsoft
Word) I should be looking at?

Thanks for any suggestions,
Ryan
Jun 13 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi Ryan,

I think you may consider the VSTO which is introduced from VS.NET 2005.
We have a special BookMark control in VSTO project, we can use that as the
insert variable.
And it support DataBinding which will easierly to connect it onto database.

http://www.officezealot.com/VSTO/videos.aspx

http://blogs.msdn.com/vsto2/archive/...29/123027.aspx

http://blogs.msdn.com/pstubbs/archiv...03/225513.aspx

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 14 '06 #2

P: n/a
VSTO is a separate product from VS 2005 Pro correct? (so it would require
the purchase of more software)

I had another thought this morning. Maybe I'll export the data from the
notification to an Excel file. From there, the user can easily perform
their own mail merge in Word manually.

Ryan

""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:s$**************@TK2MSFTNGXA01.phx.gbl...
Hi Ryan,

I think you may consider the VSTO which is introduced from VS.NET 2005.
We have a special BookMark control in VSTO project, we can use that as the
insert variable.
And it support DataBinding which will easierly to connect it onto
database.

http://www.officezealot.com/VSTO/videos.aspx

http://blogs.msdn.com/vsto2/archive/...29/123027.aspx

http://blogs.msdn.com/pstubbs/archiv...03/225513.aspx

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Jun 14 '06 #3

P: n/a
Hi Ryan,

You are correct.
The VSTO is included in the VSTS version of VS.NET 2005. Or you may buy a
Visual Studio Tools for Office System develop tools stand alone package.

Word Mail Merge is an approach as you said.

Also I think you may try to consider the Smart Document which is somewhat
complex than VSTO, but you may have a look.

Smart Documents Made Easier for .NET Developers
http://msdn.microsoft.com/library/de...us/dno2k3ta/ht
ml/odc_SmartDocsWrapper.asp

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 15 '06 #4

P: n/a
bob
Ryan,

I'm not quite sure what you want to do here. Maybe you don't need any
sophisticated Word programming, though. If your program already has the
list of names/addresses in its database, as well as the text of the
notices, then you could insert everything into a text file, then open
it in Notepad so the user could print it.

If the notice text is in one or more separate documents, you could put
placeholders in the text (such as ??name, ??addr1, ??city, etc.) and
your program could open the text file, put it into a string, and then
do a Replace function for each placeholder.

Of course, if you have tens or hundreds of names in the database and
users have to send the notice to many people at one time, that wold
probably best be handled by programming Word to do a mailmerge.

Good luck!

Ryan wrote:
Ok.. here's my situation. I have a program that handles a database full of
people. Users of the program have the ability to send out notifications to
these people. Pretty standard notifications, the program tracks when
notifications are sent out and who sends them. Currently these
notifications are all sent via email.

Now the program users also want the ability to send these notifications via
standard snail mail. (I'll make a popup box come up "Do you want to print
this notification?") I want to allow the users the ability to modify these
notifications as well so that will not have to be done programmatically
if/when notification wording changes. The notifications need to allow for
variables to be insert into the document .. for example, the persons name,
address, salutation, etc. The document needs to have the capability to
print not only the document but a mailing envelope as well so my first
thought as to the document medium is to use Microsoft Word.

Originally my plan was to just have the program save the location (selected
by the user) of a Microsoft Word document. The Word document opens and the
user manually enters the recepient information. This, however, is an
undesirable solution. The users really want the information to be imported
programmatically, somewhat like a Word mail merge (except it only needs to
handle one user at a time). So my next thought is to create a Word document
dynamically every time a user opts for a printable document. Not sure if
this is ideal either because I'm not sure how I'll allow the users to edit
these documents seeing as how they don't exist as a document, I'd probably
save the document body information in a database and allow the users to
modify that. Anyways, just looking for some ideas here. Is there any way
to create a Word document and use variable fields (example: <<First Name>>,
<<Last Name>>, etc.), then have my program open that document and insert the
variable data? Are their any other output solutions (besides Microsoft
Word) I should be looking at?

Thanks for any suggestions,
Ryan


Jun 15 '06 #5

P: n/a
bob
Peter,

I just clicked on your link to "smart documents made easier" and got a
message "Page Not Found". I might be interested in "Smart" documents so
if you have a better link I'd like to know what it is. Thanks.
"Peter Huang" [MSFT] wrote:
Hi Ryan,

You are correct.
The VSTO is included in the VSTS version of VS.NET 2005. Or you may buy a
Visual Studio Tools for Office System develop tools stand alone package.

Word Mail Merge is an approach as you said.

Also I think you may try to consider the Smart Document which is somewhat
complex than VSTO, but you may have a look.

Smart Documents Made Easier for .NET Developers
http://msdn.microsoft.com/library/de...us/dno2k3ta/ht
ml/odc_SmartDocsWrapper.asp

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Jun 15 '06 #6

P: n/a
His link is correct, it just didn't link it all in this message. If this
doesn't work just copy and paste the entire text.

http://msdn.microsoft.com/library/en...ocsWrapper.asp

<bo*@datasync.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Peter,

I just clicked on your link to "smart documents made easier" and got a
message "Page Not Found". I might be interested in "Smart" documents so
if you have a better link I'd like to know what it is. Thanks.
"Peter Huang" [MSFT] wrote:
Hi Ryan,

You are correct.
The VSTO is included in the VSTS version of VS.NET 2005. Or you may buy a
Visual Studio Tools for Office System develop tools stand alone package.

Word Mail Merge is an approach as you said.

Also I think you may try to consider the Smart Document which is somewhat
complex than VSTO, but you may have a look.

Smart Documents Made Easier for .NET Developers
http://msdn.microsoft.com/library/de...us/dno2k3ta/ht
ml/odc_SmartDocsWrapper.asp

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Jun 15 '06 #7

P: n/a
The document needs to be able to print an envelope too.. and notifications
could be sent to multiple people (I know I said before one person at a time
but I may change this). I'm really starting to lean towards the export data
to excel, allow the user to perform a mail merge idea.

<bo*@datasync.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Ryan,

I'm not quite sure what you want to do here. Maybe you don't need any
sophisticated Word programming, though. If your program already has the
list of names/addresses in its database, as well as the text of the
notices, then you could insert everything into a text file, then open
it in Notepad so the user could print it.

If the notice text is in one or more separate documents, you could put
placeholders in the text (such as ??name, ??addr1, ??city, etc.) and
your program could open the text file, put it into a string, and then
do a Replace function for each placeholder.

Of course, if you have tens or hundreds of names in the database and
users have to send the notice to many people at one time, that wold
probably best be handled by programming Word to do a mailmerge.

Good luck!

Ryan wrote:
Ok.. here's my situation. I have a program that handles a database full
of
people. Users of the program have the ability to send out notifications
to
these people. Pretty standard notifications, the program tracks when
notifications are sent out and who sends them. Currently these
notifications are all sent via email.

Now the program users also want the ability to send these notifications
via
standard snail mail. (I'll make a popup box come up "Do you want to
print
this notification?") I want to allow the users the ability to modify
these
notifications as well so that will not have to be done programmatically
if/when notification wording changes. The notifications need to allow
for
variables to be insert into the document .. for example, the persons
name,
address, salutation, etc. The document needs to have the capability to
print not only the document but a mailing envelope as well so my first
thought as to the document medium is to use Microsoft Word.

Originally my plan was to just have the program save the location
(selected
by the user) of a Microsoft Word document. The Word document opens and
the
user manually enters the recepient information. This, however, is an
undesirable solution. The users really want the information to be
imported
programmatically, somewhat like a Word mail merge (except it only needs
to
handle one user at a time). So my next thought is to create a Word
document
dynamically every time a user opts for a printable document. Not sure if
this is ideal either because I'm not sure how I'll allow the users to
edit
these documents seeing as how they don't exist as a document, I'd
probably
save the document body information in a database and allow the users to
modify that. Anyways, just looking for some ideas here. Is there any
way
to create a Word document and use variable fields (example: <<First
Name>>,
<<Last Name>>, etc.), then have my program open that document and insert
the
variable data? Are their any other output solutions (besides Microsoft
Word) I should be looking at?

Thanks for any suggestions,
Ryan

Jun 15 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.