commit d1e50c3ee8ea7357290fc583e78a8f69cf885c7b
Author: Michal Linha <mlinha@students.zcu.cz>
Date:   Tue Apr 7 22:16:20 2020 +0200

    re #7782 Created new class ExporterPDF with export to PDF functionality and renamed the former Exporter class to ExporterXLSX, changed the version of a library used for export to XLSX functionality implementation

diff --git a/pom.xml b/pom.xml
index 77f883d7..3adb7554 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,7 +105,13 @@
 		<dependency>
 			<groupId>org.apache.poi</groupId>
 			<artifactId>poi-ooxml</artifactId>
-			<version>3.17</version>
+			<version>4.1.2</version>
+		</dependency>
+
+		<dependency>
+			<groupId>com.github.librepdf</groupId>
+			<artifactId>openpdf</artifactId>
+			<version>1.3.14</version>
 		</dependency>
 	</dependencies>
 
diff --git a/src/main/java/vldc/aswi/utils/Exporter.java b/src/main/java/vldc/aswi/utils/Exporter.java
deleted file mode 100644
index f2900982..00000000
--- a/src/main/java/vldc/aswi/utils/Exporter.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package vldc.aswi.utils;
-
-import org.apache.poi.ss.formula.functions.Column;
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-/**
- * Class used for exporting data to different output files
- */
-public class Exporter {
-
-    /**
-     * !!!DUMMY!!!
-     * Exports data to .xlsx file
-     * @param tableName name of the table
-     */
-    public static void exportToExcel(String tableName) {
-
-        //temporary dummy implementation, used for testing
-        String[] columns = new String[] {"studuje", "nestuduje"};
-        String[] rows = new String[] {"fav", "fst"};
-        String[] data = new String[] {"1", "2", "3", "4"};
-
-        Workbook workbook = new XSSFWorkbook();
-
-        Sheet sheet = workbook.createSheet(tableName);
-
-        Font colRowNameFont = workbook.createFont();
-        colRowNameFont.setBold(true);
-        colRowNameFont.setFontHeightInPoints((short) 16);
-        colRowNameFont.setColor(IndexedColors.BLACK.getIndex());
-
-        Font dataFont = workbook.createFont();
-        dataFont.setBold(false);
-        dataFont.setFontHeightInPoints((short) 12);
-        dataFont.setColor(IndexedColors.BLACK.getIndex());
-
-        CellStyle colRowStyle = workbook.createCellStyle();
-        colRowStyle.setFont(colRowNameFont);
-
-        CellStyle dataStyle = workbook.createCellStyle();
-        dataStyle.setFont(dataFont);
-
-        Row descRow = sheet.createRow(0);
-
-        for (int i = 0; i < 2; i++) {
-            Cell cell = descRow.createCell(i + 1);
-            cell.setCellValue(columns[i]);
-            cell.setCellStyle(colRowStyle);
-        }
-
-        for (int i = 0; i < 2; i++) {
-            Row row = sheet.createRow(i + 1);
-            Cell nameCell = row.createCell(0);
-            nameCell.setCellValue(rows[i]);
-            nameCell.setCellStyle(colRowStyle);
-
-            Cell cell1 = row.createCell(1);
-            cell1.setCellValue(data[i + i + 1]);
-            cell1.setCellStyle(dataStyle);
-
-            Cell cell2 = row.createCell(2);
-            cell2.setCellValue(data[i + i + 1]);
-            cell2.setCellStyle(dataStyle);
-        }
-
-        for (int i = 0; i < 3; i++) {
-            sheet.autoSizeColumn(i);
-        }
-
-        //merge of columns, will be used for column headers
-        //sheet.addMergedRegion(new CellRangeAddress(0,0,1,2));
-
-        FileOutputStream streamOut = null;
-
-        try {
-            streamOut = new FileOutputStream("out.xlsx");
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        }
-
-        try {
-            workbook.write(streamOut);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        try {
-            if (streamOut != null) {
-                streamOut.close();
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        try {
-            workbook.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-}
diff --git a/src/main/java/vldc/aswi/utils/ExporterPDF.java b/src/main/java/vldc/aswi/utils/ExporterPDF.java
new file mode 100644
index 00000000..4531af59
--- /dev/null
+++ b/src/main/java/vldc/aswi/utils/ExporterPDF.java
@@ -0,0 +1,58 @@
+package vldc.aswi.utils;
+
+import com.lowagie.text.Cell;
+import com.lowagie.text.Document;
+import com.lowagie.text.Font;
+import com.lowagie.text.Phrase;
+import com.lowagie.text.pdf.PdfWriter;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+
+/**
+ * Class used for exporting data to PDF files
+ */
+public class ExporterPDF {
+
+    /**
+     * !!!DUMMY!!!
+     * Exports data to .pdf file
+     * @param tableName name of the table
+     */
+    public static void export(String tableName) throws FileNotFoundException {
+        Document doc = new Document();
+
+        PdfWriter.getInstance(doc, new FileOutputStream("out.pdf"));
+
+        Font font = new Font(com.lowagie.text.Font.COURIER, 14);
+        com.lowagie.text.Table table = new com.lowagie.text.Table(3);
+
+        Cell cell = new Cell(new Phrase(tableName, font));
+        cell.setColspan(2);
+        cell.setHeader(true);
+
+        Cell cell2 = new Cell(new Phrase("SUM", font));
+        cell2.setColspan(1);
+        cell2.setHeader(true);
+
+        table.addCell(cell);
+        table.addCell(cell2);
+
+        table.addCell(new Phrase("Val1", font));
+        table.addCell(new Phrase("Val2", font));
+        table.addCell(new Phrase("", font));
+
+        table.addCell("1");
+        table.addCell("2");
+        table.addCell("3");
+
+        table.addCell("4");
+        table.addCell("5");
+        table.addCell("9");
+
+        doc.open();
+        doc.add(table);
+
+        doc.close();
+    }
+}
diff --git a/src/main/java/vldc/aswi/utils/ExporterXLSX.java b/src/main/java/vldc/aswi/utils/ExporterXLSX.java
new file mode 100644
index 00000000..bebabf98
--- /dev/null
+++ b/src/main/java/vldc/aswi/utils/ExporterXLSX.java
@@ -0,0 +1,105 @@
+package vldc.aswi.utils;
+
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * Class used for exporting data to XLSX
+ */
+public class ExporterXLSX {
+
+    /**
+     * !!!DUMMY!!!
+     * Exports data to .xlsx file
+     * @param tableName name of the table
+     */
+    public static void export(String tableName) {
+
+        //temporary dummy implementation, used for testing
+        String[] columns = new String[] {"studuje", "nestuduje"};
+        String[] rows = new String[] {"fav", "fst"};
+        String[] data = new String[] {"1", "2", "3", "4"};
+
+        Workbook workbook = new XSSFWorkbook();
+
+        Sheet sheet = workbook.createSheet(tableName);
+
+        Font colRowNameFont = workbook.createFont();
+        colRowNameFont.setBold(true);
+        colRowNameFont.setFontHeightInPoints((short) 16);
+        colRowNameFont.setColor(IndexedColors.BLACK.getIndex());
+
+        Font dataFont = workbook.createFont();
+        dataFont.setBold(false);
+        dataFont.setFontHeightInPoints((short) 12);
+        dataFont.setColor(IndexedColors.BLACK.getIndex());
+
+        CellStyle colRowStyle = workbook.createCellStyle();
+        colRowStyle.setFont(colRowNameFont);
+
+        CellStyle dataStyle = workbook.createCellStyle();
+        dataStyle.setFont(dataFont);
+
+        Row descRow = sheet.createRow(0);
+
+        for (int i = 0; i < 2; i++) {
+            Cell cell = descRow.createCell(i + 1);
+            cell.setCellValue(columns[i]);
+            cell.setCellStyle(colRowStyle);
+        }
+
+        for (int i = 0; i < 2; i++) {
+            Row row = sheet.createRow(i + 1);
+            Cell nameCell = row.createCell(0);
+            nameCell.setCellValue(rows[i]);
+            nameCell.setCellStyle(colRowStyle);
+
+            Cell cell1 = row.createCell(1);
+            cell1.setCellValue(data[i + i + 1]);
+            cell1.setCellStyle(dataStyle);
+
+            Cell cell2 = row.createCell(2);
+            cell2.setCellValue(data[i + i + 1]);
+            cell2.setCellStyle(dataStyle);
+        }
+
+        for (int i = 0; i < 3; i++) {
+            sheet.autoSizeColumn(i);
+        }
+
+        //merge of columns, will be used for column headers
+        //sheet.addMergedRegion(new CellRangeAddress(0,0,1,2));
+
+        FileOutputStream streamOut = null;
+
+        try {
+            streamOut = new FileOutputStream("out.xlsx");
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            workbook.write(streamOut);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            if (streamOut != null) {
+                streamOut.close();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            workbook.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}
