Source code formatting when using SaveFormat.Html

When saving a Document, we save a copy as a Word Document, as well as save an HTML document.
code is simply:

document.save(@"c:\temp\test.html", SaveFormat.HTML);

The HTML this exports has everything on one line. While it renders and works correctly, it is almost impossible to read if opening up in a text editor. Another reason we would like to do this is so we can ‘diff’ two HTML files, and this also makes using the diff tool very hard.
Is there a way around this?
Jon

Hi

Thanks for your inquiry. You can use SaveOptions.ExportPrettyFormat option in this case:
https://reference.aspose.com/words/net/aspose.words.saving/saveoptions/prettyformat/
Just set this option to true before saving document to HTML.
Note: this option is available only in .NET version of Aspose.Words.
Best regards.

Hi Jon,
Aspose.Words for Java uses internally Sun’s StAX library to output XHTML. The library doesn’t support indentation – so Aspose.Words for Java doesn’t support pretty format save option for html and xml files.
So, I’m sorry but Aspose.Words for Java will not support indentation in the foreseeable future. As a good news: non-indented html has smaller size and performs little better.
As a workaround I can suggest any xml tool that can indent raw xml file (Aspose.Words outputs XHTML which conforms to XML syntax). I can recommend Altova DiffDog https://www.altova.com/diffdog and/or Stylus Studio http://www.stylusstudio.com/ .
Best Reagrds,

Im using .net, and it looks like this did what I needed. Thanks!

Sorry, I didn’t notice verbatim string in your code, I saw only method name in java-style:)
Regards,