Word Automation Relace string with Table

P

pareshkoyani

Hi All,

I have been searching on net for word automation for following
problem.
Requirement:

I have word template which has some place holder and I want to replace
these placeholder with string, table, and images.
My word template looks like:
---------------- Template start----------
Name: @@Name@@
Address: @@Address@@
Login Histrory : @@LoginHistory@@
Signature:
@@SignatureImage@@
---------------- Template End----------

I want to replace @@LoginHistory@@ with table which has 3 column and n
rows (Rows will be filled at run time), @@SignatureImage@@ keyword
will be replace with an image.

I found couple of solutions on net but it did not fill full my
requirement.
I got solutions like

1) Bookmark, Merger field instead of plain keyrord
2) Find Bookmark and Merge Field and get range of that particular
cursor.
3) Using that range add table or images file.
But I only want to use string (Keyword) nor bookmark or Merger field.
Is there any way to find string and replace with table at that
particular location without losing formatting and other information in
work using word automations C#.

I would be really thankfull to you and your solutions for helping me

Thanks & Regards,
Paresh Koyani.
 
C

Cindy M.

Hi (e-mail address removed),

You can certainly search any string (also using "wildcards", which is a
kind of RegEx). But what you can replace the Found range with is
somewhat limited. The basic Replacement object must be text. You can
specify some formatting, as well.

But it is *not* possible to use Find/Replace to replace with a table.

If you have copied the table to the Clipboard, then you can use the
Replacement value ^c to paste in the Clipboard contents. That's as
close as you can get.

Beyond that, you'd need to automate the Word object model to create the
table (or insert it as an AutoText entry) at the "Found" range
(basically, your point 3, below).
I want to replace @@LoginHistory@@ with table which has 3 column and n
rows (Rows will be filled at run time), @@SignatureImage@@ keyword
will be replace with an image.

I found couple of solutions on net but it did not fill full my
requirement.
I got solutions like

1) Bookmark, Merger field instead of plain keyrord
2) Find Bookmark and Merge Field and get range of that particular
cursor.
3) Using that range add table or images file.
But I only want to use string (Keyword) nor bookmark or Merger field.
Is there any way to find string and replace with table at that
particular location without losing formatting and other information in
work using word automations C#.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top