When using AquaScripts to send an excel file to email the data comes in the sheet with a few empty rows on top of the sheet and one column at the side, as in sheet that I attached to the email
Is there a way to have that it should start the DATA at the first row in the sheet and write the date time generated at the end of the report?
I use this in the script
// define data set settings
dataSetSettings = aqua.report.newReportDataSetSettings();
dataSetSettings.setShowHeader(true);
dataSetSettings.setShowRowNumber(false);
// NOTE: set text to (null) on NULL value is not supported
dataSetSettings.setShowAltRowColor(true);
dataSetSettings.setAltRowBackgroundColor('#c0c0c0');
dataSetSettings.setAltRowForegroundColor('#000000');
// add data set to report
report.addDataSet(dataSet, dataSetSettings);
// save report as Excel
report.saveAsExcel2007(reportname);
![]() |
9 KB
![]() |
4 KB
We have an old issue on this. Fung logged or emailed me a description of how this works and how to change the behavior, but I can't seem to find it.
Below is the email I sent to Niels on 9/6/2012:
-----------------------------------------------
> Rows 1-3 empty and also column A,
Row 1 is for displaying report title.
Report title can be set by
dataSetSettings.setTitle(String).
Report title can be turned off by
dataSetSettings.setShowTitle(false).
Row 2 is for displaying the time when the reported is generated.
Report time is generated implicitly and can be turned off by
dataSetSettings.setShowReportTime(false);
Row 3 is an empty line setting betwen title/report-time and data.
> there is also a grey empty row on row 83.
The last row is for displaying footer.
Report footer can be set by
dataSetSettings.setFooter(String);
Report footer can be turned off by
dataSetSettings.setShowFooter(false);
The last line will be gone if method above is used.
We did not shift data rows up if title/report-time is turned off.
We did not shift data rows to the first column if all of title/report-time/footer are turned off.
Below is the email I sent to Niels on 9/6/2012:
-----------------------------------------------
> Rows 1-3 empty and also column A,
Row 1 is for displaying report title.
Report title can be set by
dataSetSettings.setTitle(String).
Report title can be turned off by
dataSetSettings.setShowTitle(false).
Row 2 is for displaying the time when the reported is generated.
Report time is generated implicitly and can be turned off by
dataSetSettings.setShowReportTime(false);
Row 3 is an empty line setting betwen title/report-time and data.
> there is also a grey empty row on row 83.
The last row is for displaying footer.
Report footer can be set by
dataSetSettings.setFooter(String);
Report footer can be turned off by
dataSetSettings.setShowFooter(false);
The last line will be gone if method above is used.
We did not shift data rows up if title/report-time is turned off.
We did not shift data rows to the first column if all of title/report-time/footer are turned off.
> Is there a way to have that it should start the DATA at the first row in the sheet and write the date time generated at the end of the report?
No, this is not supported at the moment.
> Is there a way to have that it should start the DATA at the first row in the sheet and write the date time generated at the end of the report?
No, this is not supported at the moment.
The following code will save an excel file, with column headings, starting at row 1, column 1, and without the "Generated on ..." string:
var filename = "/home/n/myexcel.xls"; var dataSet = generateDataSet(); var excel = aqua.data.newExcelSpreadsheet(filename); excel.insert(dataSet, true); excel.setWorksheetName(0, "Grid Results"); excel.save(); //------------------------------------------------------------------------------ function generateDataSet(){ var ds = aqua.data.newDataSet(["column 1","column 2","column 3","column 4","column 5"]); ds.addRowWithValues("aaaaaa", "we", 248, "Y", 0); ds.addRowWithValues("ccccc", "qw", 249.99, "N", 0); return ds; }
I've attached the saved "myexcel.xls" file.
The following code will save an excel file, with column headings, starting at row 1, column 1, and without the "Generated on ..." string:
var filename = "/home/n/myexcel.xls"; var dataSet = generateDataSet(); var excel = aqua.data.newExcelSpreadsheet(filename); excel.insert(dataSet, true); excel.setWorksheetName(0, "Grid Results"); excel.save(); //------------------------------------------------------------------------------ function generateDataSet(){ var ds = aqua.data.newDataSet(["column 1","column 2","column 3","column 4","column 5"]); ds.addRowWithValues("aaaaaa", "we", 248, "Y", 0); ds.addRowWithValues("ccccc", "qw", 249.99, "N", 0); return ds; }
I've attached the saved "myexcel.xls" file.
Customer is happy with the workaround Nhi provided, marked this issue Resolved.
Customer is happy with the workaround Nhi provided, marked this issue Resolved.
Customer require alternate row coloring in excel spreadsheet, which is not possible with the current AQExcelSpreadsheet API. We can either enhance the AQExcelSpreadsheet to allow style settings, or enhance the AQReport to allow eliminating the first blank column and the 3 blank rows at the top.
Customer require alternate row coloring in excel spreadsheet, which is not possible with the current AQExcelSpreadsheet API. We can either enhance the AQExcelSpreadsheet to allow style settings, or enhance the AQReport to allow eliminating the first blank column and the 3 blank rows at the top.
Issue #8233 |
Closed |
Incomplete |
Completion |
No due date |
No fixed build |
No time estimate |
We have an old issue on this. Fung logged or emailed me a description of how this works and how to change the behavior, but I can't seem to find it.