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

Free Support Forum - aspose.com

Need help to migrate from SoftArtisans WordWriter for Java to Aspose.Words for Java


Thanks for your response. My requirement is as follows.
I have some word document templates with merge fields(See the attachment for example merge fields). I need to change them dynamically. So i need to use java API. I need to use WordTemplate.java.
I need corresponding jar. Could you please provide it? If it is commercial , please provide a trial version. If i like it, i recommend to buy.
If possible provide your number . We can communicate on phone. My skype id is 'madangcse' .

Reference program from Google.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.softartisans.wordwriter.WordTemplate;

public class WwServlet extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
//--- The array of values should be of type Object[].
//--- These values are what will be populated into merge
//--- fields in the template document.
Object[] arrValue = {"SoftArtisans", "WordWriter", "http://www.softartisans.com"};

//--- The array of names should be of type string[].
//--- The array indices of the name array should correspond
//--- to the indices of the value array.
String[] arrName = {"CompanyName", "ProductName", "URL"};

//--- Declare the WordWriter.WordTemplate object and intialize it as null
WordTemplate oWW = null;

//--- Path to the template file, relative to the Servlet context root
String templateFile = "/Basic/ArrayVars/ArrayVarsTemplate.doc";

//--- Declare the InputStream we will use to open the template
InputStream iStream = null;

//--- Instantiate the WordTemplate object.
oWW = new WordTemplate();

//--- Open Word template file as a resource: have to do it this way to work
//--- from unexpanded WAR files. For greatest efficiency and reliability,
//--- use a BufferedInputStream.
ServletContext ctx = this.getServletContext();
iStream = new BufferedInputStream(ctx.getResourceAsStream(templateFile));

//--- Open the template file.

//--- Set the data source of the document by passing
//--- the value array and the name array initialized above.
oWW.setDataSource(arrValue, arrName);

//--- Call WordTemplate.Process() to populate the template
//--- with the new data.

//--- Call WordTemplate.Save(). If you pass Save the variable
//--- "response," WordWriter will stream the generated file to
//--- the client.
oWW.save(response, "ArrayVarsOutput.doc", false);
catch(Exception ex)
//--- Alert the user if there's any exception
response.getWriter().println("An Exception has occurred:
" +

This message was posted using Email2Forum by romank.


Thank you for your interest in Aspose.Words. Aspose.Words code to achieve simple mail merge is very similar to code you provided. You can find example here:


You can download the latest version of Aspose.Words for java from here:


Please let me know if you have any further questions about using Aspose.Words. I will be glad to help you.

Best regards.