INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Is there a way to suppress/hide Word Template Bookmarks programmatically?

Is there a way to suppress/hide Word Template Bookmarks programmatically?

Is there a way to suppress/hide Word Template Bookmarks programmatically?

(OP)
We have a Word Template with bookmarks and currently the bookmarks get populated by looping through the bookmarks.
-------------------------------------------------------------------------
Code Stub:
// Loop thru all the bookmarks and get and set the text in that bookmark
IF ll_bookmark_count > 0 THEN
FOR i = 1 TO ll_bookmark_count
// Get the text to be set at that bookmark
ls_bookmark_text = wf_get_bookmark(uo_word_doc.of_get_bookmark(i))
NEXT
END IF
-------------------------------------------------------------------------


Template Bookmark Names
--------------------------------------- -----------------------------
[X] Reported: [mm/dd/yyyy] RptdChk, RptdTxt, DateRptd
[ ] Need to contact before [mm/dd/yyyy] CntactChk, CntctTxt, BeforeDt

The users now want a few of the template fields suppressed depending on cetain data conditions. For example, if there is no date in the Date_Reported DB filed, do not show the checkbox [RptdChk], static text [RptdTxt] or the Date Reported [DateRptd]. Essentially do not show the entire line.

I have not been able to figure out how to code this so this line effectively gets suppressed.

I appreciate any suggestions, alternatives, etc.

Thanks,
Bill

RE: Is there a way to suppress/hide Word Template Bookmarks programmatically?

(OP)
clarification......
I left out the line of code that assigns the bookmark text to the bookmark.

Code Stub:

CODE --> powerscript

// Loop thru all the bookmarks and get and set the text in that bookmark
IF ll_bookmark_count > 0 THEN
 FOR i = 1 TO ll_bookmark_count
  // Get the text to be set at that bookmark
  ls_bookmark_text = wf_get_bookmark(uo_word_doc.of_get_bookmark(i))
  uo_word_doc.of_set_bookmark_text( uo_word_doc.of_get_bookmark(i), ls_bookmark_text)
 NEXT
END IF 

I tired adding logic above the set_bookmark() call to not do anything if the field is the date we are checking and it is NULL, but the checkbox still appears. I guess I have succeeded at suppressing the text piece of this, however, it also uses a linefeed that I would like suppressed.

RE: Is there a way to suppress/hide Word Template Bookmarks programmatically?

(OP)
Update.......

I was given permission to remove the checkboxes since only one of the lines will be shown (see example above).

The only real issue that I have now is that I get a blank line for the line that is suppressed. I believe that this is because the bookmarks are still there, they are just blank. If anyone has any suggestions on how to truly suppress bookmarks I appreciate any suggestions.



RE: Is there a way to suppress/hide Word Template Bookmarks programmatically?

(OP)
I never figured out how to suppress a bookmark, however, I did come up with a solution.

I originally had 4 separate bookmarks in my template:
- info1_txt, info1_date
- info2_txt, info2_date
The issue that I had was that there are 3 possibilities,
info1/date1 populated
or
info2/date2 populated
or
info1 and info2 and dates populated.

However, the user did not want any blank lines.
I ended up replacing the 4 bookmarks with a single bookmark and then just concatenate the data for info1 and info2.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close