Free Support Forum -

HtmlExportImagesFolderAlias creates a prefix '/'

I use HtmlExportImagesFolderAlias to specify the image url when saving a document to html format. One thing I noticed is that the url generated is like,

HtmlExportImagesFolderAlias + ‘/’ + UniqueImageFileName

Instead of

HtmlExportImagesFolderAlias + UniqueImageFileName

Is there a way to remove the ‘/’? In my case, I use UniqueImageFileName as a query string parameter instead of a path. So I don’t need ‘/’.


Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I think you can remove folder alias with HTML post processing. For example see the following code.

//Open source document

Document doc = new Document(@"Test085\in.doc");

doc.SaveOptions.ExportPrettyFormat = true;

//Specify the folder where the images will be saved

doc.SaveOptions.ExportImagesFolder = @"Test085\";

//Specify folder alias

doc.SaveOptions.HtmlExportImagesFolderAlias = "img";

//Save document as HTML into memory stream

MemoryStream htmlStream = new MemoryStream();

doc.Save(htmlStream, SaveFormat.Html);

//Het html string

string html = Encoding.UTF8.GetString(htmlStream.GetBuffer());

//Remove alias

html = html.Replace("src=\"img\\", "src=\"");

//Save processed HTML into the file

Stream file = new FileStream(@"Test085\out.html", FileMode.Create);

StreamWriter writer = new StreamWriter(file);




Hope this helps.

Best regards.