SmartClient Version: v12.1p_2020-09-18/Enterprise Deployment (built 2020-09-18)
Chrome, FF on OSX
Hello, I'm using grid.exportClientData, with exportAs:"xls", and I need to access the Workbook to set all cells to text format (instead of the default which is general):
This is working, but the browser downloads a 'IDACall' file (without extension), which is the correct excel file.
Also if I use exportFilename, ie:
the name isn't used.
Is it expected? Do I have to make a custom response?
Chrome, FF on OSX
Hello, I'm using grid.exportClientData, with exportAs:"xls", and I need to access the Workbook to set all cells to text format (instead of the default which is general):
Code:
<operationBinding operationType="clientExport" operationId="testExport">
<script language="groovy">
DSResponse dsResponse = dsRequest.execute();
org.apache.poi.ss.usermodel.Workbook workbook = (org.apache.poi.ss.usermodel.Workbook) dsResponse.getExportObject(dsRequest);
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0);
org.apache.poi.ss.usermodel.DataFormat fmt = workbook.createDataFormat();
org.apache.poi.ss.usermodel.CellStyle textStyle = workbook.createCellStyle();
short format = fmt.getFormat("text");
textStyle.setDataFormat(format);
for (org.apache.poi.ss.usermodel.Row row : sheet) {
for (org.apache.poi.ss.usermodel.Cell cell : row) {
cell.setCellStyle(textStyle);
}
}
dsResponse.setExportObject(workbook);
return dsResponse;
</script>
Also if I use exportFilename, ie:
Code:
gestioneDipendentiGrid.exportClientData({exportAs:"xls", operationId:"testExport", exportFilename:"test.xls"})
Is it expected? Do I have to make a custom response?
Comment