@Override protected void commit() throws IOException { if (ctSettings == null) { throw new IllegalStateException("Unable to write out settings that were never read in!"); } XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTSettings.type.getName().getNamespaceURI(), "settings")); PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); ctSettings.save(out, xmlOptions); out.close(); }
@Override protected void onDocumentRead() throws IOException { super.onDocumentRead(); readFrom(getPackagePart().getInputStream()); }
@Override protected void commit() throws IOException { if (ctSettings == null) { throw new IllegalStateException("Unable to write out settings that were never read in!"); } XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTSettings.type.getName().getNamespaceURI(), "settings")); PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); ctSettings.save(out, xmlOptions); out.close(); }
@Override protected void commit() throws IOException { if (ctSettings == null) { throw new IllegalStateException("Unable to write out settings that were never read in!"); } XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTSettings.type.getName().getNamespaceURI(), "settings")); Map<String, String> map = new HashMap<String, String>(); map.put("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w"); xmlOptions.setSaveSuggestedPrefixes(map); PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); ctSettings.save(out, xmlOptions); out.close(); }
@Override protected void onDocumentRead() throws IOException { super.onDocumentRead(); readFrom(getPackagePart().getInputStream()); }
@Override protected void onDocumentRead() throws IOException { super.onDocumentRead(); readFrom(getPackagePart().getInputStream()); }
private static CTSettings getCTSettings( XWPFDocument document ) { XWPFSettings settings = getSettings( document ); if ( settings != null ) { try { InputStream inputStream = settings.getPackagePart().getInputStream(); return SettingsDocument.Factory.parse( inputStream ).getSettings(); } catch ( Exception e ) { } } return null; }
private static CTSettings getCTSettings( XWPFDocument document ) { XWPFSettings settings = getSettings( document ); if ( settings != null ) { try { InputStream inputStream = settings.getPackagePart().getInputStream(); return SettingsDocument.Factory.parse( inputStream ).getSettings(); } catch ( Exception e ) { } } return null; }