Problem with Header. Cant update field

Hello
the font-size changes and get bigger when I replace a text.
How does it work? Does it get the font-size from whats in the word file in the bookmark or should I set it in code.

/anders

Not exactly sure what do you mean.

DocumentBuilder.MoveToXXX methods should select font and paragraph formatting that is at the place in the document where the cursor was moved to. If this does not seem to work, let me know what method you are using, paste your code.

Here is the code i use. When i check in a document. the bookmark text recive the right text but it get the font and size from the first word in the text. If i write it in cursive the text in the bookmark will get in cursive.

Aspose.Word.Document doc = new Aspose.Word.Document(filename);
DocumentBuilder builder = new DocumentBuilder(doc);
Bookmarks bo = doc.Range.Bookmarks;
foreach (Bookmark b in bo)
{
    try
    {
        if (b.Name == "Id")
        {
            builder.MoveToBookmark("Id");
            found = true;
            b.Text = df.ID.ToString();
        }
    }
    catch
    { }
    #endregion
    #region Revision
    try
    {
        if (b.Name == "Revision")
        {
            builder.MoveToBookmark("Revision");
            found = true;
            b.Text = df.Revision;
        }
    }
    catch
    { }
    #endregion
    File.Delete(filename);
    doc.Save(filename);
}

Sorry, it’s all caused by technical limits on what Aspose.Word can do. You just have to excercise more creativity

Try this:

//Remove the text from the bookmark.
//Use Bookmark.Text because it is the only way to delete bookmark text.
doc.Range.Bookmarks["mybookmark"].Text = "";

//Use document builder to insert rich formatted text into the bookmark
//because its the only way to do so.
builder.MoveToBookmark("mybookmark");
builder.Font.Bold = true;
builder.Font.Size = 14;
builder.Write("New Bookmark Text");