Hi ,
While generating single merge document , i have a template that set-up with 5 rows of temp data and save.
Now my SQL returns only 3 rows. Now wheni try to generate the
multimerge the new 3 rows getting appended and the remaining 2 rows not getting deleted.(old template data has 5 rows now the doc contains New row 3 + old temp data 2)
please let me know your views to solve this issue
WordMergeDocument wordMergeDocument = new WordMergeDocument(new File(argCvd.MergeDocument));
if (argRowCount == 1)
{
wordMergeDocument.mergeFields(argColumnMap);
}
else
{
WordMergeDataSource dataSource = new WordMergeDataSource(argColumnMap, argRowCount);
wordMergeDocument.mergeFields(dataSource);
}
if (argOutputStream == null)
{
FileOutputStream outputStream = new FileOutputStream(argDosPath);
outputStream.write(wordMergeDocument.generateDocument(argDosPath.substring(argDosPath.lastIndexOf(".") + 1)));
outputStream.close();
}
else
{
argOutputStream.write(wordMergeDocument.generateDocument(argDosPath.substring(argDosPath.lastIndexOf(".") + 1)));
argOutputStream.close();
}
------------------------
public WordMergeDocument(File argFilePath) throws Exception
{
originalDocument = new Document(argFilePath.getPath());
appendDocument();
}
public void appendDocument() throws Exception
{
if (currentDocument != null)
{
documentsList.add(currentDocument);
}
currentDocument = originalDocument.deepClone();
currentBuilder = new DocumentBuilder(currentDocument);
}
-------------------------
public void mergeFields(IMailMergeDataSource argIMailMergeDataSource) throws Exception
{
currentDocument.getMailMerge().execute(argIMailMergeDataSource);
}
Regards,
Karthick