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

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

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

XWPFDocument.getStyle介绍

[英]Returns the styles object used
[中]返回使用的styles对象

代码示例

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

public OLDXHTMLMapper( XWPFDocument document )
{
  super();
  this.document = document;
  try
  {
    defaults = document.getStyle().getDocDefaults();
  }
  catch ( XmlException e )
  {
    LOGGER.severe( e.getMessage() );
  }
  catch ( IOException e )
  {
    LOGGER.severe( e.getMessage() );
  }
}

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

public XWPFElementVisitor( XWPFDocument document )
{
  this.document = document;
  try
  {
    this.defaults = document.getStyle().getDocDefaults();
  }
  catch ( XmlException e )
  {
    LOGGER.severe( e.getMessage() );
  }
  catch ( IOException e )
  {
    LOGGER.severe( e.getMessage() );
  }
}

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

@Override
protected IITextContainer startVisitDocument( OutputStream out )
  throws Exception
{
  // TODO parse default style here ?
  CTStyles styles = document.getStyle();
  styles.getDocDefaults().getPPrDefault().getPPr();
  return null;
}

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

XWPFDocument document = new XWPFDocument();
XWPFDocument template = new XWPFDocument(new FileInputStream(new File("Template.dotx")));
XWPFStyles newStyles = document.createStyles();
newStyles.setStyles(template.getStyle());

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

public XWPFStylesDocument( XWPFDocument document, boolean lazyInitialization )
  throws XmlException, IOException
{
  this( document.getStyle(), getFontsDocument( document ), getThemeDocuments( document ),
     getCTSettings( document ), lazyInitialization );
}

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

public XWPFStylesDocument( XWPFDocument document, boolean lazyInitialization )
  throws XmlException, IOException
{
  this( document.getStyle(), getFontsDocument( document ), getThemeDocuments( document ),
     getCTSettings( document ), lazyInitialization );
}

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

XWPFDocument template = new XWPFDocument(new FileInputStream(new File("Template.dotx")));       

XWPFDocument doc = new XWPFDocument();      
// let's copy styles from template to new doc
XWPFStyles newStyles = doc.createStyles();
newStyles.setStyles(template.getStyle());

XWPFParagraph para = doc.createParagraph();
para.setStyle("Heading1");

XWPFRun run = para.createRun();
run.setText("Heading 1");

return doc;

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

@Override
protected IITextContainer startVisitDocument( OutputStream out )
  throws Exception
{
  // TODO parse default style here ?
  CTStyles styles = document.getStyle();
  if ( generateCSSComments )
  {
    cssStyleSheet.setComment( "office:styles begin" );
  }
  styles.getDocDefaults().getPPrDefault().getPPr();
  if ( generateCSSComments )
  {
    cssStyleSheet.setComment( "office:styles end" );
  }
  return null;
}

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

private void buildDefault()
{
  try
  {
    CTDocDefaults defaults = document.getStyle().getDocDefaults();
    // Style aStyle = new Style(DEFAULT_STYLE);
    stylesMap.add( DEFAULT_STYLE );
    cssStyleSheet.startCSSStyleDeclaration( DEFAULT_STYLE );
    if ( defaults != null )
    {
      if ( defaults.getPPrDefault().getPPr() != null )
      {
        maptStyleParagraphProperties( defaults.getPPrDefault().getPPr() );
      }
    }
    cssStyleSheet.endCSSStyleDeclaration();
    // stylesMap.put(DEFAULT_STYLE, aStyle);
  }
  catch ( XmlException e )
  {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  catch ( IOException e )
  {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}

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

private void buildDefault()
{
  try
  {
    CTDocDefaults defaults = document.getStyle().getDocDefaults();
    Style aStyle = new Style( DEFAULT_STYLE );
    if ( defaults != null )
    {
      if ( defaults.getPPrDefault().getPPr() != null )
      {
        StyleParagraphProperties paragraphProperties =
          mapStyleParagraphProperties( defaults.getPPrDefault().getPPr() );
        aStyle.setParagraphProperties( paragraphProperties );
        FontInfos fontInfos = processRPR( defaults.getRPrDefault().getRPr() );
        paragraphProperties.setFontInfos( fontInfos );
      }
    }
    stylesMap.put( DEFAULT_STYLE, aStyle );
  }
  catch ( XmlException e )
  {
    LOGGER.severe( e.getMessage() );
  }
  catch ( IOException e )
  {
    LOGGER.severe( e.getMessage() );
  }
}

相关文章

XWPFDocument类方法