public class LoadOptions extends java.lang.Object implements ILoadOptions
Allows to specify additional options (such as format or default font) when loading a presentation.
| Constructor and Description |
|---|
LoadOptions()
Creates new default load options.
|
LoadOptions(int loadFormat)
Creates new load options.
|
| Modifier and Type | Method and Description |
|---|---|
IBlobManagementOptions |
getBlobManagementOptions()
Represents the options which can be used to manage Binary Large Objects (BLOBs) handling behavior,
such as using of temporary files or max BLOBs bytes in memory.
|
java.lang.String |
getDefaultAsianFont()
Returns or sets Asian font used in case source font is not found.
|
java.lang.String |
getDefaultRegularFont()
Returns or sets Regular font used in case source font is not found.
|
java.lang.String |
getDefaultSymbolFont()
Returns or sets Symbol font used in case source font is not found.
|
java.lang.String |
getDefaultTextLanguage()
Returns or sets the default language for presentation text.
|
boolean |
getDeleteEmbeddedBinaryObjects()
Determines if Aspose.Slides will delete all embedded binary objects while presentation loading.
|
IFontSources |
getDocumentLevelFontSources()
Specifies sources for external fonts to be used by the presentation.
|
IInterruptionToken |
getInterruptionToken()
The token to monitor for interruption requests.
|
int |
getLoadFormat()
Returns or sets format of a presentation to load.
|
boolean |
getOnlyLoadDocumentProperties()
This property makes sense, if presentation file is password protected.
|
java.lang.String |
getPassword()
Gets or sets the password.
|
IResourceLoadingCallback |
getResourceLoadingCallback()
Returns or sets callback interface which manages external resources loading.
|
ISpreadsheetOptions |
getSpreadsheetOptions()
Gets options for spreadsheets.
|
IWarningCallback |
getWarningCallback()
Returns or sets an object which receives warnings and decides whether loading
process will continue or will be aborted.
|
void |
setBlobManagementOptions(IBlobManagementOptions value)
Represents the options which can be used to manage Binary Large Objects (BLOBs) handling behavior,
such as using of temporary files or max BLOBs bytes in memory.
|
void |
setDefaultAsianFont(java.lang.String value)
Returns or sets Asian font used in case source font is not found.
|
void |
setDefaultRegularFont(java.lang.String value)
Returns or sets Regular font used in case source font is not found.
|
void |
setDefaultSymbolFont(java.lang.String value)
Returns or sets Symbol font used in case source font is not found.
|
void |
setDefaultTextLanguage(java.lang.String value)
Returns or sets the default language for presentation text.
|
void |
setDeleteEmbeddedBinaryObjects(boolean value)
Determines if Aspose.Slides will delete all embedded binary objects while presentation loading.
|
void |
setDocumentLevelFontSources(IFontSources value)
Specifies sources for external fonts to be used by the presentation.
|
void |
setInterruptionToken(IInterruptionToken value)
The token to monitor for interruption requests.
|
void |
setLoadFormat(int value)
Returns or sets format of a presentation to load.
|
void |
setOnlyLoadDocumentProperties(boolean value)
This property makes sense, if presentation file is password protected.
|
void |
setPassword(java.lang.String value)
Gets or sets the password.
|
void |
setResourceLoadingCallback(IResourceLoadingCallback value)
Returns or sets callback interface which manages external resources loading.
|
void |
setSpreadsheetOptions(ISpreadsheetOptions value)
Gets options for spreadsheets.
|
void |
setWarningCallback(IWarningCallback value)
Returns or sets an object which receives warnings and decides whether loading
process will continue or will be aborted.
|
public LoadOptions()
Creates new default load options.
public LoadOptions(int loadFormat)
Creates new load options.
loadFormat - Format of a presentation to load.public final int getLoadFormat()
Returns or sets format of a presentation to load.
Read/write LoadFormat.
getLoadFormat in interface ILoadOptionspublic final void setLoadFormat(int value)
Returns or sets format of a presentation to load.
Read/write LoadFormat.
setLoadFormat in interface ILoadOptionspublic final java.lang.String getDefaultRegularFont()
Returns or sets Regular font used in case source font is not found.
Read/write String.
The following example shows how to set default fonts for rendering PowerPoint Presentation.// Use load options to define the default regular and asian fonts LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto); loadOptions.setDefaultRegularFont("Wingdings"); loadOptions.setDefaultAsianFont("Wingdings"); // Load the presentation Presentation pres = new Presentation("DefaultFonts.pptx", loadOptions); try { // Generate slide thumbnail BufferedImage slideImage = pres.getSlides().get_Item(0).getThumbnail(1, 1); ImageIO.write(slideImage, "PNG", new File("output_out.png")); // Generate PDF pres.save("output_out.pdf", SaveFormat.Pdf); // Generate XPS pres.save("output_out.xps", SaveFormat.Xps); } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }
getDefaultRegularFont in interface ILoadOptionspublic final void setDefaultRegularFont(java.lang.String value)
Returns or sets Regular font used in case source font is not found.
Read/write String.
The following example shows how to set default fonts for rendering PowerPoint Presentation.// Use load options to define the default regular and asian fonts LoadOptions loadOptions = new LoadOptions(LoadFormat.Auto); loadOptions.setDefaultRegularFont("Wingdings"); loadOptions.setDefaultAsianFont("Wingdings"); // Load the presentation Presentation pres = new Presentation("DefaultFonts.pptx", loadOptions); try { // Generate slide thumbnail BufferedImage slideImage = pres.getSlides().get_Item(0).getThumbnail(1, 1); ImageIO.write(slideImage, "PNG", new File("output_out.png")); // Generate PDF pres.save("output_out.pdf", SaveFormat.Pdf); // Generate XPS pres.save("output_out.xps", SaveFormat.Xps); } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }
setDefaultRegularFont in interface ILoadOptionspublic final java.lang.String getDefaultSymbolFont()
Returns or sets Symbol font used in case source font is not found.
Read/write String.
getDefaultSymbolFont in interface ILoadOptionspublic final void setDefaultSymbolFont(java.lang.String value)
Returns or sets Symbol font used in case source font is not found.
Read/write String.
setDefaultSymbolFont in interface ILoadOptionspublic final java.lang.String getDefaultAsianFont()
Returns or sets Asian font used in case source font is not found.
Read/write String.
getDefaultAsianFont in interface ILoadOptionspublic final void setDefaultAsianFont(java.lang.String value)
Returns or sets Asian font used in case source font is not found.
Read/write String.
setDefaultAsianFont in interface ILoadOptionspublic final java.lang.String getPassword()
Gets or sets the password.
Read/write String.
Value: The password.The following sample code shows how to open password protected PowerPoint Presentation.LoadOptions loadOptions = new LoadOptions(); loadOptions.setPassword("YOUR_PASSWORD"); Presentation pres = new Presentation("pres.pptx", loadOptions); try { // work with decrypted presentation } finally { if (pres != null) pres.dispose(); }
getPassword in interface ILoadOptionspublic final void setPassword(java.lang.String value)
Gets or sets the password.
Read/write String.
Value: The password.The following sample code shows how to open password protected PowerPoint Presentation.LoadOptions loadOptions = new LoadOptions(); loadOptions.setPassword("YOUR_PASSWORD"); Presentation pres = new Presentation("pres.pptx", loadOptions); try { // work with decrypted presentation } finally { if (pres != null) pres.dispose(); }
setPassword in interface ILoadOptionspublic final boolean getOnlyLoadDocumentProperties()
This property makes sense, if presentation file is password protected.
Value of true means that only document properties must be loaded from an encrypted
presentation file and password must be ignored.
Value of false means that entire encrypted presentation must be loaded with use of right
password.
If presentation isn't encrypted then property value is always ignored.
If document properties of an encrypted file aren't public and property value is true then
document properties cannot be loaded and exception will be thrown.
Read/write boolean.
getOnlyLoadDocumentProperties in interface ILoadOptionspublic final void setOnlyLoadDocumentProperties(boolean value)
This property makes sense, if presentation file is password protected.
Value of true means that only document properties must be loaded from an encrypted
presentation file and password must be ignored.
Value of false means that entire encrypted presentation must be loaded with use of right
password.
If presentation isn't encrypted then property value is always ignored.
If document properties of an encrypted file aren't public and property value is true then
document properties cannot be loaded and exception will be thrown.
Read/write boolean.
setOnlyLoadDocumentProperties in interface ILoadOptionspublic final IWarningCallback getWarningCallback()
Returns or sets an object which receives warnings and decides whether loading
process will continue or will be aborted.
Read/write IWarningCallback.
getWarningCallback in interface ILoadOptionspublic final void setWarningCallback(IWarningCallback value)
Returns or sets an object which receives warnings and decides whether loading
process will continue or will be aborted.
Read/write IWarningCallback.
setWarningCallback in interface ILoadOptionspublic final IBlobManagementOptions getBlobManagementOptions()
Represents the options which can be used to manage Binary Large Objects (BLOBs) handling behavior, such as using of temporary files or max BLOBs bytes in memory. These options intended to set up the best performance/memory consumption ratio for a perticular environment or requirements.
getBlobManagementOptions in interface ILoadOptionspublic final void setBlobManagementOptions(IBlobManagementOptions value)
Represents the options which can be used to manage Binary Large Objects (BLOBs) handling behavior, such as using of temporary files or max BLOBs bytes in memory. These options intended to set up the best performance/memory consumption ratio for a perticular environment or requirements.
setBlobManagementOptions in interface ILoadOptionspublic final IFontSources getDocumentLevelFontSources()
Specifies sources for external fonts to be used by the presentation. These fonts are available to the presentation throughout its lifetime and are not shared with other presentations
The following example shows how to specify custom fonts used with PowerPoint Presentation.byte[] memoryFont1 = Files.readAllBytes(Paths.get("customfonts\\CustomFont1.ttf")); byte[] memoryFont2 = Files.readAllBytes(Paths.get("customfonts\\CustomFont2.ttf")); LoadOptions loadOptions = new LoadOptions(); loadOptions.getDocumentLevelFontSources().setFontFolders(new String[] { "assets\\fonts", "global\\fonts" }); loadOptions.getDocumentLevelFontSources().setMemoryFonts(new byte[][] { memoryFont1, memoryFont2 }); IPresentation presentation = new Presentation("MyPresentation.pptx", loadOptions); try { //work with the presentation //CustomFont1, CustomFont2 as well as fonts from assets\fonts & global\fonts folders and their subfolders are available to the presentation } finally { if (presentation != null) presentation.dispose(); }
getDocumentLevelFontSources in interface ILoadOptionspublic final void setDocumentLevelFontSources(IFontSources value)
Specifies sources for external fonts to be used by the presentation. These fonts are available to the presentation throughout its lifetime and are not shared with other presentations
The following example shows how to specify custom fonts used with PowerPoint Presentation.byte[] memoryFont1 = Files.readAllBytes(Paths.get("customfonts\\CustomFont1.ttf")); byte[] memoryFont2 = Files.readAllBytes(Paths.get("customfonts\\CustomFont2.ttf")); LoadOptions loadOptions = new LoadOptions(); loadOptions.getDocumentLevelFontSources().setFontFolders(new String[] { "assets\\fonts", "global\\fonts" }); loadOptions.getDocumentLevelFontSources().setMemoryFonts(new byte[][] { memoryFont1, memoryFont2 }); IPresentation presentation = new Presentation("MyPresentation.pptx", loadOptions); try { //work with the presentation //CustomFont1, CustomFont2 as well as fonts from assets\fonts & global\fonts folders and their subfolders are available to the presentation } finally { if (presentation != null) presentation.dispose(); }
setDocumentLevelFontSources in interface ILoadOptionspublic final IInterruptionToken getInterruptionToken()
The token to monitor for interruption requests.
IPresentation instance lifetime. Any long-running operation, such as loading
or saving of presentation, will be interrupted via calling of the InterruptionTokenSource.interrupt() method of
the InterruptionTokenSource.
getInterruptionToken in interface ILoadOptionspublic final void setInterruptionToken(IInterruptionToken value)
The token to monitor for interruption requests.
IPresentation instance lifetime. Any long-running operation, such as loading
or saving of presentation, will be interrupted via calling of the InterruptionTokenSource.interrupt() method of
the InterruptionTokenSource.
setInterruptionToken in interface ILoadOptionspublic final IResourceLoadingCallback getResourceLoadingCallback()
Returns or sets callback interface which manages external resources loading.
Read/write IResourceLoadingCallback.
getResourceLoadingCallback in interface ILoadOptionspublic final void setResourceLoadingCallback(IResourceLoadingCallback value)
Returns or sets callback interface which manages external resources loading.
Read/write IResourceLoadingCallback.
setResourceLoadingCallback in interface ILoadOptionspublic final ISpreadsheetOptions getSpreadsheetOptions()
Gets options for spreadsheets. For example, these options affect calculating formulas for charts.
getSpreadsheetOptions in interface ILoadOptionspublic final void setSpreadsheetOptions(ISpreadsheetOptions value)
Gets options for spreadsheets. For example, these options affect calculating formulas for charts.
setSpreadsheetOptions in interface ILoadOptionspublic final java.lang.String getDefaultTextLanguage()
Returns or sets the default language for presentation text.
Read/write String.
Example:// Use load options to define the default text culture LoadOptions loadOptions = new LoadOptions(); loadOptions.setDefaultTextLanguage("en-US"); Presentation pres = new Presentation(loadOptions); try { // Add new rectangle shape with text IAutoShape shp = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 150, 50); shp.getTextFrame().setText("New Text"); // Check the first portion language System.out.println(shp.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getLanguageId()); } finally { if (pres != null) pres.dispose(); }
getDefaultTextLanguage in interface ILoadOptionspublic final void setDefaultTextLanguage(java.lang.String value)
Returns or sets the default language for presentation text.
Read/write String.
Example:// Use load options to define the default text culture LoadOptions loadOptions = new LoadOptions(); loadOptions.setDefaultTextLanguage("en-US"); Presentation pres = new Presentation(loadOptions); try { // Add new rectangle shape with text IAutoShape shp = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 50, 50, 150, 50); shp.getTextFrame().setText("New Text"); // Check the first portion language System.out.println(shp.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getLanguageId()); } finally { if (pres != null) pres.dispose(); }
setDefaultTextLanguage in interface ILoadOptionspublic final boolean getDeleteEmbeddedBinaryObjects()
Determines if Aspose.Slides will delete all embedded binary objects while presentation loading.
The types of the embedded binary objects:
Read/writeboolean.
The following example shows how to load the presentation without any embedded binary objects.LoadOptions loadOptions = new LoadOptions(); loadOptions.setDeleteEmbeddedBinaryObjects(true); Presentation pres = new Presentation("pres.ppt", loadOptions); try { pres.save("output_WithoutBinaryObjects.ppt", SaveFormat.Ppt); } finally { if (pres != null) pres.dispose(); }
<b>false</b>.
getDeleteEmbeddedBinaryObjects in interface ILoadOptionspublic final void setDeleteEmbeddedBinaryObjects(boolean value)
Determines if Aspose.Slides will delete all embedded binary objects while presentation loading.
The types of the embedded binary objects:
Read/writeboolean.
The following example shows how to load the presentation without any embedded binary objects.LoadOptions loadOptions = new LoadOptions(); loadOptions.setDeleteEmbeddedBinaryObjects(true); Presentation pres = new Presentation("pres.ppt", loadOptions); try { pres.save("output_WithoutBinaryObjects.ppt", SaveFormat.Ppt); } finally { if (pres != null) pres.dispose(); }
<b>false</b>.
setDeleteEmbeddedBinaryObjects in interface ILoadOptionsCopyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.