Salut les amis;
Je génère des bookmarks dans une application WordAddIn project. les bookmarks apparaissent comme ca :
[bookmarName] ESPACE [bookmarName2]
la méthode qui le génére utilise Word.Selection typeText option :
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(" ");
}
je veux avoir un espace AVANT la géneration du bookmark like this:
ESPACE [bookmarkeName1]ESPACE[BOOKMARKNAME2]
Aussi, je ne veux pas des accolades lors du generation du bookmarks comme ca :
bookmarkName
Merci