Commit 1ade8e72 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Export Excel: start column after newline corrected

parent c4a94d75
Pipeline #688 passed with stage
in 1 minute and 37 seconds
......@@ -6378,7 +6378,7 @@ Setup
+-------------+----------------+---------------------------------------------------------------------------------------------------+
| 'position' | position=A1 | Default is 'A1'. Use the excel notation. |
+-------------+----------------+---------------------------------------------------------------------------------------------------+
| 'row' | row | Start a new row. |
| 'newline' | newline | Start a new row. The column will be the one of the last 'position' statement. |
+-------------+----------------+---------------------------------------------------------------------------------------------------+
| 'str', 's' | s=hello world | Set the given string on the given position. The current position will be shiftet one to the right |
+-------------+----------------+---------------------------------------------------------------------------------------------------+
......@@ -6393,7 +6393,7 @@ Create a output like this: ::
s=Hello
s=World
s=First Line
row
newline
s=Second line
n=123
......@@ -6405,7 +6405,7 @@ In Report Syntax: ::
's=Hello' AS _XLS,
's=World' AS _XLS,
's=First Line' AS _XLS,
+ 'row' AS _XLS,
'newline' AS _XLS,
's=Second line' AS _XLS,
'n=123' AS _XLS,
......
......@@ -1349,7 +1349,7 @@ const EXCEL_MODE = 'mode';
const EXCEL_MODE_INSERT = 'insert';
const EXCEL_MODE_OVERWRITE = 'overwrite';
const EXCEL_POSITION = 'position';
const EXCEL_ROW = 'row';
const EXCEL_NEWLINE = 'newline';
const EXCEL_STRING2 = 'str';
const EXCEL_STRING = 's';
const EXCEL_FORMULA = 'f';
......
......@@ -44,6 +44,9 @@ class Excel {
* @param array $files
* @param array $data
* @return string
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @throws downloadException
*/
public function process(array $files, array $data) {
......@@ -87,6 +90,7 @@ class Excel {
* @param Spreadsheet $spreadsheet
* @param string $data
* @return Spreadsheet
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws downloadException
*/
private function fillSpreadsheet(Spreadsheet $spreadsheet, $data) {
......@@ -96,6 +100,7 @@ class Excel {
if (!OnString::splitExcelPos($pos, $posColumn, $posRow)) {
throw new downloadException("Invalid cell coordinates: " . $pos, ERROR_EXCEL_INVALID_COORDINATES);
}
$posColumnStart = $posColumn;
$arr = explode(PHP_EOL, $data);
foreach ($arr as $line) {
......@@ -126,10 +131,12 @@ class Excel {
if (!OnString::splitExcelPos($value, $posColumn, $posRow)) {
throw new downloadException("Invalid cell coordinates: " . $value, ERROR_EXCEL_INVALID_COORDINATES);
}
$posColumnStart = $posColumn;
break;
case EXCEL_ROW:
case EXCEL_NEWLINE:
$posRow++;
$posColumn = $posColumnStart;
break;
case EXCEL_STRING:
......
......@@ -788,7 +788,7 @@ class Report {
case COLUMN_IMPORT:
$dataImport = new DataImport($this->db);
$content = $dataImport->process('typo3conf/ext/qfq/qfq/qfq/sample.xlsx', 'test');
$content = $dataImport->process($columnValue, 'test');
break;
case COLUMN_EXCEL_PLAIN:
$content .= $columnValue . PHP_EOL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment