org.apache.poi.xwpf.usermodel.XWPFDocument.getStyles()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFDocument.getStyles()方法的一些代码示例,展示了XWPFDocument.getStyles()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFDocument.getStyles()方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFDocument
类名称:XWPFDocument
方法名:getStyles

XWPFDocument.getStyles介绍

[英]get Styles
[中]获取样式

代码示例

代码示例来源:origin: apache/tika

public XWPFWordExtractorDecorator(Metadata metadata, ParseContext context, XWPFWordExtractor extractor) {
  super(context, extractor);
  this.metadata = metadata;
  document = (XWPFDocument) extractor.getDocument();
  styles = document.getStyles();
}

代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-parsers

public XWPFWordExtractorDecorator(ParseContext context, XWPFWordExtractor extractor) {
  super(context, extractor);
  document = (XWPFDocument) extractor.getDocument();
  styles = document.getStyles();
}

代码示例来源:origin: org.apache.tika/tika-parsers

public XWPFWordExtractorDecorator(Metadata metadata, ParseContext context, XWPFWordExtractor extractor) {
  super(context, extractor);
  this.metadata = metadata;
  document = (XWPFDocument) extractor.getDocument();
  styles = document.getStyles();
}

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core

protected XWPFStyle getXWPFStyle( String styleID )
{
  if ( styleID == null )
    return null;
  else
    return document.getStyles().getStyle( styleID );
}

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core-gae

protected XWPFStyle getXWPFStyle( String styleID )
{
  if ( styleID == null )
    return null;
  else
    return document.getStyles().getStyle( styleID );
}

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter

protected XWPFStyle getXWPFStyle( String styleID )
{
  if ( styleID == null )
    return null;
  else
    return document.getStyles().getStyle( styleID );
}

代码示例来源:origin: com.github.livesense/org.liveSense.framework.xdocreport

protected XWPFStyle getXWPFStyle( String styleID )
{
  if ( styleID == null )
    return null;
  else
    return document.getStyles().getStyle( styleID );
}

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter

protected Style getStyle( String styleID )
  {
    if ( styleID == null )

      return getDefaultStyle();
    else if ( !document.getStyles().styleExist( styleID ) )
      return getDefaultStyle();
    // else
    return stylesMap.get( styleID );
  }
}

代码示例来源:origin: stackoverflow.com

File f=new File("test.docx");
   FileInputStream fis = new FileInputStream(f);
   XWPFDocument xdoc=new XWPFDocument(OPCPackage.open(fis));
   XWPFStyles styles=xdoc.getStyles();         
   List<XWPFParagraph> xwpfparagraphs =xdoc.getParagraphs();
   System.out.println();
   for(int i=0;i<xwpfparagraphs.size();i++)
   {
     System.out.println("paragraph style id "+(i+1)+":"+xwpfparagraphs.get(i).getStyleID());                         
     if(xwpfparagraphs.get(i).getStyleID()!=null)
     {
       String styleid=xwpfparagraphs.get(i).getStyleID();
       XWPFStyle style=styles.getStyle(styleid);
       if(style!=null)
       {
         System.out.println("Style name:"+style.getName());
         if(style.getName().startsWith("heading"))
         {
           //this is a heading
         }
       }
     }
   }

代码示例来源:origin: stackoverflow.com

System.out.println(styleID);
System.out.println("=============================================================");
XWPFStyle xStyle = xdoc.getStyles().getStyle(styleID);
if (xStyle.getType() == STStyleType.CHARACTER) {
 System.out.println(xStyle.getCTStyle());

代码示例来源:origin: stackoverflow.com

if (document.getStyles()==null){
  document.createStyles();
document.getStyles().addStyle(new XWPFStyle(style));
document.getStyles().addStyle(new XWPFStyle(style));
document.getStyles().addStyle(new XWPFStyle(style));

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter

XWPFStyle style = document.getStyles().getStyle( styleID );

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter

XWPFStyle style = document.getStyles().getStyle( styleID );

相关文章

XWPFDocument类方法