Getting text style from docx using Apache poi

后端 未结 6 1559
清酒与你
清酒与你 2021-01-14 02:41

I\'m trying to get the style information from an MS docx file, I have no problem writing file content with added styles like bold, italic. font size etc, but reading the fil

6条回答
  •  感动是毒
    2021-01-14 03:23

    I gave up trying to use Apache poi, I found another lib called docx4j, this seems to do what I need, the properties I want to look at a now available, once the docx file is loaded you can view the content of the file in an xml format like below.

    `

    
       
          
             
                
                   
                   
                   
                   
                   
                
                "Hello, this is
             
             
                
                   
                   
                   
                   
                   
                   
                
                 
             
             
                
                   
                   
                   
                   
                   
                   
                   
                
                bold text
             
             
                
                   
                   
                   
                   
                   
                   
                
                 
             
             
                
                   
                   
                   
                   
                   
                
                and this is
             
             
                
                   
                   
                   
                   
                   
                   
                
                 
             
             
                
                   
                   
                   
                   
                   
                   
                   
                
                italic text
             
             
                
                   
                   
                   
                   
                   
                   
                
                 
             
             
                
                   
                   
                   
                   
                   
                
                an
             
             
                
                   
                   
                   
                   
                   
                
                d this is
             
             
                
                   
                   
                   
                   
                   
                   
                
                 
             
             
                
                   
                   
                   
                   
                   
                   
                   
                   
                   
                
                bold-italic text
             
             
                
                   
                   
                   
                   
                   
                
                "
             
          
          
             
             
             
             
          
       
    
    

    `

提交回复
热议问题