Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Space in a c# wordAddIn project

Space in a c# wordAddIn project

Scheduled Pinned Locked Moved C#
questioncsharpdatabasetutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pierre besquent
    wrote on last edited by
    #1

    Hi guys, I devekop a c# wordAddIn project. I want to get space BEFORE generation bookmarks.I had developed a method that adds space after generating bookmarks :

    public static void CreateSimpleField (string itemName, string bookmarkName, Word.Application application)
    {
    object index = 1;

            if (application.Windows.get\_Item(ref index).View.ShowBookmarks == false)
                application.Windows.get\_Item(ref index).View.ShowBookmarks = true;
    
            Word.Selection      currentSelection = application.Selection;
            Word.Range          rng = currentSelection.Range;
            
            rng.Text = itemName;
            
    
            while (application.ActiveDocument.Bookmarks.Exists(bookmarkName))
            {bookmarkName += "\_";}
    	    
            Object              range = rng;
            application.ActiveDocument.Bookmarks.Add (bookmarkName, ref range);
            // Ajouter un espace.
            int             indexRange = rng.End + 1;
            currentSelection.s.SetRange(indexRange, indexRange);
            currentSelection.TypeText(" ");
        }
    

    How to transform it to get space BEFORE bookmarks? Also, when I generate, it appears like this :

    [bookmarkName]

    How can I remove the accolade []???? ty :)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups