### isOOXMLZipHeader(byte[] bytes) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Validates if a byte array starts with an OOXML ZIP file header. ```APIDOC ## static boolean isOOXMLZipHeader(byte[] bytes) ### Description Static method to check if a byte array starts with an OOXML ZIP file header. ### Parameters - **bytes** (byte[]) - Required - First few bytes of a file ### Returns - **boolean** - true if bytes match OOXML file signature ``` -------------------------------- ### isOLE2Header(byte[] bytes) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Validates if a byte array starts with an OLE2 file header. ```APIDOC ## static boolean isOLE2Header(byte[] bytes) ### Description Static method to check if a byte array starts with an OLE2 file header (older Excel format). ### Returns - **boolean** - true if bytes match OLE2 file signature ``` -------------------------------- ### style(int, int) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Gets a style setter for a specific cell to apply formatting. ```APIDOC ## style(int, int) ### Description Gets a style setter for a specific cell to apply formatting. ### Signature `public StyleSetter style(int row, int col)` ### Parameters - **row** (int) - Required - Zero-based row number - **col** (int) - Required - Zero-based column number ### Returns - **StyleSetter** - Style setter for fluent API ### Example ```java ws.style(0, 0).bold().fillColor("FFFF00").set(); ``` ``` -------------------------------- ### Get Absolute Range String Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Returns the Excel-style string representation using absolute references. ```java public String toAbsoluteString() ``` ```java String ref = ws.range(0, 0, 9, 3).toAbsoluteString(); // Returns "$A$1:$D$10" ``` -------------------------------- ### Get active sheet Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/sheet-reader.md Retrieves the active sheet or defaults to the first sheet if none is marked active. ```java try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"))) { Sheet active = wb.getActiveSheet() .orElseGet(() -> wb.getFirstSheet()); try (Stream rows = active.openStream()) { rows.limit(5).forEach(row -> System.out.println(row.getRowNum())); } } ``` -------------------------------- ### Create and populate a workbook Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/INDEX.md Demonstrates how to initialize a workbook, add data of various types, apply formulas, and style cell ranges. ```java // Create and populate workbook try (OutputStream os = new FileOutputStream("file.xlsx"); Workbook wb = new Workbook(os, "AppName", "1.0")) { Worksheet ws = wb.newWorksheet("Sheet1"); ws.value(0, 0, "Title"); // String ws.value(0, 1, 123.45); // Number ws.value(1, 0, LocalDate.now()); // Date ws.value(2, 0, true); // Boolean ws.formula(3, 0, "SUM(A1:A3)"); // Formula ws.range(0, 0, 0, 1).style() // Style range .bold() .fillColor("4472C4") .set(); } ``` -------------------------------- ### Get cell by address Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/row-reader.md Accesses a cell using a CellAddress object. ```java CellAddress addr = new CellAddress("A1"); Cell cell = row.getCell(addr); ``` -------------------------------- ### Get cell count Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/row-reader.md Retrieves the total number of cells in the row. ```java int cellCount = row.getCellCount(); System.out.println("Cells in row: " + cellCount); ``` -------------------------------- ### Initialize Workbook with Application Metadata Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Set application name and version during instantiation, noting that version strings must follow the XX.YYYY format. ```java // Valid configurations new Workbook(os, "MyApp", "1.0") // Valid version new Workbook(os, "MyApp", "12.5678") // Valid version new Workbook(os, "MyApp", null) // No version // Invalid - throws exception // new Workbook(os, "MyApp", "v1.0") // Invalid format // new Workbook(os, "MyApp", "1") // Missing decimal part ``` -------------------------------- ### Get Column Index Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Retrieves the zero-based column index of the cell. ```java int col = cell.getColumnIndex(); System.out.println("Column: " + col); ``` -------------------------------- ### Create a Simple Workbook Source: https://github.com/dhatim/fastexcel/blob/master/README.md Initialize a workbook and worksheet, then populate cells with various data types. ```java try (OutputStream os = ..., Workbook wb = new Workbook(os, "MyApplication", "1.0");) { Worksheet ws = wb.newWorksheet("Sheet 1"); ws.value(0, 0, "This is a string in A1"); ws.value(0, 1, new Date()); ws.value(0, 2, 1234); ws.value(0, 3, 123456L); ws.value(0, 4, 1.234); } ``` -------------------------------- ### Get Range String Representation Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Returns the Excel-style string representation of the range. ```java @Override public String toString() ``` ```java String ref = ws.range(0, 0, 9, 3).toString(); // Returns "A1:D10" ws.formula(10, 0, "SUM(" + ref + ")"); ``` -------------------------------- ### Write workbook with formatting in Java Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/README.md Demonstrates creating a workbook, adding a worksheet, and applying styles to ranges using the fluent API. ```java try (OutputStream os = new FileOutputStream("report.xlsx"); Workbook wb = new Workbook(os, "Reporter", "1.0")) { Worksheet ws = wb.newWorksheet("Report"); // Header row ws.value(0, 0, "Date"); ws.value(0, 1, "Amount"); ws.range(0, 0, 0, 1).style() .bold() .fillColor(Color.BLUE) .fontColor(Color.WHITE) .horizontalAlignment("center") .set(); // Data rows with alternate shading ws.range(1, 0, 100, 1).style() .shadeAlternateRows(Color.GRAY1) .set(); // Format date and amount columns ws.range(1, 0, 100, 0).style() .format("yyyy-MM-dd") .set(); ws.range(1, 1, 100, 1).style() .format("$#,##0.00") .horizontalAlignment("right") .set(); } ``` -------------------------------- ### Workbook(OutputStream, String, String) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Constructor to initialize a new Workbook instance with an output stream and application metadata. ```APIDOC ## Workbook(OutputStream, String, String) ### Description Creates a new workbook with the specified output stream and application metadata. This is the entry point for creating Excel XLSX workbooks. ### Parameters - **os** (OutputStream) - Required - Output stream where the XLSX file will be written - **applicationName** (String) - Required - Name of the application generating this workbook - **applicationVersion** (String) - Optional - Version of the application in format XX.YYYY (e.g., "1.0") ### Throws - **IllegalArgumentException** - If applicationVersion is not null and does not match format XX.YYYY ### Example ```java try (OutputStream os = new FileOutputStream("output.xlsx"); Workbook wb = new Workbook(os, "MyApp", "1.0")) { Worksheet ws = wb.newWorksheet("Sheet1"); ws.value(0, 0, "Hello"); } ``` ``` -------------------------------- ### Get cell by index Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/row-reader.md Accesses a cell using a zero-based column index. ```java Cell cell = row.getCell(0); String value = cell.getText(); ``` -------------------------------- ### Get row number Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/row-reader.md Retrieves the one-based row number from a Row object. ```java Row row = rows.get(0); System.out.println("Row number: " + row.getRowNum()); // Prints "1" ``` -------------------------------- ### Workbook Constructor Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Initializes a new Workbook instance with required application metadata. ```APIDOC ## Workbook(OutputStream os, String applicationName, String applicationVersion) ### Description Creates a new Workbook instance. The application version must follow the format \d{1,2}\.\d{1,4} if provided. ### Parameters - **os** (OutputStream) - Required - Output stream for XLSX file - **applicationName** (String) - Required - Application name for document properties - **applicationVersion** (String) - Optional - Application version in XX.YYYY format ### Example ```java // Valid configurations new Workbook(os, "MyApp", "1.0"); new Workbook(os, "MyApp", "12.5678"); new Workbook(os, "MyApp", null); ``` ``` -------------------------------- ### Run Benchmarks with Maven Source: https://github.com/dhatim/fastexcel/blob/master/e2e/README.md Execute all benchmark classes, which must end with `Benchmark` and extend `BenchmarkLauncher`. CSV results are saved to the `target` directory. ```bash mvn clean test -Pbench ``` -------------------------------- ### Write an Excel file with FastExcel Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/README.md Demonstrates creating a new workbook, adding a worksheet, populating cells, and applying styles to a range. ```java try (OutputStream os = new FileOutputStream("output.xlsx"); Workbook wb = new Workbook(os, "MyApp", "1.0")) { Worksheet ws = wb.newWorksheet("Sheet1"); ws.value(0, 0, "Name"); ws.value(0, 1, "Price"); ws.value(1, 0, "Widget"); ws.value(1, 1, 19.99); // Format header ws.range(0, 0, 0, 1).style() .bold() .fillColor("4472C4") .fontColor("FFFFFF") .set(); } ``` -------------------------------- ### Get Cell Address Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Retrieves the CellAddress object representing the cell's location. ```java CellAddress addr = cell.getAddress(); System.out.println("Cell: " + addr); ``` -------------------------------- ### Create a workbook with version validation Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Initializes a workbook with a specific application version string that must follow the XX.YYYY format. ```java try (OutputStream os = new FileOutputStream("output.xlsx"); Workbook wb = new Workbook(os, "DataExporter", "2.15")) { // Valid version format (XX.YYYY) // ... worksheet operations ... } ``` -------------------------------- ### Create a basic workbook Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Initializes a new workbook and adds a worksheet with a cell value. ```java try (OutputStream os = new FileOutputStream("output.xlsx"); Workbook wb = new Workbook(os, "MyApp", "1.0")) { Worksheet ws = wb.newWorksheet("Sheet1"); ws.value(0, 0, "Hello"); } ``` -------------------------------- ### Get optional cell Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/row-reader.md Retrieves an Optional containing the cell at the specified index, or empty if it does not exist. ```java row.getOptionalCell(5) .map(Cell::getText) .ifPresent(System.out::println); ``` -------------------------------- ### Run End-to-End Tests with Maven Source: https://github.com/dhatim/fastexcel/blob/master/e2e/README.md Execute the end-to-end tests for the project using the specified Maven profile. ```bash mvn clean test -Pe2e ``` -------------------------------- ### Retrieve Cell Format String Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Get the format string for a cell, requiring ReadingOptions.withCellFormat to be enabled. ```java public String getDataFormatString() ``` ```java String format = cell.getDataFormatString(); if (format != null) { System.out.println("Format: " + format); } ``` -------------------------------- ### Workbook Writing Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/INDEX.md Demonstrates how to create a new workbook, add a worksheet, and write various data types and styles. ```APIDOC ## Workbook Writing ### Description Create and populate an XLSX workbook using the `Workbook` class. ### Usage ```java try (OutputStream os = new FileOutputStream("file.xlsx"); Workbook wb = new Workbook(os, "AppName", "1.0")) { Worksheet ws = wb.newWorksheet("Sheet1"); ws.value(0, 0, "Title"); ws.value(0, 1, 123.45); ws.formula(3, 0, "SUM(A1:A3)"); ws.range(0, 0, 0, 1).style().bold().fillColor("4472C4").set(); } ``` ``` -------------------------------- ### Implement fallback logic for ExcelReaderException Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/errors.md Demonstrates a recovery pattern by attempting to open a backup file if the primary file fails to load. ```java ReadableWorkbook wb; try { wb = new ReadableWorkbook(new File("data.xlsx")); } catch (ExcelReaderException e) { System.err.println("Primary file failed, trying backup"); wb = new ReadableWorkbook(new File("data.xlsx.bak")); } ``` -------------------------------- ### Retrieve Cell Format ID Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Get the format ID for a cell, requiring ReadingOptions.withCellFormat to be enabled. ```java public Integer getDataFormatId() ``` ```java Integer formatId = cell.getDataFormatId(); if (formatId != null) { System.out.println("Format ID: " + formatId); } ``` -------------------------------- ### Initialize ReadableWorkbook with ReadingOptions Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Initialize a workbook from a file while enabling cell format extraction via ReadingOptions. ```java ReadingOptions options = new ReadingOptions(true, true); try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"), options)) { // Cell formatting information available } ``` -------------------------------- ### Get Cell Value Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Retrieves the underlying value object, which varies based on the cell type. ```java Object value = cell.getValue(); if (value instanceof BigDecimal) { System.out.println("Number: " + value); } ``` -------------------------------- ### ReadingOptions Constructor Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Initializes the configuration for reading Excel files, defining whether to include cell formats and how to handle parsing errors. ```APIDOC ## ReadingOptions(boolean withCellFormat, boolean cellInErrorIfParseError) ### Description Creates a new configuration instance for the ReadableWorkbook. ### Parameters - **withCellFormat** (boolean) - Required - If true, extracts and includes cell format information. - **cellInErrorIfParseError** (boolean) - Required - If true, unparseable cells are marked as ERROR; if false, an exception is thrown. ### Usage Example ```java ReadingOptions options = new ReadingOptions(true, true); try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"), options)) { // Process workbook with custom options } ``` ``` -------------------------------- ### Get Cell Text Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Returns a safe string representation of the cell value, never returning null. ```java String text = cell.getText(); System.out.println(text); // Always safe, never null ``` -------------------------------- ### Initialize ReadableWorkbook from File Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Basic initialization of a workbook from a file without cell formatting. ```java try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"))) { Sheet sheet = wb.getFirstSheet(); // Read sheet... } ``` -------------------------------- ### Print Settings Methods Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Methods for configuring automatic page breaks, fitting to page, and scaling. ```APIDOC ## Print Settings Methods - **setAutoPageBreaks(boolean enabled)**: Enables or disables automatic page breaks. - **setFitToPage(boolean enabled)**: Enables or disables fitting content to page. - **fitToWidth(int pages)**: Sets the number of pages wide to fit content. - **fitToHeight(int pages)**: Sets the number of pages tall to fit content. - **pageScale(int percentage)**: Sets the scaling percentage for printing. ``` -------------------------------- ### Get Raw XML Value Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Retrieves the exact raw XML value from the XLSX file for debugging purposes. ```java String raw = cell.getRawValue(); ``` -------------------------------- ### Configure reading options Source: https://github.com/dhatim/fastexcel/blob/master/README.md Enable cell formatting or error handling by passing ReadingOptions to the constructor. ```java boolean withCellFormat = true; // If true, extract cell formatting boolean cellInErrorIfParseError = true; // If true, cell type is ERROR if it is not possible to parse cell value // If false, an exception is throw when there is a parsing error ReadingOptions readingOptions = new ReadingOptions(withCellFormat, cellInErrorIfParseError); try (ReadableWorkbook wb = new ReadableWorkbook(is, readingOptions)) { ``` -------------------------------- ### Add Hyperlink to Worksheet Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Defines the method signature for adding a hyperlink to a specific cell and provides a usage example. ```java public Worksheet hyperlink(int row, int col, HyperLink link) ``` ```java ws.hyperlink(0, 0, new HyperLink("https://github.com", "GitHub")); ``` -------------------------------- ### Basic row iteration with FastExcel Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/sheet-reader.md Demonstrates opening a workbook and iterating through all rows in the first sheet. ```java try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"))) { Sheet sheet = wb.getFirstSheet(); List rows = sheet.read(); for (Row row : rows) { String name = row.getCellAsString(0).orElse(""); BigDecimal amount = row.getCellAsNumber(1).orElse(BigDecimal.ZERO); System.out.println(name + ": $" + amount); } } ``` -------------------------------- ### Get the active sheet Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Retrieves the sheet that was active when the file was last saved, returning an empty Optional if none is defined. ```java wb.getActiveSheet().ifPresent(sheet -> { System.out.println("Active sheet: " + sheet.getName()); }); ``` -------------------------------- ### Create and format a data table Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Populates a range with data, applies alternating row shading, formats currency columns, and defines a formal table structure. ```java ws.value(0, 0, "Product"); ws.value(0, 1, "Price"); ws.value(0, 2, "Quantity"); for (int i = 1; i <= 10; i++) { ws.value(i, 0, "Product " + i); ws.value(i, 1, 100 + i * 5); ws.value(i, 2, i * 10); } // Format header ws.range(0, 0, 0, 2).style() .bold() .fillColor("D9E1F2") .set(); // Format data with alternating rows ws.range(1, 0, 10, 2).style() .shadeAlternateRows("F0F0F0") .horizontalAlignment("center") .set(); // Format price column as currency ws.range(1, 1, 10, 1).style() .format("$#,##0.00") .horizontalAlignment("right") .set(); // Create table ws.range(0, 0, 10, 2).createTable() .setName("DataTable") .setDisplayName("Product Sales"); ``` -------------------------------- ### Create Hyperlinks in Java Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Use the HyperLink constructor to define URLs and display text for cell hyperlinks. ```java ws.hyperlink(0, 0, new HyperLink("https://github.com", "GitHub")); ws.range(1, 0, 1, 1).setHyperlink( new HyperLink("mailto:test@example.com", "Email Me", HyperLinkType.EMAIL) ); ``` -------------------------------- ### Process with Format Information Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Use format strings to determine how to process cell data. ```java Cell cell = row.getCell(0); String format = cell.getDataFormatString(); String value = cell.getText(); if ("yyyy-MM-dd".equals(format)) { LocalDateTime date = cell.asDate(); // Process as date } else if ("0.00".equals(format)) { BigDecimal amount = cell.asNumber(); // Process as currency } else { // Process as generic text System.out.println(value); } ``` -------------------------------- ### Configure Workbook Compression Level Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Adjust the ZIP compression level to balance generation speed against the resulting file size. ```java // Fast generation with larger file size Workbook wb1 = new Workbook(os, "App", "1.0"); wb1.setCompressionLevel(2); // Slower generation with smaller file size Workbook wb2 = new Workbook(os, "App", "1.0"); wb2.setCompressionLevel(9); ``` -------------------------------- ### Configure print color settings Source: https://github.com/dhatim/fastexcel/blob/master/README.md Toggles between black and white or color printing modes. ```java ws.printInBlackAndWhite(); ws.printInColor(); ``` -------------------------------- ### Configure Global Font Settings Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Use the Font.build method to define font properties and apply them to the workbook. ```java Font arial12Bold = Font.build(true, false, false, "Arial", BigDecimal.valueOf(12), "FF000000", false); wb.setGlobalDefaultFont(arial12Bold); ``` -------------------------------- ### Obtain a StyleSetter instance Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Create a StyleSetter for a specific cell or a defined range of cells. ```java // For a single cell StyleSetter setter = ws.style(row, col); // For a range StyleSetter setter = ws.range(r1, c1, r2, c2).style(); ``` -------------------------------- ### Handle Sheet Access Errors Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/errors.md Shows how to handle cases where a workbook contains no sheets, recommending the use of getSheet(0) with Optional checks. ```java try { Sheet first = wb.getFirstSheet(); // Throws if no sheets } catch (IndexOutOfBoundsException e) { System.err.println("Workbook has no sheets"); } // Better approach Optional first = wb.getSheet(0); if (!first.isPresent()) { System.err.println("No sheets in workbook"); } ``` -------------------------------- ### Set header and footer content Source: https://github.com/dhatim/fastexcel/blob/master/README.md Configures page headers and footers with specific text, position, and formatting. ```java ws.header("page 1 of ?", Position.RIGHT); ws.footer("Generated with Fastexcel", Position.LEFT, "Arial", 10); ws.footer("sheetname", Position.CENTER, 8); ws.firstPageNumber(2); ``` -------------------------------- ### Initialize ReadableWorkbook from InputStream Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Initialize a workbook from an InputStream. Note that the entire file is loaded into memory. ```java try (InputStream is = new FileInputStream("data.xlsx"); ReadableWorkbook wb = new ReadableWorkbook(is)) { // Read workbook... } ``` -------------------------------- ### Read all rows into a list in Java Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/sheet-reader.md Loads all rows into memory as a list, suitable for smaller datasets. ```java Sheet sheet = wb.getFirstSheet(); List rows = sheet.read(); System.out.println("Total rows: " + rows.size()); ``` ```java List dataRows = sheet.read(); List names = dataRows.stream() .map(row -> row.getCellAsString(0).orElse("")) .filter(name -> !name.isEmpty()) .collect(Collectors.toList()); ``` -------------------------------- ### Apply styles to a range Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Use the StyleSetter to chain formatting options like bold, colors, and alignment, finishing with set(). ```java ws.range(0, 0, 0, 4) .style() .bold() .fillColor("4472C4") .fontColor("FFFFFF") .horizontalAlignment("center") .set(); ``` -------------------------------- ### Initialize ReadingOptions constructor Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Defines the constructor for configuring cell format extraction and error handling behavior. ```java public ReadingOptions(boolean withCellFormat, boolean cellInErrorIfParseError) ``` -------------------------------- ### ReadableWorkbook(InputStream, ReadingOptions) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Creates a readable workbook from an input stream with custom reading options. ```APIDOC ## ReadableWorkbook(InputStream, ReadingOptions) ### Description Creates a readable workbook from an input stream with custom reading options. ### Parameters - **inputStream** (InputStream) - Required - Stream providing XLSX file data - **readingOptions** (ReadingOptions) - Required - Configuration for reading behavior ``` -------------------------------- ### Configure Print Scaling and Fit Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Adjusts how content fits onto printed pages. ```java ws.setFitToPage(true); ws.fitToWidth(2); // Fit to 2 pages wide ws.fitToHeight(999); // Unlimited height ``` -------------------------------- ### Read Excel file without format information Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Demonstrates basic workbook reading using default settings. ```java try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"))) { Sheet sheet = wb.getFirstSheet(); List rows = sheet.read(); // Process rows without format information } ``` -------------------------------- ### Read an Excel file with FastExcel Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/README.md Demonstrates opening an existing workbook and streaming rows to process cell data. ```java try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"))) { Sheet sheet = wb.getFirstSheet(); try (Stream rows = sheet.openStream()) { rows.forEach(row -> { String name = row.getCellAsString(0).orElse(""); BigDecimal price = row.getCellAsNumber(1).orElse(BigDecimal.ZERO); System.out.println(name + ": " + price); }); } } ``` -------------------------------- ### Print Color Settings Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Methods to toggle between black and white or color printing. ```APIDOC ## Print Color Settings - **printInBlackAndWhite()**: Removes cell background and font colors for black and white printing. - **printInColor()**: Reverts to color printing. ``` -------------------------------- ### Workbook Reading Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/INDEX.md Demonstrates how to read an existing XLSX file using streaming to process rows efficiently. ```APIDOC ## Workbook Reading ### Description Read an XLSX file using `ReadableWorkbook` and stream rows for memory-efficient processing. ### Usage ```java try (ReadableWorkbook wb = new ReadableWorkbook(new File("file.xlsx"))) { Sheet sheet = wb.getFirstSheet(); try (Stream rows = sheet.openStream()) { rows.forEach(row -> { String title = row.getCellAsString(0).orElse(""); BigDecimal amount = row.getCellAsNumber(1).orElse(BigDecimal.ZERO); }); } } ``` ``` -------------------------------- ### freezePane(int, int) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Creates a freeze pane so specified rows and columns remain visible while scrolling. ```APIDOC ## freezePane(int, int) ### Description Creates a freeze pane so specified rows and columns remain visible while scrolling. ### Parameters - **colCount** (int) - Required - Number of columns from left to keep frozen - **rowCount** (int) - Required - Number of rows from top to keep frozen ``` -------------------------------- ### Configure Cell Protection Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Enumeration of cell protection options. ```java public enum ProtectionOption { LOCKED, // Cell content is locked HIDDEN // Formula is hidden } ``` -------------------------------- ### Apply Colors Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Predefined RGB color constants for styling cells, fonts, and borders. ```java Color.BLACK // "FF000000" Color.WHITE // "FFFFFFFF" Color.RED // "FFFF0000" Color.GREEN // "FF00B050" Color.BLUE // "FF0070C0" Color.YELLOW // "FFFFFF00" Color.PURPLE // "FF9DC3E6" Color.CYAN // "FF70AD47" Color.MAGENTA // "FFFF00FF" Color.GRAY1 // "FFF2F2F2" Color.GRAY2 // "FFC5C5C5" Color.GRAY3 // "FFA5A5A5" Color.GRAY4 // "FF808080" // ... many more ``` ```java ws.style(0, 0).fillColor(Color.GRAY2).fontColor(Color.BLACK).set(); ``` -------------------------------- ### style() Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Returns a StyleSetter to apply formatting to all cells in the range. ```APIDOC ## StyleSetter style() ### Description Returns a new StyleSetter for applying formatting to all cells in this range. ### Returns - **StyleSetter** - Style builder ``` -------------------------------- ### Apply Cell Borders Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Define border styles and colors using the Border constructor, then apply them to specific cells. ```java Border border = new Border("thin", "FF000000"); ws.style(0, 0).border(border).set(); ``` -------------------------------- ### Extracting values with defaults Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/row-reader.md Demonstrates using Optional to provide default values when cell data is missing. ```java String product = row.getCellAsString(0).orElse("Unknown"); BigDecimal price = row.getCellAsNumber(1).orElse(BigDecimal.ZERO); LocalDateTime date = row.getCellAsDate(2).orElse(null); Boolean active = row.getCellAsBoolean(3).orElse(false); ``` -------------------------------- ### ReadableWorkbook(InputStream) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Creates a readable workbook from an input stream. ```APIDOC ## ReadableWorkbook(InputStream) ### Description Creates a readable workbook from an input stream. Note: The entire XLSX file is loaded into memory (but not uncompressed). ### Parameters - **inputStream** (InputStream) - Required - Stream providing XLSX file data ``` -------------------------------- ### footer(String, Position) / footer(String, Position, String, int) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Sets footer text with optional custom font and size. ```APIDOC ## footer(String, Position) / footer(String, Position, String, int) ### Description Sets footer text at a specific position, with optional support for custom font name and size. ### Method public Worksheet footer(String text, Position position) public Worksheet footer(String text, Position position, String fontName, int fontSize) ### Parameters - **text** (String) - Required - Footer text. - **position** (Position) - Required - Position.LEFT, Position.CENTER, or Position.RIGHT. - **fontName** (String) - Optional - The name of the font. - **fontSize** (int) - Optional - The size of the font. ### Example ws.footer("Generated with FastExcel", Position.LEFT, "Arial", 10); ws.footer("&S", Position.CENTER, 8); // Sheet name in center ``` -------------------------------- ### ReadableWorkbook(File, ReadingOptions) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Creates a readable workbook from a file with optional cell format extraction. ```APIDOC ## ReadableWorkbook(File, ReadingOptions) ### Description Creates a readable workbook from a file with optional cell format extraction. ### Parameters - **inputFile** (File) - Required - Excel XLSX file to read - **readingOptions** (ReadingOptions) - Required - Configuration for reading behavior ``` -------------------------------- ### newWorksheet(String) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Creates a new worksheet with the specified name and adds it to the workbook. ```APIDOC ## newWorksheet(String) ### Description Creates a new worksheet with the given name and adds it to this workbook. ### Parameters - **name** (String) - Required - Name of the new worksheet ### Returns - **Worksheet** - The newly created worksheet ### Example ```java Worksheet ws1 = wb.newWorksheet("Sales Data"); ``` ``` -------------------------------- ### Define default ReadingOptions instance Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Provides the default configuration instance where cell format is disabled and parse errors are marked as errors. ```java public static final ReadingOptions DEFAULT_READING_OPTIONS = new ReadingOptions(false, true); ``` -------------------------------- ### Writer API Usage Flow Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/INDEX.md Illustrates the standard sequence of operations for creating and populating an Excel workbook. ```text new Workbook() → newWorksheet() → value(), formula(), style() → range() / style() → set() / merge() ``` -------------------------------- ### read() Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/sheet-reader.md Reads all rows into a List. Convenience method when loading all rows into memory is acceptable. ```APIDOC ## public List read() ### Description Reads all rows into a List. Convenience method when loading all rows into memory is acceptable. ### Returns - **List** - All rows in the sheet ### Throws - **IOException** - If an I/O error occurs ``` -------------------------------- ### Accessing Color Constants Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Use these predefined constants to apply standard colors to cell styles. ```java Color.BLACK // "FF000000" Color.WHITE // "FFFFFFFF" Color.RED // "FFFF0000" Color.GREEN // "FF00B050" Color.BLUE // "FF0070C0" Color.YELLOW // "FFFFFF00" Color.GRAY1 // "FFF2F2F2" Color.GRAY2 // "FFC5C5C5" // ... many more predefined colors ``` -------------------------------- ### Set workbook properties Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Configures metadata such as title, subject, and author for the workbook. ```java wb.properties() .setTitle("Q4 Report") .setSubject("Financial Data") .setAuthor("John Doe"); ``` -------------------------------- ### Apply multi-region formatting Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Iterates through columns to apply alternating background colors based on column index. ```java // Format odd columns with light blue, even with light gray for (int col = 0; col < 5; col++) { Range colRange = ws.range(0, col, 100, col); if (col % 2 == 0) { colRange.style().fillColor("D9E1F2").set(); } else { colRange.style().fillColor("E2EFDA").set(); } } ``` -------------------------------- ### createTable() Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Creates an Excel table (data range) over the current range. ```APIDOC ## createTable() ### Description Creates an Excel table (data range) over this range. ### Signature `public Table createTable()` ### Returns - **Table** - The table object for further configuration ### Example ```java Table table = ws.range(0, 0, 50, 3).createTable(); table.setName("MyTable"); table.setDisplayName("Sales Table"); table.styleInfo().setStyleName("TableStyleMedium1"); ``` ``` -------------------------------- ### Configure Header and Footer Position Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Enumeration for positioning content in worksheet headers and footers. ```java public enum Position { LEFT, CENTER, RIGHT } ``` ```java ws.header("Page 1", Position.LEFT); ws.header("Company Report", Position.CENTER); ws.header("2024", Position.RIGHT); ``` -------------------------------- ### Define Border Styles Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Enumeration of available border line styles. ```java public enum BorderStyle { THIN, MEDIUM, THICK, DOUBLE, DOTTED, DASHED, HAIR, // ... more styles } ``` -------------------------------- ### Finalize workbook generation Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Writes all data and metadata to the output stream. This is typically handled automatically by try-with-resources. ```java Workbook wb = new Workbook(os, "MyApp", "1.0"); ws.value(0, 0, "Data"); wb.finish(); // Explicitly finalize ``` -------------------------------- ### Apply bold formatting Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Applies bold styling to a cell. ```java public StyleSetter bold() ``` ```java ws.style(0, 0).bold().set(); ``` -------------------------------- ### Set print scaling and page breaks Source: https://github.com/dhatim/fastexcel/blob/master/README.md Configures scaling, automatic page breaks, and fit-to-page settings for printing. ```java ws.pageScale(60); ws.setAutoPageBreaks(true); ws.setFitToPage(true); ws.setFitToPage(true); ws.fitToWidth(2); ws.fitToHeight(999); ``` -------------------------------- ### getFormats() Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Retrieves the list of number formats used in the workbook. ```APIDOC ## List getFormats() ### Description Returns the list of number formats used in the workbook. ### Returns - **List** - Format strings (e.g., "m/d/yy", "yyyy-mm-dd") ``` -------------------------------- ### Apply Styles and Formatting Source: https://github.com/dhatim/fastexcel/blob/master/README.md Modify cell appearance, formatting, and global font settings. ```java ws.style(0, 0).bold().fill(Fill.GRAY125).set(); ``` ```java ws.value(0, 0, LocalDateTime.now()); ws.style(0, 0).format("yyyy-MM-dd H:mm:ss").set(); ``` ```java ws.style(0, 0).fillColor("FF8800").set(new ConditionalFormattingExpressionRule("LENB(A1)>1", true)); ``` ```java ws.style(0, 0).rotation(90).set(); ``` ```java wb.setGlobalDefaultFont("Arial", 15.5); ``` -------------------------------- ### Create Excel Table Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Defines a range as an Excel table and configures its properties. ```java Table table = ws.range(0, 0, 50, 3).createTable(); table.setName("MyTable"); table.setDisplayName("Sales Table"); table.styleInfo().setStyleName("TableStyleMedium1"); ``` -------------------------------- ### finish() Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Finalizes the workbook generation. ```APIDOC ## finish() ### Description Completes workbook generation and writes all worksheets and metadata to the output stream. ### Throws - **IOException** - If an I/O error occurs during writing - **IllegalArgumentException** - If workbook contains no worksheets ``` -------------------------------- ### Apply underline formatting Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Applies underline styling to a cell. ```java public StyleSetter underlined() ``` -------------------------------- ### Center and bold titles Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Applies bold, font size, alignment, and background color to a title cell. ```java ws.value(0, 0, "Sales Report"); ws.style(0, 0) .bold() .fontSize(16) .horizontalAlignment("center") .fillColor("E7E6E6") .set(); ``` -------------------------------- ### properties() Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/workbook.md Retrieves the workbook properties object for configuring metadata. ```APIDOC ## properties() ### Description Returns the workbook properties object for setting metadata like title, author, subject, and custom properties. ### Returns - **Properties** - The properties object for this workbook ### Example ```java wb.properties().setTitle("Q4 Report"); ``` ``` -------------------------------- ### Handle Cell Type Safety in Java Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/cell-reader.md Demonstrates unsafe, safe, and recommended patterns for extracting typed values from cells to avoid ExcelReaderException. ```java String value = cell.asString(); // Throws if not STRING type ``` ```java if (cell.getType() == CellType.STRING) { String value = cell.asString(); // Safe } ``` ```java Optional value = row.getCellAsString(0); value.ifPresent(System.out::println); ``` -------------------------------- ### Catching ExcelReaderException in Java Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Handle potential errors during workbook initialization by catching the ExcelReaderException. ```java try { ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx")); } catch (ExcelReaderException e) { System.err.println("Failed to read Excel file: " + e.getMessage()); } ``` -------------------------------- ### Define Fill Patterns Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Enumeration of predefined fill patterns for cell backgrounds. ```java public enum Fill { NONE, SOLID, MEDIUM_GRAY, DARK_GRAY, LIGHT_GRAY, DARK_HORIZONTAL, DARK_VERTICAL, DARK_DOWN, DARK_UP, DARK_GRID, DARK_TRELLIS, LIGHT_HORIZONTAL, LIGHT_VERTICAL, LIGHT_DOWN, LIGHT_UP, LIGHT_GRID, LIGHT_TRELLIS, GRAY125, GRAY0625 } ``` ```java ws.style(0, 0).fill(Fill.GRAY125).set(); ws.range(1, 0, 10, 10).style().fill(Fill.LIGHT_GRID).set(); ``` -------------------------------- ### StyleSetter Methods Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Methods available on the StyleSetter class for formatting cells. ```APIDOC ## bold() Applies bold formatting to text. ## italic() Applies italic formatting to text. ## underlined() Applies underline formatting to text. ## strikethrough() Applies strikethrough formatting to text. ## fontName(String name) Sets the font name. - name (String) - Required - Font name (e.g., "Arial") ## fontSize(BigDecimal size) Sets the font size in points (1 to 409 points). - size (BigDecimal) - Required - Font size in points ## fontSize(int size) Sets the font size in points using an integer. ## fontColor(String rgb) Sets the font color using RGB hex value. - rgb (String) - Required - RGB color code (e.g., "FF0000") ``` -------------------------------- ### Handle Row Cell Access Errors Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/errors.md Demonstrates catching IndexOutOfBoundsException when accessing cells and suggests using getOptionalCell as a safer alternative. ```java Row row = rows.get(0); try { Cell cell = row.getCell(1000); // May be out of bounds } catch (IndexOutOfBoundsException e) { System.err.println("Cell index out of range"); } // Better approach using Optional Optional cell = row.getOptionalCell(1000); ``` -------------------------------- ### header(String, Position) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Sets header text at a specific position. ```APIDOC ## header(String, Position) ### Description Sets header text at a specific position (left, center, right). ### Method public Worksheet header(String text, Position position) ### Parameters - **text** (String) - Required - Header text (supports &P for page number, &N for page count). - **position** (Position) - Required - Position.LEFT, Position.CENTER, or Position.RIGHT. ### Example ws.header("Page &P of &N", Position.RIGHT); ``` -------------------------------- ### Configure paper size and orientation Source: https://github.com/dhatim/fastexcel/blob/master/README.md Sets print-specific layout properties for the worksheet. ```java ws.paperSize(PaperSize.A4_PAPER); ws.pageOrientation("landscape"); ``` -------------------------------- ### Multithreaded worksheet generation Source: https://github.com/dhatim/fastexcel/blob/master/README.md Demonstrates generating multiple worksheets concurrently using CompletableFuture. ```java try (OutputStream os = ...; Workbook wb = new Workbook(os, "MyApplication", "1.0");) { Worksheet ws1 = wb.newWorksheet("Sheet 1"); Worksheet ws2 = wb.newWorksheet("Sheet 2"); CompletableFuture cf1 = CompletableFuture.runAsync(() -> { // Fill worksheet 1 ... }); CompletableFuture cf2 = CompletableFuture.runAsync(() -> { // Fill worksheet 2 ... }); CompletableFuture.allOf(cf1, cf2).get(); } ``` -------------------------------- ### Configure row summary position Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Sets whether summary rows appear below or above detail rows. ```java public Worksheet rowSumsBelow(boolean below) ``` -------------------------------- ### Initialize and interact with CellAddress Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Constructors and methods for representing and manipulating cell coordinates in Excel notation. ```java public CellAddress(String address) // e.g., "A1", "B5" public CellAddress(int row, int col) ``` ```java public int getRow() // Zero-based row public int getColumn() // Zero-based column public String toString() // Excel notation (A1, B5, etc.) ``` ```java CellAddress addr = new CellAddress("A1"); int row = addr.getRow(); // 0 int col = addr.getColumn(); // 0 CellAddress addr2 = new CellAddress(5, 2); System.out.println(addr2); // "C6" ``` -------------------------------- ### Configure column summary position Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Sets whether summary columns appear to the right or left of detail columns. ```java public Worksheet rowSumsRight(boolean right) ``` -------------------------------- ### Close ReadableWorkbook Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Demonstrates manual and automatic resource management for the workbook. ```java ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx")); try { Sheet sheet = wb.getFirstSheet(); // Process sheet... } finally { wb.close(); } ``` ```java try (ReadableWorkbook wb = new ReadableWorkbook(new File("data.xlsx"))) { Sheet sheet = wb.getFirstSheet(); // Process sheet } // Automatically closed ``` -------------------------------- ### Style a header row Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Applies bold text, background color, and alignment to a header row. ```java ws.range(0, 0, 0, 4).style() .bold() .fillColor("4472C4") .fontColor("FFFFFF") .horizontalAlignment("center") .set(); ``` -------------------------------- ### getFirstSheet() Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/readable-workbook.md Retrieves the first sheet in the workbook. ```APIDOC ## getFirstSheet() ### Description Returns the first sheet in the workbook. ### Signature `public Sheet getFirstSheet()` ### Returns - **Sheet** - The first sheet in the workbook. ### Throws - **IndexOutOfBoundsException** - If the workbook contains no sheets. ``` -------------------------------- ### Set Workbook Metadata Properties Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Configure standard and custom workbook properties using the Properties class methods. ```java wb.properties() .setTitle("Q4 Financial Report") .setAuthor("Finance Dept") .setCategory("Finance") .setTextProperty("Department", "Accounting") .setNumberProperty("ReportVersion", BigDecimal.valueOf(2.0)); ``` -------------------------------- ### Style a header row Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/range.md Applies bold text, font size, background color, and borders to a specific range. ```java Range header = ws.range(0, 0, 0, 4); header.style() .bold() .fontSize(14) .fillColor("4472C4") .fontColor("FFFFFF") .horizontalAlignment("center") .verticalAlignment("center") .borderStyle("thin") .borderColor("000000") .set(); ``` -------------------------------- ### Group columns Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Groups columns to enable outline and collapse functionality. ```java public Worksheet groupCols(int start, int end) ``` ```java ws.groupCols(1, 3); // Group columns B-D ws.groupCols(4, 6); // Group columns E-G ``` -------------------------------- ### format(String) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/style-setter.md Sets the number format for the cell using Excel-compatible format strings. ```APIDOC ## StyleSetter.format(String numberingFormat) ### Description Sets the number format for the cell. Supports all Excel number formats. ### Parameters - **numberingFormat** (String) - Required - Format string (e.g., "0.00", "yyyy-mm-dd") ### Example ```java ws.value(0, 0, 1234.5); ws.style(0, 0).format("#,##0.00").set(); ``` ``` -------------------------------- ### Apply Custom Cell Formats Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/configuration.md Use the format method on a style object to apply custom number, date, or currency formatting to a cell. ```java ws.value(0, 0, 0.87); ws.style(0, 0).format("0%").set(); // Displays as 87% ws.value(1, 0, LocalDateTime.now()); ws.style(1, 0).format("yyyy-MM-dd").set(); // Displays as 2024-08-21 ws.value(2, 0, 1234567); ws.style(2, 0).format("#,##0").set(); // Displays as 1,234,567 ``` -------------------------------- ### Specify Image Formats Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/types.md Enumeration of supported image formats for embedding. ```java public enum ImageType { JPG, PNG, GIF, TIFF, BMP } ``` -------------------------------- ### paperSize(PaperSize) Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Sets the paper size for printing. ```APIDOC ## paperSize(PaperSize) ### Description Sets the paper size for printing. ``` -------------------------------- ### Add Fastexcel Dependency Source: https://github.com/dhatim/fastexcel/blob/master/README.md Include this dependency in your Maven POM file to use the library. ```xml org.dhatim fastexcel 0.20.2 ``` -------------------------------- ### Margin Settings Source: https://github.com/dhatim/fastexcel/blob/master/_autodocs/api-reference/worksheet.md Methods for setting print margins in inches. ```APIDOC ## Margin Settings - **topMargin(float inches)** - **bottomMargin(float inches)** - **leftMargin(float inches)** - **rightMargin(float inches)** - **headerMargin(float inches)** - **footerMargin(float inches)** ```