Changeset 1708


Ignore:
Timestamp:
11/13/11 10:02:47 (6 months ago)
Author:
jharrop
Message:

Support for b, u, i (via css); support for <br/>; very rudimentary support for lists.

Location:
trunk/docx4j/src
Files:
5 added
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/convert/in/css/Importer.java

    r1706 r1708  
    33import java.io.File; 
    44import java.io.IOException; 
     5import java.math.BigInteger; 
    56import java.util.ArrayList; 
    67import java.util.HashMap; 
     
    1617import org.docx4j.model.properties.run.AbstractRunProperty; 
    1718import org.docx4j.openpackaging.packages.WordprocessingMLPackage; 
     19import org.docx4j.openpackaging.parts.WordprocessingML.NumberingDefinitionsPart; 
    1820import org.docx4j.openpackaging.parts.relationships.Namespaces; 
    1921import org.docx4j.openpackaging.parts.relationships.RelationshipsPart; 
     
    3032import org.docx4j.org.xhtmlrenderer.render.InlineBox; 
    3133import org.docx4j.relationships.Relationships; 
     34import org.docx4j.wml.Numbering; 
    3235import org.docx4j.wml.P; 
    3336import org.docx4j.wml.PPr; 
     
    3639import org.docx4j.wml.Text; 
    3740import org.docx4j.wml.P.Hyperlink; 
     41import org.docx4j.wml.PPrBase.NumPr; 
     42import org.docx4j.wml.PPrBase.NumPr.Ilvl; 
     43import org.docx4j.wml.PPrBase.NumPr.NumId; 
    3844import org.w3c.dom.Element; 
    3945import org.w3c.dom.css.CSSValue; 
     
    181187                        }                        
    182188                    } else { 
     189                         
     190                        // Avoid creating paragraphs for html, body 
     191                        if (imports.size()>0 && paraStillEmpty) { 
     192                                    imports.remove( imports.size()-1);                                                   
     193                        }  
     194                         
    183195                            currentP = Context.getWmlObjectFactory().createP(); 
    184196                            imports.add(currentP); 
     
    186198                             
    187199                            // Paragraph level styling 
    188                             if (e!=null) { 
    189                                     currentP.setPPr( 
    190                                                 addParagraphProperties( cssMap )); 
     200                            currentP.setPPr( 
     201                                        addParagraphProperties( cssMap )); 
     202                             
     203                            if (e.getNodeName().equals("li")) { 
     204                                 
     205                                log.info( cssMap.get("list-style-type" )   ); 
     206                                 
     207                                // TODO: code to generate appropriate numbering on first use, and store it in map 
     208                                // Then we can just fetch it. 
     209 
     210                                    paraStillEmpty = false; 
     211                                     
     212                                    // Create and add <w:numPr> 
     213                                    NumPr numPr =  Context.getWmlObjectFactory().createPPrBaseNumPr(); 
     214                                    currentP.getPPr().setNumPr(numPr); 
     215 
     216                                    // The <w:numId> element 
     217                                    NumId numIdElement = Context.getWmlObjectFactory().createPPrBaseNumPrNumId(); 
     218                                    numPr.setNumId(numIdElement); 
     219                                    numIdElement.setVal(BigInteger.valueOf(1)); 
     220                                     
     221                                    // The <w:ilvl> element 
     222                                    Ilvl ilvlElement = Context.getWmlObjectFactory().createPPrBaseNumPrIlvl(); 
     223                                    numPr.setIlvl(ilvlElement); 
     224                                    ilvlElement.setVal(BigInteger.valueOf(0)); 
     225                                         
     226                                    // TMP: don't let this override our numbering 
     227                                    currentP.getPPr().setInd(null); 
     228                                     
    191229                            } 
     230                             
    192231                    } 
    193232                } 
     
    201240                case BlockBox.CONTENT_INLINE: 
    202241                    if ( ((BlockBox)box).getInlineContent()!=null) { 
     242                         
    203243                        for (Object o : ((BlockBox)box).getInlineContent() ) { 
    204244//                            log.info("        " + o.getClass().getName() );  
     
    207247//                                    && ((InlineBox)o).isStartsHere()) { 
    208248                                 
    209                                 // Doesn't extend box 
    210                                 Styleable s = ((InlineBox)o); 
    211                                  
    212                                 boolean isHyperlink = false; 
    213                                  
    214                                 String debug = ""; 
    215                                 if (s==null) { 
    216                                     debug = "NULL InlineBox"; // how can this happen? 
    217                                 } else { 
    218                                     if (s.getElement()!=null) { 
    219                                         debug = indents + "    " + "<" + s.getElement().getNodeName(); 
    220                                          
    221                                         if (s.getElement().getNodeName().equals("a")) { 
    222                                                 log.info("Ha!  found a hyperlink. "); 
    223                                                 isHyperlink = true; 
    224                                         } 
    225                                         if (s.getElement().getNodeName().equals("p")) { 
    226                                                 // This seems to be the usual case. Odd? 
    227                                                 log.debug("p in inline"); 
    228                                             Map<String, CSSValue> cssMap = getCascadedProperties(s.getStyle()); 
    229                                                 currentP = Context.getWmlObjectFactory().createP();                                              
    230                                                 if (paraStillEmpty) { 
    231                                                         // Replace it 
    232                                                     imports.remove( imports.size()-1);                                                   
    233                                                 }  
    234                                                     imports.add(currentP); 
    235                                                     paraStillEmpty = true; 
    236                                                     currentP.setPPr( 
    237                                                                 addParagraphProperties( cssMap )); 
    238  
    239                                         }                                         
    240                                     } 
    241                                     if (s.getStyle()!=null) { 
    242                                         debug +=  " " + s.getStyle().toStringMine(); 
    243                                     } 
    244                                 } 
    245                                  
    246                                  
    247                                 log.info(debug ); 
    248                                 //log.info("'" + ((InlineBox)o).getTextNode().getTextContent() );  // don't use .getText() 
    249                                 if (((InlineBox)o).getTextNode()==null) { 
    250                                         log.info("InlineBox has no TextNode, so skipping" ); 
    251                                 } else  { 
    252                                     log.info( ((InlineBox)o).getTextNode().getTextContent() );  // don't use .getText() 
    253  
    254                                     String theText = ((InlineBox)o).getTextNode().getTextContent();  
    255                                      
    256                                             paraStillEmpty = false;                                     
    257                                      
    258                                     if (isHyperlink) { 
    259                                          
    260                                         Hyperlink h = createHyperlink( 
    261                                                         s.getElement().getAttribute("href"),  
    262                                                         "Hyperlink", theText, rp);                                       
    263                                             currentP.getContent().add(h); 
    264                                          
    265                                     } else { // usual case 
    266                                      
    267                                             R run = Context.getWmlObjectFactory().createR(); 
    268                                             Text text = Context.getWmlObjectFactory().createText(); 
    269                                             text.setValue( theText ); 
    270                                             if (theText.startsWith(" ") 
    271                                                         || theText.endsWith(" ") ) { 
    272                                                 text.setSpace("preserve"); 
    273                                             } 
    274                                             run.getContent().add(text); 
    275                                              
    276                                             currentP.getContent().add(run); 
    277                                              
    278                                             // Run level styling 
    279                                             if (s.getStyle()!=null) { // shouldn't happen 
    280                                                 Map<String, CSSValue> cssMap = getCascadedProperties(s.getStyle());                                      
    281         //                                          Map cssMap = styleReference.getCascadedPropertiesMap(s.getElement()); 
    282                                                     run.setRPr( 
    283                                                                 addRunProperties( cssMap )); 
    284                                             }  
    285         //                                    else { 
    286         //                                      // Get it from the parent element eg p 
    287         //                                          //Map cssMap = styleReference.getCascadedPropertiesMap(e); 
    288         //                                          run.setRPr( 
    289         //                                                      addRunProperties( cssMap ));                                                                                     
    290         //                                    } 
    291                                     } 
    292                                 } 
    293                                  
     249                                processInlineBox( (InlineBox)o, indents); 
     250                                 
    294251                            } else if (o instanceof BlockBox ) { 
    295252                                traverse((Box)o, indents + "    "); // commenting out gets rid of unwanted extra parent elements 
    296253                            } else { 
    297                                 // log.info("What to do with " + box.getClass().getName() );                         
     254                                log.info("What to do with " + box.getClass().getName() );                         
    298255                            } 
    299256                        } 
     
    308265    } 
    309266 
    310     PPr addParagraphProperties(Map cssMap) { 
     267    private void processInlineBox( InlineBox inlineBox, String indents) { 
     268 
     269        // Doesn't extend box 
     270        Styleable s = ((InlineBox)inlineBox ); 
     271        if (s.getStyle()==null) { // Assume this won't happen 
     272                log.error("getStyle returned null!"); 
     273        } 
     274        Map<String, CSSValue> cssMap = getCascadedProperties(s.getStyle()); 
     275//        Map cssMap = styleReference.getCascadedPropertiesMap(s.getElement()); 
     276                 
     277        boolean isHyperlink = false; 
     278         
     279        String debug = "<UNKNOWN Styleable"; 
     280        if (s.getElement()!=null) { 
     281            debug = indents + "    " + "<" + s.getElement().getNodeName(); 
     282             
     283            if (s.getElement().getNodeName().equals("a")) { 
     284                log.info("Ha!  found a hyperlink. "); 
     285                isHyperlink = true; 
     286            } else if (s.getElement().getNodeName().equals("p")) { 
     287                // This seems to be the usual case. Odd? 
     288                log.debug("p in inline"); 
     289                        currentP = Context.getWmlObjectFactory().createP();                                              
     290                if (paraStillEmpty) { 
     291                        // Replace it 
     292                            imports.remove( imports.size()-1);                                                   
     293                }  
     294                    imports.add(currentP); 
     295                    paraStillEmpty = true; 
     296                    currentP.setPPr( 
     297                                addParagraphProperties( cssMap )); 
     298            }                
     299        } 
     300        if (s.getStyle()!=null) { 
     301            debug +=  " " + s.getStyle().toStringMine(); 
     302        } 
     303         
     304         
     305        log.info(debug ); 
     306        //log.info("'" + ((InlineBox)o).getTextNode().getTextContent() );  // don't use .getText() 
     307         
     308         
     309        if (inlineBox.getTextNode()==null) { 
     310            if (isHyperlink) { // eg <a href="http://slashdot.org/" /> ie empty 
     311                 
     312                Hyperlink h = createHyperlink( 
     313                                s.getElement().getAttribute("href"),  
     314                                "Hyperlink",  
     315                                s.getElement().getAttribute("href"), rp);                                        
     316                currentP.getContent().add(h); 
     317                 
     318            } else if (s.getElement().getNodeName().equals("br") ) { 
     319                 
     320                R run = Context.getWmlObjectFactory().createR(); 
     321                currentP.getContent().add(run);                 
     322                        run.getContent().add(Context.getWmlObjectFactory().createBr()); 
     323                 
     324            } else { 
     325                log.info("InlineBox has no TextNode, so skipping" ); 
     326            } 
     327        } else  { 
     328            log.info( inlineBox.getTextNode().getTextContent() );  // don't use .getText() 
     329 
     330            String theText = inlineBox.getTextNode().getTextContent();  
     331            log.info("Processing " + theText); 
     332             
     333            paraStillEmpty = false;                                     
     334             
     335            if (isHyperlink) { 
     336                 
     337                Hyperlink h = createHyperlink( 
     338                                s.getElement().getAttribute("href"),  
     339                                "Hyperlink", theText, rp);                                       
     340                currentP.getContent().add(h); 
     341                 
     342            } else { // usual case 
     343             
     344                R run = Context.getWmlObjectFactory().createR(); 
     345                Text text = Context.getWmlObjectFactory().createText(); 
     346                text.setValue( theText ); 
     347                if (theText.startsWith(" ") 
     348                                || theText.endsWith(" ") ) { 
     349                        text.setSpace("preserve"); 
     350                } 
     351                run.getContent().add(text); 
     352                 
     353                currentP.getContent().add(run); 
     354                 
     355                // Run level styling 
     356                    run.setRPr( 
     357                                addRunProperties( cssMap )); 
     358                     
     359//                                    else { 
     360//                                      // Get it from the parent element eg p 
     361//                                          //Map cssMap = styleReference.getCascadedPropertiesMap(e); 
     362//                                          run.setRPr( 
     363//                                                      addRunProperties( cssMap ));                                                                                     
     364//                                    } 
     365            } 
     366        } 
     367    } 
     368     
     369    private PPr addParagraphProperties(Map cssMap) { 
    311370 
    312371        PPr pPr =  Context.getWmlObjectFactory().createPPr(); 
     
    407466//      File f = new File(System.getProperty("user.dir") + "/demos/browser/xhtml/hamlet-shortest.xhtml"); 
    408467//      File f = new File(System.getProperty("user.dir") + "/input.html"); 
    409         File f = new File(System.getProperty("user.dir") + "/src/test/resources/html/inheritance.html"); 
    410              
    411                 WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();                 
    412                 wordMLPackage.getMainDocumentPart().getContent().addAll( convert(f, null) ); 
     468//        File f = new File(System.getProperty("user.dir") + "/src/test/resources/xhtml/inheritance.html"); 
     469        File f = new File(System.getProperty("user.dir") + "/src/test/resources/xhtml/extjs-cleaned-omitDepr.xhtml"); 
     470             
     471                WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); 
     472                 
     473                NumberingDefinitionsPart ndp = new NumberingDefinitionsPart(); 
     474                wordMLPackage.getMainDocumentPart().addTargetPart(ndp); 
     475                ndp.setJaxbElement( (Numbering) XmlUtils.unmarshalString(initialNumbering) );            
     476                 
     477                wordMLPackage.getMainDocumentPart().getContent().addAll(  
     478                                convert(f, wordMLPackage.getMainDocumentPart().getRelationshipsPart() ) ); 
     479                 
     480                System.out.println( 
     481                                XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true)); 
    413482                 
    414483                wordMLPackage.save(new java.io.File(System.getProperty("user.dir") + "/html_output.docx") ); 
    415484       
    416485  } 
     486 
     487        static final String initialNumbering = "<w:numbering xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\">" 
     488          +"<w:abstractNum w:abstractNumId=\"0\">" 
     489            +"<w:nsid w:val=\"16892FB7\"/>" 
     490            +"<w:multiLevelType w:val=\"hybridMultilevel\"/>" 
     491            +"<w:tmpl w:val=\"5A4EB96A\"/>" 
     492            +"<w:lvl w:ilvl=\"0\" w:tplc=\"0C090001\">" 
     493              +"<w:start w:val=\"1\"/>" 
     494              +"<w:numFmt w:val=\"bullet\"/>" 
     495              +"<w:lvlText w:val=\"\"/>" 
     496              +"<w:lvlJc w:val=\"left\"/>" 
     497              +"<w:pPr>" 
     498                +"<w:ind w:left=\"720\" w:hanging=\"360\"/>" 
     499              +"</w:pPr>" 
     500              +"<w:rPr>" 
     501                +"<w:rFonts w:ascii=\"Symbol\" w:hAnsi=\"Symbol\" w:hint=\"default\"/>" 
     502              +"</w:rPr>" 
     503            +"</w:lvl>" 
     504            +"<w:lvl w:ilvl=\"1\" w:tplc=\"0C090003\" w:tentative=\"1\">" 
     505              +"<w:start w:val=\"1\"/>" 
     506              +"<w:numFmt w:val=\"bullet\"/>" 
     507              +"<w:lvlText w:val=\"o\"/>" 
     508              +"<w:lvlJc w:val=\"left\"/>" 
     509              +"<w:pPr>" 
     510                +"<w:ind w:left=\"1440\" w:hanging=\"360\"/>" 
     511              +"</w:pPr>" 
     512              +"<w:rPr>" 
     513                +"<w:rFonts w:ascii=\"Courier New\" w:hAnsi=\"Courier New\" w:cs=\"Courier New\" w:hint=\"default\"/>" 
     514              +"</w:rPr>" 
     515            +"</w:lvl>" 
     516            +"<w:lvl w:ilvl=\"2\" w:tplc=\"0C090005\" w:tentative=\"1\">" 
     517              +"<w:start w:val=\"1\"/>" 
     518              +"<w:numFmt w:val=\"bullet\"/>" 
     519              +"<w:lvlText w:val=\"\"/>" 
     520              +"<w:lvlJc w:val=\"left\"/>" 
     521              +"<w:pPr>" 
     522                +"<w:ind w:left=\"2160\" w:hanging=\"360\"/>" 
     523              +"</w:pPr>" 
     524              +"<w:rPr>" 
     525                +"<w:rFonts w:ascii=\"Wingdings\" w:hAnsi=\"Wingdings\" w:hint=\"default\"/>" 
     526              +"</w:rPr>" 
     527            +"</w:lvl>" 
     528            +"<w:lvl w:ilvl=\"3\" w:tplc=\"0C090001\" w:tentative=\"1\">" 
     529              +"<w:start w:val=\"1\"/>" 
     530              +"<w:numFmt w:val=\"bullet\"/>" 
     531              +"<w:lvlText w:val=\"\"/>" 
     532              +"<w:lvlJc w:val=\"left\"/>" 
     533              +"<w:pPr>" 
     534                +"<w:ind w:left=\"2880\" w:hanging=\"360\"/>" 
     535              +"</w:pPr>" 
     536              +"<w:rPr>" 
     537                +"<w:rFonts w:ascii=\"Symbol\" w:hAnsi=\"Symbol\" w:hint=\"default\"/>" 
     538              +"</w:rPr>" 
     539            +"</w:lvl>" 
     540            +"<w:lvl w:ilvl=\"4\" w:tplc=\"0C090003\" w:tentative=\"1\">" 
     541              +"<w:start w:val=\"1\"/>" 
     542              +"<w:numFmt w:val=\"bullet\"/>" 
     543              +"<w:lvlText w:val=\"o\"/>" 
     544              +"<w:lvlJc w:val=\"left\"/>" 
     545              +"<w:pPr>" 
     546                +"<w:ind w:left=\"3600\" w:hanging=\"360\"/>" 
     547              +"</w:pPr>" 
     548              +"<w:rPr>" 
     549                +"<w:rFonts w:ascii=\"Courier New\" w:hAnsi=\"Courier New\" w:cs=\"Courier New\" w:hint=\"default\"/>" 
     550              +"</w:rPr>" 
     551            +"</w:lvl>" 
     552            +"<w:lvl w:ilvl=\"5\" w:tplc=\"0C090005\" w:tentative=\"1\">" 
     553              +"<w:start w:val=\"1\"/>" 
     554              +"<w:numFmt w:val=\"bullet\"/>" 
     555              +"<w:lvlText w:val=\"\"/>" 
     556              +"<w:lvlJc w:val=\"left\"/>" 
     557              +"<w:pPr>" 
     558                +"<w:ind w:left=\"4320\" w:hanging=\"360\"/>" 
     559              +"</w:pPr>" 
     560              +"<w:rPr>" 
     561                +"<w:rFonts w:ascii=\"Wingdings\" w:hAnsi=\"Wingdings\" w:hint=\"default\"/>" 
     562              +"</w:rPr>" 
     563            +"</w:lvl>" 
     564            +"<w:lvl w:ilvl=\"6\" w:tplc=\"0C090001\" w:tentative=\"1\">" 
     565              +"<w:start w:val=\"1\"/>" 
     566              +"<w:numFmt w:val=\"bullet\"/>" 
     567              +"<w:lvlText w:val=\"\"/>" 
     568              +"<w:lvlJc w:val=\"left\"/>" 
     569              +"<w:pPr>" 
     570                +"<w:ind w:left=\"5040\" w:hanging=\"360\"/>" 
     571              +"</w:pPr>" 
     572              +"<w:rPr>" 
     573                +"<w:rFonts w:ascii=\"Symbol\" w:hAnsi=\"Symbol\" w:hint=\"default\"/>" 
     574              +"</w:rPr>" 
     575            +"</w:lvl>" 
     576            +"<w:lvl w:ilvl=\"7\" w:tplc=\"0C090003\" w:tentative=\"1\">" 
     577              +"<w:start w:val=\"1\"/>" 
     578              +"<w:numFmt w:val=\"bullet\"/>" 
     579              +"<w:lvlText w:val=\"o\"/>" 
     580              +"<w:lvlJc w:val=\"left\"/>" 
     581              +"<w:pPr>" 
     582                +"<w:ind w:left=\"5760\" w:hanging=\"360\"/>" 
     583              +"</w:pPr>" 
     584              +"<w:rPr>" 
     585                +"<w:rFonts w:ascii=\"Courier New\" w:hAnsi=\"Courier New\" w:cs=\"Courier New\" w:hint=\"default\"/>" 
     586              +"</w:rPr>" 
     587            +"</w:lvl>" 
     588            +"<w:lvl w:ilvl=\"8\" w:tplc=\"0C090005\" w:tentative=\"1\">" 
     589              +"<w:start w:val=\"1\"/>" 
     590              +"<w:numFmt w:val=\"bullet\"/>" 
     591              +"<w:lvlText w:val=\"\"/>" 
     592              +"<w:lvlJc w:val=\"left\"/>" 
     593              +"<w:pPr>" 
     594                +"<w:ind w:left=\"6480\" w:hanging=\"360\"/>" 
     595              +"</w:pPr>" 
     596              +"<w:rPr>" 
     597                +"<w:rFonts w:ascii=\"Wingdings\" w:hAnsi=\"Wingdings\" w:hint=\"default\"/>" 
     598              +"</w:rPr>" 
     599            +"</w:lvl>" 
     600          +"</w:abstractNum>" 
     601          +"<w:abstractNum w:abstractNumId=\"1\">" 
     602            +"<w:nsid w:val=\"7E706046\"/>" 
     603            +"<w:multiLevelType w:val=\"hybridMultilevel\"/>" 
     604            +"<w:tmpl w:val=\"336E8F2C\"/>" 
     605            +"<w:lvl w:ilvl=\"0\" w:tplc=\"0C09000F\">" 
     606              +"<w:start w:val=\"1\"/>" 
     607              +"<w:numFmt w:val=\"decimal\"/>" 
     608              +"<w:lvlText w:val=\"%1.\"/>" 
     609              +"<w:lvlJc w:val=\"left\"/>" 
     610              +"<w:pPr>" 
     611                +"<w:ind w:left=\"720\" w:hanging=\"360\"/>" 
     612              +"</w:pPr>" 
     613            +"</w:lvl>" 
     614            +"<w:lvl w:ilvl=\"1\" w:tplc=\"0C090019\" w:tentative=\"1\">" 
     615              +"<w:start w:val=\"1\"/>" 
     616              +"<w:numFmt w:val=\"lowerLetter\"/>" 
     617              +"<w:lvlText w:val=\"%2.\"/>" 
     618              +"<w:lvlJc w:val=\"left\"/>" 
     619              +"<w:pPr>" 
     620                +"<w:ind w:left=\"1440\" w:hanging=\"360\"/>" 
     621              +"</w:pPr>" 
     622            +"</w:lvl>" 
     623            +"<w:lvl w:ilvl=\"2\" w:tplc=\"0C09001B\" w:tentative=\"1\">" 
     624              +"<w:start w:val=\"1\"/>" 
     625              +"<w:numFmt w:val=\"lowerRoman\"/>" 
     626              +"<w:lvlText w:val=\"%3.\"/>" 
     627              +"<w:lvlJc w:val=\"right\"/>" 
     628              +"<w:pPr>" 
     629                +"<w:ind w:left=\"2160\" w:hanging=\"180\"/>" 
     630              +"</w:pPr>" 
     631            +"</w:lvl>" 
     632            +"<w:lvl w:ilvl=\"3\" w:tplc=\"0C09000F\" w:tentative=\"1\">" 
     633              +"<w:start w:val=\"1\"/>" 
     634              +"<w:numFmt w:val=\"decimal\"/>" 
     635              +"<w:lvlText w:val=\"%4.\"/>" 
     636              +"<w:lvlJc w:val=\"left\"/>" 
     637              +"<w:pPr>" 
     638                +"<w:ind w:left=\"2880\" w:hanging=\"360\"/>" 
     639              +"</w:pPr>" 
     640            +"</w:lvl>" 
     641            +"<w:lvl w:ilvl=\"4\" w:tplc=\"0C090019\" w:tentative=\"1\">" 
     642              +"<w:start w:val=\"1\"/>" 
     643              +"<w:numFmt w:val=\"lowerLetter\"/>" 
     644              +"<w:lvlText w:val=\"%5.\"/>" 
     645              +"<w:lvlJc w:val=\"left\"/>" 
     646              +"<w:pPr>" 
     647                +"<w:ind w:left=\"3600\" w:hanging=\"360\"/>" 
     648              +"</w:pPr>" 
     649            +"</w:lvl>" 
     650            +"<w:lvl w:ilvl=\"5\" w:tplc=\"0C09001B\" w:tentative=\"1\">" 
     651              +"<w:start w:val=\"1\"/>" 
     652              +"<w:numFmt w:val=\"lowerRoman\"/>" 
     653              +"<w:lvlText w:val=\"%6.\"/>" 
     654              +"<w:lvlJc w:val=\"right\"/>" 
     655              +"<w:pPr>" 
     656                +"<w:ind w:left=\"4320\" w:hanging=\"180\"/>" 
     657              +"</w:pPr>" 
     658            +"</w:lvl>" 
     659            +"<w:lvl w:ilvl=\"6\" w:tplc=\"0C09000F\" w:tentative=\"1\">" 
     660              +"<w:start w:val=\"1\"/>" 
     661              +"<w:numFmt w:val=\"decimal\"/>" 
     662              +"<w:lvlText w:val=\"%7.\"/>" 
     663              +"<w:lvlJc w:val=\"left\"/>" 
     664              +"<w:pPr>" 
     665                +"<w:ind w:left=\"5040\" w:hanging=\"360\"/>" 
     666              +"</w:pPr>" 
     667            +"</w:lvl>" 
     668            +"<w:lvl w:ilvl=\"7\" w:tplc=\"0C090019\" w:tentative=\"1\">" 
     669              +"<w:start w:val=\"1\"/>" 
     670              +"<w:numFmt w:val=\"lowerLetter\"/>" 
     671              +"<w:lvlText w:val=\"%8.\"/>" 
     672              +"<w:lvlJc w:val=\"left\"/>" 
     673              +"<w:pPr>" 
     674                +"<w:ind w:left=\"5760\" w:hanging=\"360\"/>" 
     675              +"</w:pPr>" 
     676            +"</w:lvl>" 
     677            +"<w:lvl w:ilvl=\"8\" w:tplc=\"0C09001B\" w:tentative=\"1\">" 
     678              +"<w:start w:val=\"1\"/>" 
     679              +"<w:numFmt w:val=\"lowerRoman\"/>" 
     680              +"<w:lvlText w:val=\"%9.\"/>" 
     681              +"<w:lvlJc w:val=\"right\"/>" 
     682              +"<w:pPr>" 
     683                +"<w:ind w:left=\"6480\" w:hanging=\"180\"/>" 
     684              +"</w:pPr>" 
     685            +"</w:lvl>" 
     686          +"</w:abstractNum>" 
     687          +"<w:num w:numId=\"1\">" 
     688            +"<w:abstractNumId w:val=\"1\"/>" 
     689          +"</w:num>" 
     690          +"<w:num w:numId=\"2\">" 
     691            +"<w:abstractNumId w:val=\"0\"/>" 
     692          +"</w:num>" 
     693        +"</w:numbering>"; 
    417694     
    418695} 
  • trunk/docx4j/src/test/resources/xhtml/inheritance.html

    r1699 r1708  
    77 
    88.DocDefaults {display:block;space-after: 4mm;line-height: 115%;font-family: Calibri;font-size: 11.0pt;} 
    9 .Normal {display:block;} 
    109.Heading1 {display:block;page-break-after: avoid;space-before: 0.33in;space-after: 0in;font-weight: bold;color: #365F91;font-family: Calibri;font-size: 14.0pt;} 
    1110 
     
    1615  <div class="document"> 
    1716   
    18   <p class="Normal DocDefaults ">This document is a test of CSS inheritance.</p> 
     17  <p class="DocDefaults ">This document is a test of CSS inheritance.</p> 
    1918   
    20   <p class="Heading1 Normal DocDefaults ">Style only</p> 
    21    
    22   <p class="Heading1 Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="white-space:pre-wrap;">Style </span> 
     19  <p class="Heading1 DocDefaults ">Style only</p> 
     20 
     21<!-- BUG: Following should be 14pt --> 
     22  <p class="Heading1 DocDefaults " > 
     23        <span style="white-space:pre-wrap;">Style </span> 
    2324        <span style="font-style: italic;font-size: 9.0pt;">with ad-hoc overrides</span> 
    2425        <span style="white-space:pre-wrap;"> only</span></p> 
     26   
     27<!-- BUG: Following should be 14pt --> 
     28  <p class="Heading1 DocDefaults "  
     29        style="position: relative; margin-left: 0.5in;"> 
     30        <span style="white-space:pre-wrap;">Style </span> 
     31        <span style="font-style: italic;font-size: 9.0pt;">with ad-hoc overrides</span> 
     32        <span style="white-space:pre-wrap;"> only</span></p> 
     33 
     34  <p class="Heading1 DocDefaults " style="position: relative; margin-left: 0.5in;">Style - indented</p> 
     35 
     36    <p class="Heading1 DocDefaults " > 
     37        <span style="white-space:pre-wrap;">This kills font inheritance? </span> 
     38</p> 
     39    <p class="Heading1 DocDefaults " > 
     40        <span style="">How about this?</span> 
     41</p> 
     42 
     43    <p class="Heading1 DocDefaults " > 
     44        <span>Or this?</span> 
     45</p> 
     46 
     47    <p class="Heading1" > 
     48        <span>Or this?</span> 
     49</p> 
     50 
     51    <p class="Heading1 DocDefaults " > 
     52        <span style="font-style: italic;">Italics</span> 
     53</p> 
    2554   
    2655  <p>No css</p> 
Note: See TracChangeset for help on using the changeset viewer.