p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Other Office > BOOK: Professional VSTO 2005 ISBN: 0-471-78813-9
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional VSTO 2005 ISBN: 0-471-78813-9
This is the forum to discuss the Wrox book Professional VSTO 2005: Visual Studio 2005 Tools for Office by Alvin Bruney; ISBN: 9780471788133

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional VSTO 2005 ISBN: 0-471-78813-9 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 16th, 2007, 07:18 PM
Authorized User
 
Join Date: Sep 2007
Location: , VA, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default 4-4 Bookmark Code - cannot locate text

Hi,

This code appears to not work. (I'm new to this so, I'm assuming I'm not seeing what is intended).

When I removed the 'myBookmark' from the Allexamples.doc, to see how the 'else' statement worked; it works the same as similar code in 4-2:
- the debugger reports the Text as containing: "\r"
- The singleSent.Words.Count is always = 2 regardless of the number of words in the sentence.
- The code iterates through the "for" loop once skipping the code that would add the bookmark.

Is there something wrong with this code or am I just too new to VSTO to pick this up easily?

Thanks in advance.



if (this.Bookmarks != null && this.Bookmarks.Count > 0)
            {
                foreach (Word.Bookmark mark in this.Bookmarks)
                {
                    if (mark.Name.ToLower().Trim() == "mybookmark")
                    {
                        MessageBox.Show("Found bookmark");
                        break;
                    }
                }
            }
            else
            {
                Word.Range par = this.Paragraphs[Paragraphs.Count].Range;
                {
                    Word.Range singleSent = par.Sentences[1];
                    if (singleSent != null && singleSent.Words != null &&
                        singleSent.Words.Count > 0)
                    {
                        for (int i = 1; i < singleSent.Words.Count; i++)
                        {
                            if (singleSent.Words[i].Text.ToLower().Trim() == "the")
                            {
                                object bookMark = singleSent.Words[i];
                                this.Bookmarks.Add("myBookMark", ref bookMark);
                            }
                        }
                    }
                }

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate bookmark creation hogg Word VBA 1 November 12th, 2008 04:35 AM
Help with bookmark code on IE7 bvis Java Basics 0 December 16th, 2006 10:15 AM
Me.Bookmark = Me.RecordsetClone.Bookmark rkellogg Access VBA 5 September 8th, 2006 07:28 AM
Bookmark Style Terry Joseph Migliorino CSS Cascading Style Sheets 2 February 10th, 2006 07:52 AM
Would like to locate errata torrent XML 1 June 3rd, 2003 04:09 PM



All times are GMT -4. The time now is 01:30 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc