Class
XLSXFile
public class XLSXFile
The entry point class that represents an open file handle to an existing .xlsx
file on the
user's filesystem.
Initializers
init?(filepath:bufferSize:errorContextLength:)
public init?(filepath: String, bufferSize: UInt32 = 10 * 1024 * 1024, errorContextLength: UInt = 0)
Parameters
Name | Type | Description |
---|---|---|
filepath | String |
path to the |
bufferSize | UInt32 |
ZIP archive buffer size in bytes. The default is 10MB. You may need to set a bigger buffer size for bigger files. |
errorContextLength | UInt |
The error context length. The default is |
init(data:bufferSize:errorContextLength:)
public init(data: Data, bufferSize: UInt32 = 10 * 1024 * 1024, errorContextLength: UInt = 0) throws
Parameters
Name | Type | Description |
---|---|---|
data | Data |
content of the |
bufferSize | UInt32 |
ZIP archive buffer size in bytes. The default is 10MB. You may need to set a bigger buffer size for bigger files. |
errorContextLength | UInt |
The error context length. The default is |
Methods
parseRelationships()
public func parseRelationships() throws -> Relationships
parseDocumentPaths()
public func parseDocumentPaths() throws -> [String]
Return an array of paths to relationships of type officeDocument
parseStyles()
public func parseStyles() throws -> Styles
parseComments(forWorksheet:)
public func parseComments(forWorksheet path: String) throws -> Comments
parseWorkbooks()
public func parseWorkbooks() throws -> [Workbook]
Parse and return an array of workbooks in this file.
Worksheet names can be read as properties on the Workbook
model type.
parseDocumentRelationships()
@available(*, deprecated, renamed: "parseDocumentRelationships(path:)") public func parseDocumentRelationships() throws -> [([Substring], Relationships)]
Return pairs of parsed document paths with corresponding relationships.
Deprecation warning: this function doesn't handle root paths correctly,
even though some XLSX files do contain root paths instead of relative
paths. Use parseDocumentRelationships(path:)
instead.
parseDocumentRelationships(path:)
public func parseDocumentRelationships(path: String) throws -> (Path, Relationships)
Return parsed path with a parsed relationships model for a document at
given path. Use parseDocumentPaths
first to get a string path to pass
as an argument to this function.
parseWorksheetPathsAndNames(workbook:)
public func parseWorksheetPathsAndNames(workbook: Workbook) throws -> [(name: String?, path: String)]
Parse and return an array of worksheets in this XLSX file with their corresponding names.
parseWorksheetPaths()
public func parseWorksheetPaths() throws -> [String]
Parse and return an array of worksheets in this XLSX file.
parseWorksheet(at:)
public func parseWorksheet(at path: String) throws -> Worksheet
Parse a worksheet at a given path contained in this XLSX file.
cellsInWorksheet(at:rows:)
@available(*, deprecated, renamed: "Worksheet.cells(atRows:)") public func cellsInWorksheet(at path: String, rows: [Int]) throws -> [Cell]
Return all cells that are contained in a given worksheet and set of rows.
cellsInWorksheet(at:columns:)
@available(*, deprecated, renamed: "Worksheet.cells(atColumns:)") public func cellsInWorksheet(at path: String, columns: [String]) throws -> [Cell]
Return all cells that are contained in a given worksheet and set of
columns. This overloaded version is deprecated, you should pass
an array of ColumnReference
values as columns
instead of an array
of String
s.