I am working on a proof of concept and am having an issue. I am to move through a document, intserting text at varioud bookmarks in the document and then saving it as a new copy. I am getting the document, accessing the bookmarks with no exception, and am saving it to the new location - but the only information in the new document is the garbage text that the evaluation version puts in - not my new text…
Below is my code:
//load the original document
Document doc = new Document(spec.OriginalFilePath);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Font.Size = 24;
builder.Font.Bold = true;
builder.Font.Color = System.Drawing.Color.Blue;
builder.Font.Name = “Arial”;
builder.Underline = Underline.Dash;
foreach(string bookmarkName in spec.Replacements.Keys)
builder.MoveToBookmark(bookmarkName, true, true);
Console.WriteLine(“Adding: " + (string)spec.Replacements[bookmarkName] + " to the document”);
// builder.InsertCheckBox(“bob”, false, 40);
Console.WriteLine("Error updating bookmark name: " + bookmarkName + " : " + e.Message);
string newName = “foo.doc”;
doc.Save(spec.OutputDirectory + “/” + newName);
Console.WriteLine("Error performing replacement: " + ex.Message);
The “spec” object is an object containing references to the original doc, the
directory for the new one, and the replacements to be made.
NO errors are being reported to the console.
What am I missing here?
Thank you in advance.