public class ResourceSavingArgs
extends java.lang.Object
IResourceSavingCallback.resourceSaving(com.aspose.words.ResourceSavingArgs) event.
To learn more, visit the Save a Document documentation article.
By default, when Aspose.Words saves a document to fixed page HTML or SVG, it saves each resource into a separate file. Aspose.Words uses the document file name and a unique number to generate unique file name for each resource found in the document.
ResourceSavingArgs allows to redefine how resource file names are generated or to completely circumvent saving of resources into files by providing your own stream objects.
To apply your own logic for generating resource file names use the getResourceFileName() / setResourceFileName(java.lang.String) property.
To save resources into streams instead of files, use the P:Aspose.Words.Saving.ResourceSavingArgs.ResourceStream property.
| Modifier and Type | Method and Description |
|---|---|
Document |
getDocument()
Gets the document object that is currently being saved.
|
boolean |
getKeepResourceStreamOpen()
Specifies whether Aspose.Words should keep the stream open or close it after saving a resource.
|
java.lang.String |
getResourceFileName()
Gets the file name (without path) where the resource will be saved to.
|
java.lang.String |
getResourceFileUri()
Gets the uniform resource identifier (URI) used to reference the resource file from the document.
|
java.io.OutputStream |
getResourceStream() |
void |
setKeepResourceStreamOpen(boolean value)
Specifies whether Aspose.Words should keep the stream open or close it after saving a resource.
|
void |
setResourceFileName(java.lang.String value)
Sets the file name (without path) where the resource will be saved to.
|
void |
setResourceFileUri(java.lang.String value)
Sets the uniform resource identifier (URI) used to reference the resource file from the document.
|
void |
setResourceStream(java.io.OutputStream value) |
public Document getDocument()
public java.lang.String getResourceFileName()
This property allows you to redefine how the resource file names are generated during export to fixed page HTML or SVG.
When the event is fired, this property contains the file name that was generated by Aspose.Words. You can change the value of this property to save the resource into a different file. Note that file names must be unique.
Aspose.Words automatically generates a unique file name for every resource when exporting to fixed page HTML or SVG format. How the resource file name is generated depends on whether you save the document to a file or to a stream.
When saving a document to a file, the generated resource file name looks like
When saving a document to a stream, the generated resource file name looks like Aspose.Words.
getResourceFileName() / setResourceFileName(java.lang.String) must contain only the file name without the path. Aspose.Words determines the path for saving and the value of the src attribute for writing to fixed page HTML or SVG using the document file name, the HtmlFixedSaveOptions.getResourcesFolder() / HtmlFixedSaveOptions.setResourcesFolder(java.lang.String) or SvgSaveOptions.getResourcesFolder() / SvgSaveOptions.setResourcesFolder(java.lang.String) and HtmlFixedSaveOptions.getResourcesFolderAlias() / HtmlFixedSaveOptions.setResourcesFolderAlias(java.lang.String) or SvgSaveOptions.getResourcesFolderAlias() / SvgSaveOptions.setResourcesFolderAlias(java.lang.String) properties.
HtmlFixedSaveOptions.getResourcesFolder() / HtmlFixedSaveOptions.setResourcesFolder(java.lang.String) SvgSaveOptions.getResourcesFolder() / SvgSaveOptions.setResourcesFolder(java.lang.String) HtmlFixedSaveOptions.getResourcesFolderAlias() / HtmlFixedSaveOptions.setResourcesFolderAlias(java.lang.String) SvgSaveOptions.getResourcesFolderAlias() / SvgSaveOptions.setResourcesFolderAlias(java.lang.String)public void setResourceFileName(java.lang.String value)
throws java.lang.Exception
This property allows you to redefine how the resource file names are generated during export to fixed page HTML or SVG.
When the event is fired, this property contains the file name that was generated by Aspose.Words. You can change the value of this property to save the resource into a different file. Note that file names must be unique.
Aspose.Words automatically generates a unique file name for every resource when exporting to fixed page HTML or SVG format. How the resource file name is generated depends on whether you save the document to a file or to a stream.
When saving a document to a file, the generated resource file name looks like
When saving a document to a stream, the generated resource file name looks like Aspose.Words.
getResourceFileName() / setResourceFileName(java.lang.String) must contain only the file name without the path. Aspose.Words determines the path for saving and the value of the src attribute for writing to fixed page HTML or SVG using the document file name, the HtmlFixedSaveOptions.getResourcesFolder() / HtmlFixedSaveOptions.setResourcesFolder(java.lang.String) or SvgSaveOptions.getResourcesFolder() / SvgSaveOptions.setResourcesFolder(java.lang.String) and HtmlFixedSaveOptions.getResourcesFolderAlias() / HtmlFixedSaveOptions.setResourcesFolderAlias(java.lang.String) or SvgSaveOptions.getResourcesFolderAlias() / SvgSaveOptions.setResourcesFolderAlias(java.lang.String) properties.
HtmlFixedSaveOptions.getResourcesFolder() / HtmlFixedSaveOptions.setResourcesFolder(java.lang.String) SvgSaveOptions.getResourcesFolder() / SvgSaveOptions.setResourcesFolder(java.lang.String) HtmlFixedSaveOptions.getResourcesFolderAlias() / HtmlFixedSaveOptions.setResourcesFolderAlias(java.lang.String) SvgSaveOptions.getResourcesFolderAlias() / SvgSaveOptions.setResourcesFolderAlias(java.lang.String)value - The file name (without path) where the resource will be saved to.java.lang.Exceptionpublic java.lang.String getResourceFileUri()
This property allows you to change URIs of resource files exported to fixed page HTML or SVG documents.
Aspose.Words automatically generates an URI for every resource file during export to fixed page HTML or SVG format. The generated URIs reference resource files saved by Aspose.Words. However, the URIs can be incorrect if resource files are to be moved to other location or if resource files are saved to streams. This property allows to correct URIs in these cases.
When the event is fired, this property contains the URI that was generated by Aspose.Words. You can change the value of this property to provide a custom URI for the resource file.
HtmlFixedSaveOptions.getResourcesFolder() / HtmlFixedSaveOptions.setResourcesFolder(java.lang.String) SvgSaveOptions.getResourcesFolder() / SvgSaveOptions.setResourcesFolder(java.lang.String) HtmlFixedSaveOptions.getResourcesFolderAlias() / HtmlFixedSaveOptions.setResourcesFolderAlias(java.lang.String) SvgSaveOptions.getResourcesFolderAlias() / SvgSaveOptions.setResourcesFolderAlias(java.lang.String)public void setResourceFileUri(java.lang.String value)
This property allows you to change URIs of resource files exported to fixed page HTML or SVG documents.
Aspose.Words automatically generates an URI for every resource file during export to fixed page HTML or SVG format. The generated URIs reference resource files saved by Aspose.Words. However, the URIs can be incorrect if resource files are to be moved to other location or if resource files are saved to streams. This property allows to correct URIs in these cases.
When the event is fired, this property contains the URI that was generated by Aspose.Words. You can change the value of this property to provide a custom URI for the resource file.
HtmlFixedSaveOptions.getResourcesFolder() / HtmlFixedSaveOptions.setResourcesFolder(java.lang.String) SvgSaveOptions.getResourcesFolder() / SvgSaveOptions.setResourcesFolder(java.lang.String) HtmlFixedSaveOptions.getResourcesFolderAlias() / HtmlFixedSaveOptions.setResourcesFolderAlias(java.lang.String) SvgSaveOptions.getResourcesFolderAlias() / SvgSaveOptions.setResourcesFolderAlias(java.lang.String)value - The uniform resource identifier (URI) used to reference the resource file from the document.public boolean getKeepResourceStreamOpen()
Default is false and Aspose.Words will close the stream you provided in the P:Aspose.Words.Saving.ResourceSavingArgs.ResourceStream property after writing a resource into it. Specify true to keep the stream open.
boolean value.public void setKeepResourceStreamOpen(boolean value)
Default is false and Aspose.Words will close the stream you provided in the P:Aspose.Words.Saving.ResourceSavingArgs.ResourceStream property after writing a resource into it. Specify true to keep the stream open.
value - The corresponding boolean value.public java.io.OutputStream getResourceStream()
public void setResourceStream(java.io.OutputStream value)