Space in a c# wordAddIn project
C#
1
Posts
1
Posters
0
Views
1
Watching
-
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 :)