We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com


When i save doc file as a html file Images was taking own path…? How can i fix this problem

Hi there,

Thanks for your inquiry. Please use HtmlSaveOptions.ImagesFolder property to specify the physical folder where images are saved when exporting a document to HTML format.

You may use HtmlSaveOptions.ResourceFolder property to specify a physical folder where all resources like images, fonts, and external CSS are saved when a document is exported to HTML.

Please check the members of HtmlSaveOptions class and following code examples. Hope this helps you.

Document doc = new Document(MyDir + "in.doc");
// This is the directory we want the exported images to be saved to.
string imagesDir = Path.Combine(MyDir, "Images");
// The folder specified needs to exist and should be empty.
if (Directory.Exists(imagesDir))
    Directory.Delete(imagesDir, true);
// Set an option to export form fields as plain text, not as HTML input elements.
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html);
options.ExportTextInputFormFieldAsText = true;
options.ImagesFolder = imagesDir;
doc.Save(MyDir + "Out.html", options);
Document doc = new Document(MyDir + "Test.docx");
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.CssStyleSheetType = CssStyleSheetType.External;
saveOptions.ExportFontResources = true;
saveOptions.ResourceFolder = @"C:\Resources";
doc.Save(MyDir + "Out.html", saveOptions);