attached you will find two different documents that i am working with. I have a service i wrote that will take a doc file, open it with aspose, search and replace several merge fields (keywords surrounded in brakets), insert a small image and then save the file. we have 1000’s of documents and this seems to work pretty well, but with the attached ones, the format is changing once the doc is saved.
take a look at the two documents prefixed with 44090. The one with BUILD in the name is the end result. the other is the original file. there is also an image named 44090.png which shows the area of the document this is changing, so you can compare the original to the built version. as you can see, there is a section of text that seems to be changing format. the original has two text sections in the middle of page one, but then the built one is somehow making it one text section and running it off the bottom of the first page. The other document 44839 is behaving the same and in fact we have about 10-15 others that are all similar format that is changing once its built.
Not sure if this is happening during the search/replace or a byproduct of saving, so take a look.
our code is very simple and boils down to :
Document document = new Document(new MemoryStream(inputFile));
// find and replace arguments are passed in. this is actually in a seperate method
document.Range.Replace(find, replace, false, false);
DocumentBuilder builder = new DocumentBuilder(document);
// Create shape
Aspose.Words.Drawing.Shape shape = builder.InsertImage(logoFile);
shape.AlternativeText = "Broker Logo";
shape.AnchorLocked = true;
shape.BehindText = false;
shape.Left = (double) left;
shape.Top = (double) top;
shape.RelativeHorizontalPosition = Aspose.Words.Drawing.RelativeHorizontalPosition.Margin;
shape.RelativeVerticalPosition = Aspose.Words.Drawing.RelativeVerticalPosition.Margin;
shape.WrapType = Aspose.Words.Drawing.WrapType.None;
ideas?