Class RMExcelWriterXlsx
java.lang.Object
com.inductiveautomation.rm.out.RMExcelWriterXlsx
- All Implemented Interfaces:
ExcelAdapter<RMDocument, org.apache.poi.xssf.usermodel.XSSFWorkbook>
public class RMExcelWriterXlsx
extends Object
implements ExcelAdapter<RMDocument, org.apache.poi.xssf.usermodel.XSSFWorkbook>
This class is used to generate an Excel file from an RMDocument.
You simply invoke this with: new RMExcelWriter().getBytes(aDoc);
-
Nested Class Summary
Nested classes/interfaces inherited from interface ExcelAdapter
ExcelAdapter.KnownTypes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandrawSheet(org.apache.poi.xssf.usermodel.XSSFWorkbook workbook, String sheetName, RMDocument document, boolean headerRow, boolean nullsEmpty) Draws aSheetfor the specificTorg.apache.poi.xssf.usermodel.XSSFWorkbookdrawWorkbook(boolean headerRow, boolean nullsEmpty, RMDocument[] documents, String[] ignored) byte[]getBytes(RMDocument aDoc) Returns a byte array of an Excel file (.xls) for the given RMDocument.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ExcelAdapter
drawWorkbook
-
Constructor Details
-
RMExcelWriterXlsx
public RMExcelWriterXlsx()Creates a basic xlsx excel writer.
-
-
Method Details
-
drawWorkbook
public org.apache.poi.xssf.usermodel.XSSFWorkbook drawWorkbook(boolean headerRow, boolean nullsEmpty, RMDocument[] documents, String[] ignored) Description copied from interface:ExcelAdapter- Specified by:
drawWorkbookin interfaceExcelAdapter<RMDocument, org.apache.poi.xssf.usermodel.XSSFWorkbook>- Parameters:
headerRow- iftrue, header rows are expected to be written, otherwise false. It is up to the implementation whether this is respected or not.nullsEmpty- iftrue, null values will not be written to cells in the excel document. It is up to the implementation whether this is respected or not.documents- The object(s) that the Adapter is compatible with for writing.ignored- The names of the sheets to create. If null, will use a generic default.- Returns:
- A
Workbookof typeUthat can be closed or further manipulated.
-
drawSheet
public boolean drawSheet(org.apache.poi.xssf.usermodel.XSSFWorkbook workbook, String sheetName, RMDocument document, boolean headerRow, boolean nullsEmpty) Description copied from interface:ExcelAdapterDraws aSheetfor the specificT- Specified by:
drawSheetin interfaceExcelAdapter<RMDocument, org.apache.poi.xssf.usermodel.XSSFWorkbook>- Parameters:
workbook- the Workbook to add the new sheet tosheetName- the name of the sheet. This name should be checked viaWorkbookUtil.createSafeSheetName(String)document- the object to write to the sheetheaderRow- iftrue, header rows are expected to be written, otherwise false. It is up to the implementation whether this is respected or not.nullsEmpty- iftrue, null values will not be written to cells in the excel document. It is up to the implementation whether this is respected or not.- Returns:
trueif the object was successfully written to the workbook as a new sheet,falseif the object was not written successfully.
-
getBytes
Returns a byte array of an Excel file (.xls) for the given RMDocument.- Parameters:
aDoc- the RMDocument to retrieve the bytes from. Must not be null- Returns:
- the byte array of the contents of the document
-