Triger reformatting
Posted: Mon Dec 03, 2018 8:47 pm
When document is opened in Author mode, until it is modified no XML formatting takes place. Can I somehow force this via code and reformat several files in bulk?
I am able to open files via my plugin class implementing AuthorOperation:
As I couldn't find any formatting trigger, I am trying inserting and removing XML fragment to zero position. But this approach fails (Premature end of file).
Any idea?
I am able to open files via my plugin class implementing AuthorOperation:
As I couldn't find any formatting trigger, I am trying inserting and removing XML fragment to zero position. But this approach fails (Premature end of file).
Code: Select all
Reader reader = new InputStreamReader(new FileInputStream(processedFile), "UTF-8");
authorAccess.getEditorAccess().reloadContent(reader);
// inserting and removing content
authorAccess.getDocumentController().insertXMLFragment("<?pi?>", 0); --> Error: Premature end of file.
authorAccess.getDocumentController().delete(0, 6);