Hi,
I am having an issue where image and textboxes inserted in a document start to shift up during mail merging. With a single page it looks fine, but as soon as I add mail merging (even when there a no fields on the page), the image and textboxes shift and drastically changing the layout. However when doing a mail merge via MS Word all the elements are positioned accurately for each subsequent page.
I am able to fix the issue to some extent when enabling “Fix Position on Page” for the page elements.
Our product is centered around allowing users to upload word docs which we then mail merge and prepare for direct mail printing. Having the layout change is kind of a show stopper for us as the client won’t be previewing all pages of the mail merged document.
package aspose.bug;
import com.aspose.words.Document;
import com.aspose.words.IMailMergeDataSource;
import java.io.FileInputStream;
public class MailMergeBug {
public static void main(String… args) {
try {
new com.aspose.words.License().setLicense(new FileInputStream(“C:\mailmerge\Aspose.Words.lic”));
final Document doc = new Document(“C:\mailmerge\mail-out-A4.docx”);
doc.getMailMerge().execute(new IMailMergeDataSource() {
int i=0;
public String getTableName() throws Exception {
return “mock”;
}
public boolean moveNext() throws Exception {
return i++ < 10;
}
public boolean getValue(String s, Object[] objects) throws Exception {
return false;
}
public IMailMergeDataSource getChildDataSource(String s) throws Exception {
return null;
}
});
doc.save(“C:\mailmerge\preview.docx”);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Thank you,
Daniel