public final class HtmlSaveOptions extends SaveOptions
Constructor and Description |
---|
HtmlSaveOptions()
Initializes a new instance of the
HtmlSaveOptions class. |
Modifier and Type | Method and Description |
---|---|
Charset |
getCharset()
Gets the charset for the Html file.
|
String |
getContentType()
Gets the content-type for HTML file format:
message/rfc822 if
getHtmlType() is HtmlType.MHTML , otherwise
"text/html; charset=" + getCharset() .name().
|
String |
getFilesDirectoryPath()
Gets the physical directory where
ExcelPicture s and ExcelWorksheet s files will be saved. |
String |
getFilesDirectorySrcPath()
Gets the relative directory that will be used when referencing
ExcelPicture s and ExcelWorksheet s files in the HTML. |
HtmlType |
getHtmlType()
Gets the type of export.
|
FileFormatLimitations |
getLimitations()
Gets limitations for saving to HTML file format.
|
SelectionType |
getSelectionType()
Gets a value indicating whether to save the whole
ExcelFile or just active worksheet . |
boolean |
isEmbedImages()
Gets a value indicating whether images are embedded directly within the HTML file in form of Base64 encoding.
|
boolean |
isWriteCellAddress()
Gets a value indicating whether each td HTML element should contain data-cell attribute with cell address for this cell.
|
void |
setCharset(Charset charset)
Sets the charset for the Html file.
|
void |
setEmbedImages(boolean embedImages)
Sets a value indicating whether images are embedded directly within the HTML file in form of Base64 encoding.
|
void |
setFilesDirectoryPath(String value)
Sets the physical directory where
ExcelPicture s and ExcelWorksheet s files will be saved. |
void |
setFilesDirectorySrcPath(String path)
Sets the relative directory that will be used when referencing
ExcelPicture s and ExcelWorksheet s files in the HTML. |
void |
setHtmlType(HtmlType htmlType)
Sets the type of export.
|
void |
setSelectionType(SelectionType value)
Sets a value indicating whether to save the whole
ExcelFile or just active worksheet . |
void |
setWriteCellAddress(boolean writeCellAddress)
Sets a value indicating whether each td HTML element should contain data-cell attribute with cell address for this cell.
|
getCsvDefault, getHtmlDefault, getOdsDefault, getXlsDefault, getXlsxDefault
public HtmlSaveOptions()
HtmlSaveOptions
class.public Charset getCharset()
public String getContentType()
getHtmlType()
is HtmlType.MHTML
, otherwisegetCharset()
.name().getContentType
in class SaveOptions
public String getFilesDirectoryPath()
ExcelPicture
s and ExcelWorksheet
s files will be saved.ExcelPicture
s and ExcelWorksheet
s files will be saved.public String getFilesDirectorySrcPath()
ExcelPicture
s and ExcelWorksheet
s files in the HTML.ExcelPicture
s and ExcelWorksheet
s files in the HTML.public HtmlType getHtmlType()
For HtmlType.HTML
and HtmlType.HTML_TABLE
values, pictures will be exported only if ExcelFile.save(String)
or ExcelFile.save(String, SaveOptions)
overload is used or if getFilesDirectoryPath()
is specified or if isEmbedImages()
is set to true
.
For HtmlType.MHTML
value, pictures are always exported.
HtmlType
value for type of export.public FileFormatLimitations getLimitations()
These are the limits:
Integer.MAX_VALUE
Integer.MAX_VALUE
Integer.MAX_VALUE
Integer.MAX_VALUE
getLimitations
in class SaveOptions
public SelectionType getSelectionType()
ExcelFile
or just active worksheet
.public boolean isEmbedImages()
If the value is true
then each image element will contain raw image data in its source attribute.
This value doesn't change the pictures export behavior when using HtmlType.MHTML
.
public boolean isWriteCellAddress()
If the value is true
then each td HTML element will contain data-cell attribute with cell address for this cell (for example data-cell="A1").
public void setCharset(Charset charset)
NullPointerException
- Value is set to null
.public void setEmbedImages(boolean embedImages)
If the value is true
then each image element will contain raw image data in its source attribute.
This value doesn't change the pictures export behavior when using HtmlType.MHTML
.
public void setFilesDirectoryPath(String value)
ExcelPicture
s and ExcelWorksheet
s files will be saved.
If value is null
or empty string and HTML export is called with ExcelFile.save(String)
or ExcelFile.save(String, SaveOptions)
overload,
value will be automatically set to htmlFileNameWithoutExtension + "_files".
This directory will be created in the same location as HTML file.
value
- The physical directory where ExcelPicture
s and ExcelWorksheet
s files will be saved.public void setFilesDirectorySrcPath(String path)
ExcelPicture
s and ExcelWorksheet
s files in the HTML.
If value is null
or empty string and HTML export is called with ExcelFile.save(String)
or ExcelFile.save(String, SaveOptions)
overload,
value will be automatically set to htmlFileNameWithoutExtension + "_files".
Following code demonstrates how to export Excel file to HTML with specifying location where images will be saved.
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.setFilesDirectorySrcPath("Art/Images");
ef.save("Data.html", htmlSaveOptions);
path
- The relative directory that will be used when referencing ExcelPicture
s and ExcelWorksheet
s files in the HTML.public void setHtmlType(HtmlType htmlType)
For HtmlType.HTML
and HtmlType.HTML_TABLE
values, pictures will be exported only if ExcelFile.save(String)
or ExcelFile.save(String, SaveOptions)
overload is used or if getFilesDirectoryPath()
is specified or if isEmbedImages()
is set to true
.
For HtmlType.MHTML
value, pictures are always exported.
htmlType
- The HtmlType
value for type of export.public void setSelectionType(SelectionType value)
ExcelFile
or just active worksheet
.public void setWriteCellAddress(boolean writeCellAddress)
If the value is true
then each td HTML element will contain data-cell attribute with cell address for this cell (for example data-cell="A1").
© GemBox d.o.o. — All rights reserved.