Discussion

how to modify viewexporttoexcel activity

below is the java code inside that activity. this force to export and save it to excel file. how can i modify it to force it to export and save in csv file

//set the HTTP Headers to send the data as an Excel file
Page objHeadersPage = getProperty("pxRequestor.pyHTTPResponseHeaders").getAsPage();
if (objHeadersPage.isBound())
{
objHeadersPage.setValue("contentType" ,"application/vnd.ms-excel;charset=UTF-8");
sendData("", strData.toString());
}

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

December 2, 2008 - 5:56pm

Try this.
Add this line to the code.
objHeadersPage.setValue("Content-disposition","attachment; filename=test.csv");

This will render the stream as a excel but parsed as a CSV file.

Thanks
Rajesh

December 22, 2009 - 6:13pm

Though its one year old topic, just thought of sharing the code which is being used in our application for this case.

The source code for CSV file:

objHeadersPage.setValue("contentType" ,"application/csv");
objHeadersPage.setValue("ContentDisposition", "attachment;filename=filename.csv");

Regards,
Padma.