Document
Contents
[
Hide
]ResourceSavingArgs.Document property
Gets the document object that is currently being saved.
public Document Document { get; }
Examples
Shows how to use a callback to track external resources created while converting a document to HTML.
public void ResourceSavingCallback()
{
Document doc = new Document(MyDir + "Bullet points with alternative font.docx");
FontSavingCallback callback = new FontSavingCallback();
HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions
{
ResourceSavingCallback = callback
};
doc.Save(ArtifactsDir + "HtmlFixedSaveOptions.UsingMachineFonts.html", saveOptions);
Console.WriteLine(callback.GetText());
}
private class FontSavingCallback : IResourceSavingCallback
{
/// <summary>
/// Called when Aspose.Words saves an external resource to fixed page HTML or SVG.
/// </summary>
public void ResourceSaving(ResourceSavingArgs args)
{
mText.AppendLine($"Original document URI:\t{args.Document.OriginalFileName}");
mText.AppendLine($"Resource being saved:\t{args.ResourceFileName}");
mText.AppendLine($"Full uri after saving:\t{args.ResourceFileUri}\n");
}
public string GetText()
{
return mText.ToString();
}
private readonly StringBuilder mText = new StringBuilder();
}
See Also
- class Document
- class ResourceSavingArgs
- namespace Aspose.Words.Saving
- assembly Aspose.Words