insertFragment in AuthorMode is pretty

Post here questions and problems related to oXygen frameworks/document types.
andygraham
Posts: 2

insertFragment in AuthorMode is pretty

Fri Sep 23, 2016 9:43 pm

Hi

I have a plugin which constructs a string containing XML with everything on one line. I insert it into a document using the following method:

AuthorDocumentFragment fragment = documentController.createNewDocumentFragmentInContext( xmlString, selection);
documentController.insertFragment(selection, fragment);

In Author mode everything looks fine but when I switch to text mode the inserted fragment is pretty printed while the rest of the document is not. I would like the fragment to appear in the document the way I created it in the string - all on the same line.

Any ideas?

Thanks
Andy
alex_jitianu
Posts: 603

Re: insertFragment in AuthorMode is pretty

Tue Sep 27, 2016 9:22 am

Hi Andy,

When the Author page serializes its content, it automatically applies some pretty print rules. These rules can be controlled from the Author Preferences page. Once you arrive on this page, focus on the Compatibility with other tools section. if you select Do not break lines, do not indent, the entire document will be on one line. If this is more than you desire, then you can try going on the Format Preferences page and add a few elements in the Preserve space list. The contents of these elements are not formatted and will be serialized on one line.

Best regards,
Alex

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 1 guest