This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 19, 2017, 1:14 PM
68 Posts

export selected docs to Excel not quite working

  • Category: Debugging
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: export pdf
  • Replies: 2

I have an "export" xPage that will be used to create an Excel spreadsheet of just the selected documents from a view.  This works fine when I'm exporting the entire view, but now I have a requirement to just export selected documents.  I'm getting a completely blank spreadsheet.  I am getting the correct docIDs - I've already confirmed that with a computed field.  Any ideas why this doesn't work?  This code is in the afterRenderResponse of the xPage:

var exCon = facesContext.getExternalContext();

var writer = facesContext.getResponseWriter();

var response = exCon.getResponse();

docIDArray=sessionScope.get(selectedDocs);

var output:string="";

response.setContentType("application/vnd.ms-excel");

response.setHeader("Cache-Control","no-cache");

writer.write("<table>");

writer.write("<thead><tr>");

writer.write("<td><b>Status</b></td>");

writer.write("<td><b>Group</b></td>");

writer.write("</tr></thead>");

for(i=0; i < docIDArray.length ; i++){

  var docID=docIDArray[i];

  var doc=database.getDocumentByID(docID);

  if(doc != null){

    output += "<tr>";

    output += "<td>" + doc.getItemValueString("Status")+"</td>";

    output += "<td>" + doc.getItemValueString("Group")+"</td>";

    output += "</tr>";

}};

writer.write(output);

writer.write("</table>");

writer.endDocument();

May 19, 2017, 4:58 PM
68 Posts
got it

After looking at another export xPage that IS working, I added the following bolded text to the top of the source of the xPage, and now it's working perfectly:

<xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false" xmlns:xc="http://www.ibm.com/xsp/custom">


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal