WORDSNET-20477 is still in Analysis stage. Please spare us some time for the investigation of this issue. We will get back to you with our findings soon.
I am afraid, we are unable to fully understand what your requirement actually is. We also need a sample of result (expected) document to understand what exactly you are trying to achieve. Please compose in MS Word the full output document with manually filled headers, sub-headers and all the fields. ZIP the DOCX file showing the desired output and attach it here for further testing. Thanks for your cooperation.
I have already shared a sample program in this chat with details so not sure what else you want us to provide.
Can you please also provide a Word DOCX document that shows us the desired output? You can create this document manually by using MS Word or any other editor. This will help us to understand the structure of your expected document as to how you want your final output be generated like.
The AsposeTestProject.zip I have attached in above comment has requested files too.
The “AsposeTestProject.zip” that you attached in this post earlier has four files in this “~\AsposeTestProject\Examples\src\main\resources\com\aspose\words\examples\loading_saving\TestAsposeWordToPdf” location and six files in this “~\AsposeTestProject\Examples\target\classes\com\aspose\words\examples\loading_saving\TestAsposeWordToPdf” location. Can you please clarify a bit which of these files should we take as an expected file?
It would be great if you please provide again a Word DOCX document that shows us the desired output (that you want Aspose.Words to produce)? You can create this document manually by using MS Word or any other editor. This will help us to understand the structure of your expected document. Thanks for your cooperation.
@awais.hafeez As I mentioned in the comment, it seems there is a bug in Aspose.word with getChildDataSource and “if statement”.It looks like getChildDataSource() is not calling correctly when we have “if statement”. In the AsposeTestProject.zip, we have testTemplateWithIF.docx which has “if statement” around getChildDataSource. Ideally it should render correct output into the “testTemplateResultWithIF.pdf” as an output when you run the AsposeTestProject project but it rendering as below which is incorrect,
image.png (175.3 KB)
Correct output should look like as below,
image.png (36.5 KB)
We have logged these details in our issue tracking system and will keep you posted here on further updates.
During further investigation we had determined that the template you shared has some problems. All you need to do is to surround the tables used as “true” arguments of the IF fields with double quotes. Otherwise MS Word and Aspose.Words do not understand that argument correctly. Please find attached fixed template and output DOCX and PDF files:
- WORDSNET-20477 Docs.zip (105.5 KB)