}
InputStream stream = new ByteArrayInputStream(bytes);
EGSimpleTableParser parser = new EGSimpleTableParser(stream, fonts(), styles());
try {
NSData data = parser.data();
if((hasBinding("data") && canSetValueForBinding("data")) ||
(hasBinding("stream") && canSetValueForBinding("stream"))
) {
if(hasBinding("data")) {
setValueForBinding(data, "data");
}
if(hasBinding("stream")) {
setValueForBinding(data.stream(), "stream");
}
response.appendContentString(contentString);
} else {
String fileName = fileName();
if(fileName == null) {
fileName = "results.xls";
}
response.disableClientCaching();
response.appendHeader(String.valueOf( data.length()), "Content-Length" );
response.setContent(data); // Changed by ishimoto because it was sooooo buggy and didn't work in Japanese
response.setHeader("inline; filename=\"" + fileName + "\"", "content-disposition");
response.setHeader("application/vnd.ms-excel", "content-type");
}