Help with Style XML
Posted: Mon Jan 14, 2008 4:39 am
Hello,
I'm writing some software in java to merge styles from one document to another however can't seem to get the import of styles to work at all. I have tried using the XDocumentHandler to import the style xml elements from office:document-styles on down but no luck. Here is how I setup the importers ( I tried XMLImporter and XMLStylesImporter). Do I need and external xsl to accomplish this?
Object xmlImporter = xRemoteServiceManager.createInstanceWithContext(
"com.sun.star.comp.Writer.XMLImporter", xRemoteContext);
Object xmlStylesImporter = xRemoteServiceManager.createInstanceWithContext(
"com.sun.star.comp.Writer.XMLStylesImporter", xRemoteContext);
// get the interface of xmlexportfilter service
XImporter xImporter = (XImporter)UnoRuntime.queryInterface(XImporter.class, xmlImporter);
//XDocumentHandler xDocumentHandler =
// (XDocumentHandler)UnoRuntime.queryInterface(XDocumentHandler.class, xmlImporter);
XDocumentHandler xStyleHandler =
(XDocumentHandler)UnoRuntime.queryInterface(XDocumentHandler.class, xmlStylesImporter);
xImporter.setTargetDocument(newDoc);
Any help would be appreciated?
I'm writing some software in java to merge styles from one document to another however can't seem to get the import of styles to work at all. I have tried using the XDocumentHandler to import the style xml elements from office:document-styles on down but no luck. Here is how I setup the importers ( I tried XMLImporter and XMLStylesImporter). Do I need and external xsl to accomplish this?
Object xmlImporter = xRemoteServiceManager.createInstanceWithContext(
"com.sun.star.comp.Writer.XMLImporter", xRemoteContext);
Object xmlStylesImporter = xRemoteServiceManager.createInstanceWithContext(
"com.sun.star.comp.Writer.XMLStylesImporter", xRemoteContext);
// get the interface of xmlexportfilter service
XImporter xImporter = (XImporter)UnoRuntime.queryInterface(XImporter.class, xmlImporter);
//XDocumentHandler xDocumentHandler =
// (XDocumentHandler)UnoRuntime.queryInterface(XDocumentHandler.class, xmlImporter);
XDocumentHandler xStyleHandler =
(XDocumentHandler)UnoRuntime.queryInterface(XDocumentHandler.class, xmlStylesImporter);
xImporter.setTargetDocument(newDoc);
Any help would be appreciated?