public class DocumentPartSavingArgs
extends java.lang.Object
IDocumentPartSavingCallback.documentPartSaving(com.aspose.words.DocumentPartSavingArgs) callback.
To learn more, visit the Save a Document documentation article.
When Aspose.Words saves a document to HTML or related formats and HtmlSaveOptions.getDocumentSplitCriteria() / HtmlSaveOptions.setDocumentSplitCriteria(int) is specified, the document is split into parts and by default, each document part is saved into a separate file.
Class DocumentPartSavingArgs allows you to control how each document part will be saved. It allows to redefine how file names are generated or to completely circumvent saving of document parts into files by providing your own stream objects.
To save document parts into streams instead of files, use the P:Aspose.Words.Saving.DocumentPartSavingArgs.DocumentPartStream property.
| Modifier and Type | Method and Description |
|---|---|
Document |
getDocument()
Gets the document object that is being saved.
|
java.lang.String |
getDocumentPartFileName()
Gets the file name (without path) where the document part will be saved to.
|
java.io.OutputStream |
getDocumentPartStream() |
boolean |
getKeepDocumentPartStreamOpen()
Specifies whether Aspose.Words should keep the stream open or close it after saving a document part.
|
void |
setDocumentPartFileName(java.lang.String value)
Sets the file name (without path) where the document part will be saved to.
|
void |
setDocumentPartStream(java.io.OutputStream value) |
void |
setKeepDocumentPartStreamOpen(boolean value)
Specifies whether Aspose.Words should keep the stream open or close it after saving a document part.
|
public Document getDocument()
public java.lang.String getDocumentPartFileName()
This property allows you to redefine how the document part file names are generated during export to HTML or EPUB.
When the callback is invoked, this property contains the file name that was generated by Aspose.Words. You can change the value of this property to save the document part into a different file. Note that the file name for each part must be unique.
getDocumentPartFileName() / setDocumentPartFileName(java.lang.String) must contain only the file name without the path. Aspose.Words determines the path for saving using the document file name. If output document file name was not specified, for instance when saving to a stream, this file name is used only for referencing document parts. The same is true when saving to EPUB format.
public void setDocumentPartFileName(java.lang.String value)
throws java.lang.Exception
This property allows you to redefine how the document part file names are generated during export to HTML or EPUB.
When the callback is invoked, this property contains the file name that was generated by Aspose.Words. You can change the value of this property to save the document part into a different file. Note that the file name for each part must be unique.
getDocumentPartFileName() / setDocumentPartFileName(java.lang.String) must contain only the file name without the path. Aspose.Words determines the path for saving using the document file name. If output document file name was not specified, for instance when saving to a stream, this file name is used only for referencing document parts. The same is true when saving to EPUB format.
value - The file name (without path) where the document part will be saved to.java.lang.Exceptionpublic boolean getKeepDocumentPartStreamOpen()
Default is false and Aspose.Words will close the stream you provided in the P:Aspose.Words.Saving.DocumentPartSavingArgs.DocumentPartStream property after writing a document part into it. Specify true to keep the stream open. Please note that the main output stream provided in the call to M:Aspose.Words.Document.Save(System.IO.Stream,Aspose.Words.SaveFormat) or M:Aspose.Words.Document.Save(System.IO.Stream,Aspose.Words.Saving.SaveOptions) will never be closed by Aspose.Words even if getKeepDocumentPartStreamOpen() / setKeepDocumentPartStreamOpen(boolean) is set to false.
boolean value.public void setKeepDocumentPartStreamOpen(boolean value)
Default is false and Aspose.Words will close the stream you provided in the P:Aspose.Words.Saving.DocumentPartSavingArgs.DocumentPartStream property after writing a document part into it. Specify true to keep the stream open. Please note that the main output stream provided in the call to M:Aspose.Words.Document.Save(System.IO.Stream,Aspose.Words.SaveFormat) or M:Aspose.Words.Document.Save(System.IO.Stream,Aspose.Words.Saving.SaveOptions) will never be closed by Aspose.Words even if getKeepDocumentPartStreamOpen() / setKeepDocumentPartStreamOpen(boolean) is set to false.
value - The corresponding boolean value.public java.io.OutputStream getDocumentPartStream()
public void setDocumentPartStream(java.io.OutputStream value)