Changeset 176 for trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java
- Timestamp:
- 03/11/08 10:00:49 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java
r172 r176 253 253 javax.xml.transform.Transformer xformer = template.newTransformer(); 254 254 255 log.error(xformer.getClass().getName() ); 255 if (!xformer.getClass().getName().equals("org.apache.xalan.transformer.TransformerImpl")) { 256 log.error("Detected " + xformer.getClass().getName() 257 + ", but require org.apache.xalan.transformer.TransformerImpl. " + 258 "Ensure Xalan 2.7.0 is on your classpath!" ); 259 } 256 260 // com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl won't work 257 261 // with our extension function. 258 262 259 // Handle fonts - this is platform specific 260 // Algorithm - to be implemented: 263 264 // 3. Ensure that the font names in the XHTML have been mapped to these matches 265 // possibly via an extension function in the XSLT 266 if (fontSubstituter==null) { 267 setFontSubstituter(); 268 } 269 xformer.setParameter("substituterInstance", fontSubstituter); 270 xformer.setParameter("fontFamilyStack", fontFamilyStack); 271 272 273 //DEBUGGING 274 // use the identity transform if you want to send wordDocument; 275 // otherwise you'll get the XHTML 276 //javax.xml.transform.Transformer xformer = tfactory.newTransformer(); 277 278 xformer.transform(domSource, result); 279 280 log.info("wordDocument transformed to xhtml .."); 281 282 } 283 284 public void setFontSubstituter() throws Exception { 285 261 286 // 1. Get a list of all the fonts in the document 262 287 java.util.Map fontsInUse = this.getMainDocumentPart().fontsInUse(); … … 275 300 276 301 fonts = (org.docx4j.wml.Fonts)fontTablePart.getJaxbElement(); 277 fontSubstituter.populateFontMappings(fontsInUse, fonts); 278 279 // 3. Ensure that the font names in the XHTML have been mapped to these matches 280 // possibly via an extension function in the XSLT 281 xformer.setParameter("substituterInstance", fontSubstituter); 282 xformer.setParameter("fontFamilyStack", fontFamilyStack); 283 284 285 //DEBUGGING 286 // use the identity transform if you want to send wordDocument; 287 // otherwise you'll get the XHTML 288 //javax.xml.transform.Transformer xformer = tfactory.newTransformer(); 289 290 xformer.transform(domSource, result); 291 292 log.info("wordDocument transformed to xhtml .."); 302 fontSubstituter.populateFontMappings(fontsInUse, fonts); 293 303 294 304 }
Note: See TracChangeset
for help on using the changeset viewer.
