public final class EditableDocument extends Object implements IAuxDisposable
Intermediate document, that contains content before and after editing
Modifier and Type | Field and Description |
---|---|
com.aspose.ms.lang.Event<com.aspose.ms.System.EventHandler> |
Disposed |
Constructor and Description |
---|
EditableDocument(byte initialDocumentType,
com.groupdocs.editor.htmlcss.html.HtmlDom origin) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this Editable document instance, disposing its content and
making its methods and properties non-working
|
static EditableDocument |
fromBodyMarkupAndResourceFolder(String htmlBodyContent,
String resourceFolderPath)
Static factory, that creates an instance of EditableDocument from a
specified HTML markup, that doesn't contain an HTML header, but only
inner markup of HTML BODY element, and from resources, located in the
folder, specified by the full path
|
static EditableDocument |
fromFile(String htmlFilePath,
String resourceFolderPath)
Static factory, that creates an instance of EditableDocument from a HTML
file, that is specified by a path to the *.html file itself and a folder
with linked resources
|
static EditableDocument |
fromMarkup(String newHtmlContent,
List<IHtmlResource> resources)
Static factory, that creates an instance of EditableDocument from
specified HTML markup and a set of corresponding linked resources
|
List<IHtmlResource> |
getAllResources()
Returns a list of all existing resources: all stylesheets, images from
HTML and all stylesheets, fonts
|
com.aspose.ms.System.Collections.Generic.List<IHtmlResource> |
getAllResourcesInternal() |
String |
getBodyContent()
Returns a body of the HTML document (content between opening and closing
BODY tags without these tags) as a string.
|
String |
getBodyContent(String externalImagesPrefix)
Returns a body of the HTML document (content between opening and closing
BODY tags without these tags) as a string, where links to the external
resources contain specified prefix.
|
String |
getContent()
Returns overall content of the HTML document as a string.
|
String |
getContent(String externalImagesPrefix,
String externalCssPrefix)
Returns overall content of the HTML document as a string, where links to
the external resources contain specified prefix.
|
List<CssText> |
getCss()
Returns a list of CSS resources
|
List<String> |
getCssContent()
Returns content of all external stylesheets as a list of strings, where
one string represents one stylesheet.
|
List<String> |
getCssContent(String externalImagesPrefix,
String externalFontsPrefix)
Returns content of all external stylesheets as a list of strings, where
one string represents one stylesheet.
|
com.aspose.ms.System.Collections.Generic.List<String> |
getCssContentInternal() |
com.aspose.ms.System.Collections.Generic.List<String> |
getCssContentInternal(String externalImagesPrefix,
String externalFontsPrefix) |
com.aspose.ms.System.Collections.Generic.List<CssText> |
getCssInternal() |
String |
getEmbeddedHtml()
Returns all content of this HTML document with all related resources in a
form of a single string, where all resources are embedded inside the HTML
markup in a base64-encoded form.
|
List<FontResourceBase> |
getFonts()
Allows to obtain external font resources, which are used by this HTML
document
|
com.aspose.ms.System.Collections.Generic.List<FontResourceBase> |
getFontsInternal() |
List<IImageResource> |
getImages()
Allows to obtain external image resources (raster images), which are used
by this HTML document
|
com.aspose.ms.System.Collections.Generic.List<IImageResource> |
getImagesInternal() |
com.groupdocs.editor.htmlcss.html.HtmlDom |
getOrigin()
Returns an original HTML DOM instance
|
byte |
getOriginatingType()
Returns an originating type of this EditableDocument
|
boolean |
isDisposed()
Determines whether this Editable document was already disposed (true) or
not (false)
|
void |
save(String htmlFilePath)
Saves this HTML document to the file on specified path, where HTML markup
will be stored, and to the accompanying folder with resources.
|
void |
save(String htmlFilePath,
String resourcesFolderPath)
Saves this HTML document to the file on specified path, where HTML markup
will be stored, and to the accompanying folder with resources, which is
located on specified path.
|
public final com.aspose.ms.lang.Event<com.aspose.ms.System.EventHandler> Disposed
public EditableDocument(byte initialDocumentType, com.groupdocs.editor.htmlcss.html.HtmlDom origin)
public final void dispose()
Disposes this Editable document instance, disposing its content and making its methods and properties non-working
dispose
in interface com.aspose.ms.System.IDisposable
public static EditableDocument fromBodyMarkupAndResourceFolder(String htmlBodyContent, String resourceFolderPath)
Static factory, that creates an instance of EditableDocument from a specified HTML markup, that doesn't contain an HTML header, but only inner markup of HTML BODY element, and from resources, located in the folder, specified by the full path
htmlBodyContent
- String, that contains raw HTML markup, which is
located inside HTML->BODY element (without BODY itself), that should be
parsed. Cannot be NULL, empty or invalid.resourceFolderPath
- Mandatory path to the folder with resources.
All stylesheets, which are located in this folder, will be used.
<i>into</i>
the HTML-editor there is
a getBodyContent()
method. And, in counterpart, for obtaining HTML
markup <i>from</i>
HTML-editor this method exists. First string
parameter obtains an inner content of HTML->BODY element, while 2nd
parameter — resourceFolderPath
— is a full path to the existing
folder, that contains all HTML resources, used by HTML markup.
GroupDocs.Editor will scan this folder and include all valid *.css files
as stylesheets for the document.public static EditableDocument fromFile(String htmlFilePath, String resourceFolderPath)
Static factory, that creates an instance of EditableDocument from a HTML file, that is specified by a path to the *.html file itself and a folder with linked resources
htmlFilePath
- String, that contains a full path to the HTML file.
Cannot be null, should be valid file path, and file itself should exists.resourceFolderPath
- Optional path to the folder with HTML
resources. If NULL, invalid or such folder doesn't exist, Editor will try
to find the this folder by itself, analyzing the HTML markuppublic static EditableDocument fromMarkup(String newHtmlContent, List<IHtmlResource> resources)
Static factory, that creates an instance of EditableDocument from specified HTML markup and a set of corresponding linked resources
newHtmlContent
- String, that contains raw HTML markup, that should
be parsed. Cannot be NULL, empty or invalid.resources
- Collection of all resources (images, stylesheets,
fonts), that are used in the HTML-document, specified in
newHtmlContent
parameter. May be absent (NULL or empty
collection).public final List<IHtmlResource> getAllResources()
Returns a list of all existing resources: all stylesheets, images from HTML and all stylesheets, fonts
public com.aspose.ms.System.Collections.Generic.List<IHtmlResource> getAllResourcesInternal()
public final String getBodyContent()
Returns a body of the HTML document (content between opening and closing BODY tags without these tags) as a string.
public final String getBodyContent(String externalImagesPrefix)
Returns a body of the HTML document (content between opening and closing BODY tags without these tags) as a string, where links to the external resources contain specified prefix.
externalImagesPrefix
- Through this parameter used can specify a
prefix, which will be added to the links to all external images in IMG
elements, which will be present in the resultant HTML string. If NULL or
empty, prefixes will not be added.
public final String getContent()
Returns overall content of the HTML document as a string.
public final String getContent(String externalImagesPrefix, String externalCssPrefix)
Returns overall content of the HTML document as a string, where links to the external resources contain specified prefix.
externalImagesPrefix
- Through this parameter used can specify a
prefix, which will be added to the links to all external images in IMG
elements, which will be present in the resultant HTML string. If NULL or
empty, prefixes will not be added.externalCssPrefix
- Through this parameter used can specify a
prefix, which will be added to the links to all external stylesheets in
LINK elements, which will be present in the resultant HTML string. If
NULL or empty, prefixes will not be added.public final List<String> getCssContent()
Returns content of all external stylesheets as a list of strings, where one string represents one stylesheet. Returns empty list, if there is no CSS for this document.
public final List<String> getCssContent(String externalImagesPrefix, String externalFontsPrefix)
Returns content of all external stylesheets as a list of strings, where one string represents one stylesheet. Specified prefix will be applied to every link to the external resource in every resultant stylesheet. Returns empty list, if there is no CSS for this document.
externalImagesPrefix
- Through this parameter used can specify a
prefix, which will be added to the links to all external images, which
will be present in CSS declarations in the resultant CSS strings. If NULL
or empty, prefixes will not be added.externalFontsPrefix
- Through this parameter used can specify a
prefix, which will be added to the links to all external fonts in thepublic com.aspose.ms.System.Collections.Generic.List<String> getCssContentInternal()
public com.aspose.ms.System.Collections.Generic.List<String> getCssContentInternal(String externalImagesPrefix, String externalFontsPrefix)
public com.aspose.ms.System.Collections.Generic.List<CssText> getCssInternal()
public final String getEmbeddedHtml()
Returns all content of this HTML document with all related resources in a form of a single string, where all resources are embedded inside the HTML markup in a base64-encoded form.
com.aspose.ms.System.ObjectDisposedException
- This EditableDocument instance was
already disposed
public final List<FontResourceBase> getFonts()
Allows to obtain external font resources, which are used by this HTML document
public com.aspose.ms.System.Collections.Generic.List<FontResourceBase> getFontsInternal()
public final List<IImageResource> getImages()
Allows to obtain external image resources (raster images), which are used by this HTML document
public com.aspose.ms.System.Collections.Generic.List<IImageResource> getImagesInternal()
public final com.groupdocs.editor.htmlcss.html.HtmlDom getOrigin()
Returns an original HTML DOM instance
public final byte getOriginatingType()
Returns an originating type of this EditableDocument
public final boolean isDisposed()
Determines whether this Editable document was already disposed (true) or not (false)
isDisposed
in interface IAuxDisposable
public final void save(String htmlFilePath)
Saves this HTML document to the file on specified path, where HTML markup will be stored, and to the accompanying folder with resources.
htmlFilePath
- Full path to the file, where HTML markup will be
stored. File will be created or overwritten, if exists. Accompanying
resource folder will be created in the same folder, where HTML file
exist.public final void save(String htmlFilePath, String resourcesFolderPath)
Saves this HTML document to the file on specified path, where HTML markup will be stored, and to the accompanying folder with resources, which is located on specified path.
htmlFilePath
- Full path to the file, where HTML markup will be
stored. Cannot be NULL or empty. File will be created or overwritten, if
exists.resourcesFolderPath
- Full path to the accompanying folder, where
all related resources will be stored. If NULL or empty, folder will be
created automatically in the same directory, where *.html file. If
specified and not exists, will be created.