public final class XlsxSaveOptions extends SaveOptions
Following code demonstrates how to save ExcelFile to XLSX (Excel 2007+) file format.
// Save file as .xlsx file
ef.save("Report.xlsx");
// Save file as .xlsm file
ef.save("Report.xlsm");
try (FileOutputStream stream = new FileOutputStream("Report.xlsx")) {
// Save file to stream
ef.save(stream, SaveOptions.getXlsxDefault());
}
try (FileOutputStream stream = new FileOutputStream("Report.xltx")) {
// Save .xltx file to stream
XlsxSaveOptions xlsxSaveOptions = new XlsxSaveOptions();
xlsxSaveOptions.setType(Optional.of(XlsxType.XLTX));
ef.save(stream, xlsxSaveOptions);
}
Constructor and Description |
---|
XlsxSaveOptions()
Initializes a new instance of the
XlsxSaveOptions class. |
Modifier and Type | Method and Description |
---|---|
String |
getContentType()
Gets the content-type for XLSX file format:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet if
getType() is XlsxType.XLSX ,
application/vnd.ms-excel.sheet.macroenabled.12 if getType() is XlsxType.XLSM ,
application/vnd.openxmlformats-officedocument.spreadsheetml.template if getType() is XlsxType.XLSX ,
application/vnd.ms-excel.template.macroenabled.12 if getType() is XlsxType.XLSM .
|
FileFormatLimitations |
getLimitations()
Gets limitations for saving to XLSX file format.
|
String |
getPassword()
Gets the password used to protect / encrypt the workbook.
|
Optional<XlsxType> |
getType()
Specifies type of generated file.
|
void |
setPassword(String password)
Sets the password used to protect / encrypt the workbook.
|
void |
setType(Optional<XlsxType> type)
Specifies type of generated file.
|
getCsvDefault, getHtmlDefault, getOdsDefault, getXlsDefault, getXlsxDefault
public XlsxSaveOptions()
XlsxSaveOptions
class.public String getContentType()
getType()
is XlsxType.XLSX
,getType()
is XlsxType.XLSM
,getType()
is XlsxType.XLSX
,getType()
is XlsxType.XLSM
.getContentType
in class SaveOptions
public FileFormatLimitations getLimitations()
getLimitations
in class SaveOptions
public String getPassword()
public void setPassword(String password)
© GemBox Ltd. — All rights reserved.