Hi There,
I’m unable to get the DocumentPartSaving callback to be invoked. Here’s a simple code:
public class HTMLDocumentFormatting : IDocumentPartSavingCallback
{
public void DocumentPartSaving(DocumentPartSavingArgs args)
{
Document doc = args.Document;
}
}
public partial class FormEditor
{
public string CreateHTMLFile(Document doc, string tmpFile)
{
string htmlFile = Path.GetDirectoryName(tmpFile) + "\"" + Path.GetFileNameWithoutExtension(tmpFile) + ".html";
HtmlSaveOptions htmlOptions = new HtmlSaveOptions(SaveFormat.Html);
htmlOptions.ExportRoundtripInformation = true;
htmlOptions.ExportTocPageNumbers = false;
htmlOptions.ExportDocumentProperties = true;
htmlOptions.ExportPageSetup = true;
htmlOptions.PrettyFormat = true;
htmlOptions.ExportListLabels = ExportListLabels.AsInlineText;
htmlOptions.DocumentPartSavingCallback = new HTMLDocumentFormatting();
htmlOptions.CssStyleSheetType = CssStyleSheetType.Inline;
htmlOptions.ExportImagesAsBase64 = true;
doc.Save(htmlFile, htmlOptions);
return htmlFile;
}
}
While I was able to get a similar example for CssSaving to work, I can’t seem get the code of DocumentPartSaving to be invoked while saving. The original document is a big one containing 42 pages document with multiple sections etc.
What am I doing wrong?
Thanks,
Itzik