I am trying to take the RICH TEXT (formatted, i.e., bold in some place, different font colors) from a bookmark in an existing document, and paste that rich text into a new document. So my starting code looks like this:
Aspose.Words.Document sourceDocument = new Aspose.Words.Document(fileName);
Bookmark bookmark = sourceDocument.Range.Bookmarks[bookmarkName];
if (bookmark != null)
{
// code goes here to create new document
// and paste rich text from bookmark
}
My question is what would be the code that goes inside the “if” statement. By looking at the object model & some of the basic examples provided, I haven’t found a way to do this so far. The closest I’ve found is the code below, but this is for entering new text, and all of which is formatted the same way for the whole block of text. Is there a way to do what I am trying to accomplish above? Thanks!!
Document doc = new Document("MyDocument.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
// Specify font formatting
builder.Font.Size = 16;
builder.Font.Bold = true;
builder.Font.Color = System.Drawing.Color.Blue;
builder.Font.Name = "Arial";
builder.Underline = Underline.Dash;
builder.Write("A single string of text.");
Regards,
Jafar