Formatting Microsoft.Office.Tools.Word.Bookmark Control

2 questions:

#1, is it possible to change the color of the braces "[...]" that the Microsoft.Office.Tools.Word.Bookmark control displays to indicates the start and end of the bookmark By default, these braces are a light gray color. For bookmarks that I auto-insert from code, I want the braces to be a different color -- thus, I don't want this color change to be document wide. Is this possible

#2, is it possible to format the Microsoft.Office.Tools.Word.Bookmark control without having the formatting show up when printed For example, I want the background of my bookmark control to be a light color so the user can easily identify it ... however, I don't want this color to be printed. Is there any easy way to do this (without manually capturing the print event, removing the formatting, printing, etc)  

Thanks!


Answer this question

Formatting Microsoft.Office.Tools.Word.Bookmark Control

  • croc

    Yep, this helps. I just wanted to make sure I wasn't missing something obvious.

    On a side note, where is the best place to submit future VSTO enhancement requests In addition to formatting Word.Bookmark controls (without affecting printing), I have a few other things I'd love to see in future versions of VSTO. Is there a place where we can submit these requests

    Thanks!

  • Erick Thompson

    Hi,

    I'm afraid that the answer to both of your questions is no. However in the case of number 2 I think that implementing some code to set the backgrounds in the BeforePrint event, calling print yourself and then resetting the backgrounds. Calling this.PrintOut() with the Background parameter false does not do this. Something along the lines of the following:

            private void ThisDocument_Startup(object sender, System.EventArgs e)
            {
                this.BeforePrint += new System.ComponentModel.CancelEventHandler(ThisDocument_BeforePrint);
            }

            void ThisDocument_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
            {
                foreach (Word.Bookmark b in Bookmarks)
                    b.Range.FormattedText.HighlightColorIndex = Microsoft.Office.Interop.Word.WdColorIndex.wdAuto;

                this.PrintOut(ref missing, ref missing, ref missing, ref missing, ref missing,
                    ref missing, ref missing, ref missing, ref missing, ref missing,
                    ref missing, ref missing, ref missing, ref missing, ref missing,
                    ref missing, ref missing, ref missing);

                foreach (word.bookmark b in bookmarks)
                    b.range.formattedtext.highlightcolorindex = microsoft.office.interop.word.wdcolorindex.wdbrightgreen;

                e.Cancel = true;
            }

    Let me know if this helps.

    Thanks,
    Ade



  • deCreateObject.Ryan.Shell

    You can leave feedback at:

    http://lab.msdn.microsoft.com/productfeedback/


    Select "Visual Studio Tools for Office" as the Product/technology.

    We love to hear about things like this - that you feel would really improve the product's usability for you.

    Thanks!

    Ade


  • Formatting Microsoft.Office.Tools.Word.Bookmark Control