Hi,
We are facing this inconsistent issue of data clashing across threads, on production environment of our multiple customer’s. It’s not reproducible at will at all.
Use case : Multiple records (ranging 25-50), with about 30-50 mergeable fields, are processed in parallel across those many threads, to create a PDF out of Word template, using Aspose words 15.11.
At times, the value of a field from 1 thread is getting attached to value of SAME field in thread 2.
Since this happening is not consistent, we tried to capture data at various points to narrow down the root cause.
And every time the data looks to be altered upon performing the Document.save() on aspose library.
Here is the code snippet we use.
(’**** CAPTURED ***’ before and after doc.SAVE(), to assess the discrepancy in printed out vs input XML)
Document doc = new Document(templateFile);
MailMerge merge = doc.getMailMerge();
// Reading the data from xml file for the mail merge
DataSet dataSet = new DataSet();
dataSet.readXml(xmlFilepath);
// ****** CAPTURED XML above *****//
// merge the header fields
DataTableCollection tables = dataSet.getTables();
if (tables != null && tables.getCount() > 0)
{
merge.execute(tables.get("PrintForm"));
}
// document cleanup settings
doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_CONTAINING_FIELDS);
// merge doc table fields
merge.executeWithRegions(dataSet);
// Remove unused regions
//removeUnusedRegions ( doc,new EmptyRegionsHandler()) ;
doc.updateFields();
removeBlankRows(doc);
doc.getFieldOptions().setBarcodeGenerator(new BarcodeGenerator());
doc.setFontSettings(new FontSettings()); //RSTK-14775
doc.getFontSettings().setFontsSources(new FontSourceBase[] { new FolderFontSource(".fonts/", true) });
doc.setWarningCallback(new FontSubstitutionWarningCollector());
com.aspose.words.PdfSaveOptions saveOption = new com.aspose.words.PdfSaveOptions();
com.aspose.words.DownsampleOptions downSampleOption = new DownsampleOptions();
downSampleOption.setDownsampleImages(false);
saveOption.setDownsampleOptions(downSampleOption);
doc.updateFields();
//Saving document as pdf
doc.save(outputDocumentName, saveOption);
// ****** CAPTURED output here from doc.getText() *****//
Do let us know, if such issue has already been attended in higher or latest version of Aspose Words.
This is really CRITICAL for us and our customers, as data in PDF reports is getting altered here.
Regards