I am trying to use AbstractExcelView to serve an XLS document that I create on a server. Is there a way I can use this with an already constructed workbook? I tried the following but it doesn't work:
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.web.servlet.view.document.AbstractExcelView;
public class ValidationErrorsView extends AbstractExcelView {
@SuppressWarnings("unchecked")
@Override
protected void buildExcelDocument(Map arg0, HSSFWorkbook workbook,
HttpServletRequest arg2, HttpServletResponse arg3)
throws Exception {
final String toprocess = "myfile.xls";
final InputStream is = new FileInputStream(toprocess);
workbook = new HSSFWorkbook (is);
}
}