Re: doc to html

That function (doc.Save(htmlStream, SaveFormat.Html);) had Exception .
The error message:{“Resource file(s) cannot be written to disk. When saving the document to a stream either ResourceFolder should be specified or ExportEmbeddedImages, ExportEmbeddedFonts, ExportEmbeddedCss, and ExportEmbeddedSvg should be set or custom streams should be provided via ResourceSavingCallback.”}

Hi,

Thanks for your inquiry.

The problem occurs because you are saving to stream and resource file(s) cannot be written to disk. When saving the document to a stream either ResourceFolder should be specified or ExportEmbeddedImages, ExportEmbeddedFonts, ExportEmbeddedCss, and ExportEmbeddedSvg should be set or custom streams should be provided via ResourceSavingCallback. For example, please check the following code:

Document doc = new Document(MyDir + @"in.docx");
MemoryStream stream = new MemoryStream();
HtmlFixedSaveOptions so = new HtmlFixedSaveOptions();
so.ResourcesFolder = @"C:\Temp";
doc.Save(stream, so);

Best regards,

1 Like