ResourceFileUri
ResourceSavingArgs.ResourceFileUri property
Gets or sets the uniform resource identifier (URI) used to reference the resource file from the document.
public string ResourceFileUri { get; set; }
Remarks
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.
ResourcesFolder
ResourcesFolder
ResourcesFolderAlias
ResourcesFolderAlias
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 ResourceSavingArgs
- namespace Aspose.Words.Saving
- assembly Aspose.Words