public interface IImageSavingCallback
Example:
public void saveHtmlExportImages() throws Exception
{
Document doc = new Document(getMyDir() + "Document.doc");
// Create and pass the object which implements the handler methods.
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
options.setImageSavingCallback(new HandleImageSaving());
doc.save(getMyDir() + "Document.SaveWithCustomImagesExport Out.html", options);
}
public class HandleImageSaving implements IImageSavingCallback
{
public void imageSaving(ImageSavingArgs e) throws Exception
{
// Change any images in the document being exported with the extension of "jpeg" to "jpg".
if (e.getImageFileName().endsWith(".jpeg"))
e.setImageFileName(e.getImageFileName().replace(".jpeg", ".jpg"));
}
}
Method Summary | ||
---|---|---|
abstract void | imageSaving(ImageSavingArgs args) | |
Called when Aspose.Words saves an image to HTML. |
Method Detail |
---|
imageSaving | |
public abstract void imageSaving(ImageSavingArgs args) throws java.lang.Exception |
Example:
Shows how to define custom logic for controlling how images are saved when exporting to HTML based formats.public void saveHtmlExportImages() throws Exception { Document doc = new Document(getMyDir() + "Document.doc"); // Create and pass the object which implements the handler methods. HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML); options.setImageSavingCallback(new HandleImageSaving()); doc.save(getMyDir() + "Document.SaveWithCustomImagesExport Out.html", options); } public class HandleImageSaving implements IImageSavingCallback { public void imageSaving(ImageSavingArgs e) throws Exception { // Change any images in the document being exported with the extension of "jpeg" to "jpg". if (e.getImageFileName().endsWith(".jpeg")) e.setImageFileName(e.getImageFileName().replace(".jpeg", ".jpg")); } }