Hi,
I am trying to get employee resume template but when using docx extension it gives me 2 errors which i have attached in files as image format. When i use doc format it is giving proper template generation.
I am also providing docx extension file. Please revert me back ASAP.
Thanks,
Shrikant
I am using the latest version only though i am facing this issue and one more thing when document gets generate, the name of document also gets change that it become new file that is “Document”[name of file], so can you please tell why this happens?
Please assist me for this two issues as early as possible.
Thanks,
Shrikant
we are using word mail merge here is the code that generates document :doc.getMailMerge().execute( new String[] { "Name", "Type", "Description", "city", "state", "account", "finalValue", "Footage" ,"industry","Category", "contactName","PersonName","Phone","Email", "ownerName","ownerPersonName","ownerPhone","ownerEmail"}, new Object[] { Name, Type, Description, city, state, account, fmt.format(fcv), nf1.format(sfv),industry,Category, contactName,PersonName, Phone,Email,ownerName,ownerPersonName,ownerPhone,ownerEmail});builder.getDocument().updateFields();
doc.save(genFolderPath+"/"+asposeInitializer.getNameOfGeneratedDocx());doc.save(genF
we are using word mail merge here is the code that generates document :doc.getMailMerge().execute( new String[] { "Name", "Type", "Description", "city", "state", "account", "finalValue", "Footage" ,"industry","Category", "contactName","PersonName","Phone","Email", "ownerName","ownerPersonName","ownerPhone","ownerEmail"}, new Object[] { Name, Type, Description, city, state, account, fmt.format(fcv), nf1.format(sfv),industry,Category, contactName,PersonName, Phone,Email,ownerName,ownerPersonName,ownerPhone,ownerEmail});builder.getDocument().updateFields();
doc.save(genFolderPath+"/"+asposeInitializer.getNameOfGeneratedDocx());
Hi
Shrikant,
i have just provided the info on what and how we are doing it and we just need to populate data to template and render it via web, it has nothing specific to our document it happens to any document you can try for your self or if you have some time i could show to you with a sample template.
Hope this hleps.
Hi,
It seems that you think if we end the respose after writing the document to broswer we would not have this issue, but we are using out.clear which are jsp out object methods and also are using servlet output stream object method outputsteam's close and flush, but still have the issue. these methods are similar to Response.End() functionality wise.
And also the jsp does not have any html content in it, it is 100% jps which has only out.write .
Hope this helps.
Here is the complete Jsp which does not have any html :
<%@ page language="java"%>
<%@page import="org.apache.log4j.Logger"%>
<%@ page import="java.util.*,java.io.*"%>
<%@ page import="com.aspose.words.Document"%>
<%@ page import="com.aspose.words.SaveFormat"%>
<%
//read the file name.
Logger log = Logger.getLogger("docGenSuccess.jsp");
String filePath = request.getAttribute("fileLocation").toString();
String fileName = filePath.substring(filePath.lastIndexOf(File.separator)+1,filePath.length());
File f = new File (filePath);
if(fileName.contains(".doc")) {
response.setContentType ("application/msword");
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
}
if(fileName.contains(".docx")) {
response.setContentType ("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
}
if(fileName.contains(".pdf")) {
response.setContentType ("application/pdf");
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
}
//get the file name
String name = f.getName().substring(f.getName().lastIndexOf(File.separator) + 1,f.getName().length());
InputStream in = null;
ServletOutputStream outs = response.getOutputStream();
if(fileName!= null && fileName.contains(".docx")) {
try{
Document outdoc = new Document(filePath);
outdoc.save(outs,SaveFormat.DOCX);
}catch(Throwable t){
t.printStackTrace(System.out);
}finally{
if(outs != null){
outs.flush();
outs.close();
}
}
} if(outs != null){
outs.flush();
outs.close();
}
}
}
out.clear();
%>
Hi Shrikant,
Hi
Shrikant,
over riding java.io.PrintWriter calss did not make any difference, sorry to say that it did not help.
Hi Shrikant,
please use this jsp to test no web application is required:
<%@ page language="java"%>
<%@page import="org.apache.log4j.Logger"%>
<%@ page import="java.util.*,java.io.*"%>
<%@ page import="com.aspose.words.Document"%>
<%@ page import="com.aspose.words.SaveFormat"%>
<%
//read the file name.
Logger log = Logger.getLogger("docGenSuccess.jsp");
String filePath = request.getAttribute("fileLocation").toString();
String fileName = filePath.substring(filePath.lastIndexOf(File.separator)+1,filePath.length());
File f = new File (filePath);
if(fileName.contains(".doc")) {
response.setContentType ("application/msword");
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
}
if(fileName.contains(".docx")) {
response.setContentType ("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
}
if(fileName.contains(".pdf")) {
response.setContentType ("application/pdf");
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
}
//get the file name
String name = f.getName().substring(f.getName().lastIndexOf(File.separator) + 1,f.getName().length());
InputStream in = null;
ServletOutputStream outs = response.getOutputStream();
if(fileName!= null && fileName.contains(".docx")) {
try{
Document outdoc = new Document(filePath);
outdoc.save(outs,SaveFormat.DOCX);
}catch(Throwable t){
t.printStackTrace(System.out);
}finally{
if(outs != null){
outs.flush();
outs.close();
}
}
} if(outs != null){
outs.flush();
outs.close();
}
}
}
out.clear();
%>
Hi
Shrikant,
sorry to say that the same problem still exists.
i here with attach the screen shots, please make sure you validate in weblogic so that you can easily reproduce the issue.
Hi Shrikant,
The issues you have found earlier (filed as WORDSNET-6310) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.