We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Dynamic Render DOC template with other data types in Python?

Hi. All

I’m working on Python language. I wanna use Python to dynamic render the DOC template with ASPOSE. But I see these examples, http://www.aspose.com/docs/display/wordsnet/Python+and+Aspose.Words+for+.NET, it use ADODB.Recordset to get data. And my question is: is there any other ways to pass data into ASPOSE? I mean json, queryset in django, list or sth else?

Thanks for your attention.


Thanks for your inquiry. Here is a code example to perform a simple mail merge using Aspose.Words.

import jpype
import os.path

#Get path to directory with Aspose.Words.jar
jarpath = os.path.join(os.path.abspath("."), “lib”)

#Start JVM
jpype.startJVM(jpype.getDefaultJVMPath(), “-Djava.ext.dirs=%s” % jarpath)

#Create Document type
Document = jpype.JClass(“com.aspose.words.Document”)

#Open template document
doc = Document (“C:\Temp\in.doc”)

#Create names and values arrays
names = [“Name”, “Company”, “City”]
values = [“Alexey Noskov”, “Aspose”, “Auckland”]

#Execute mail merge
doc.getMailMerge().execute(names, values)

#Save output document

For more details, please visit the following link:

I hope, this helps.

Best regards,