GroupDocs.Editor for Java API enables document editing in form of HTML. API supports multiple document formats and can be integrated with any external, opensource or paid HTML editor. Editor API will process to load documents, convert it to HTML, provide HTML to external UI and then save HTML to original document after manipulation. It can also be used to generate different Microsoft Word, Excel spreadsheets, PowerPoint files, OpenDocument formats, XML and TXT documents.
Using GroupDocs.Editor for Java allows you to build applications in Java that load a document of supported file format to convert it into HTML Document Object Model (DOM) along with its associated elements, e.g., CSS. Furthermore, our Editor Java API allows you to edit the HTML in any of the popular HTML Editors. After your required modifications are done, GroupDocs.Editor for Java helps you to convert this resultant HTML back to its original file format.
// Create Editor class by loading an input document
Editor editor = new Editor("Sample.docx");
// Open document for edit and obtain EditableDocument
EditableDocument original = editor.edit();
// Obtain all-embedded HTML from it
String allEmbeddedInside = original.getEmbeddedHtml();
// If necessary, obtain pure HTML-markup, CSS, images and other resources in separate form
// Whole HTML-markup, without any resources
String completeHtmlMarkup = original.getContent();
// Only HTML->BODY content, useful for most of WYSIWYG-editors
String onlyInnerBody = original.getBodyContent();
// All CSS stylesheets
List<CssText> stylesheets = original.getCss();
// All images, including raster and vector, but without CSS gradients
List<IImageResource> images = original.getImages();
// All font resources
List<FontResourceBase> fonts = original.getFonts();
// finally, send this content to your WYSIWYG HTML-editor
GroupDocs.Editor for Java API enables you to fetch the associated elements from documents of supported formats, such as images, CSS, fonts & more. Then you can load these fetched associated elements, traverse them and save them separately from the final HTML file, and have a well-managed output.