gpt4 book ai didi

org.apache.poi.xwpf.usermodel.XWPFPicture类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 02:35:05 30 4
gpt4 key购买 nike

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

XWPFPicture介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

for (XmlObject o : pictTextObjs) {
  for (CTPicture pict : getCTPictures(o)) {
    XWPFPicture picture = new XWPFPicture(pict, this);
    pictures.add(picture);

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

XWPFPictureData data = picture.getPictureData();
if (data != null) {
  AttributesImpl attr = new AttributesImpl();
  attr.addAttribute("", "alt", "alt", "CDATA", picture.getDescription());

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

for ( XWPFRun run : par.getRuns() ) {
  for ( XWPFPicture picture : run.getEmbeddedPictures() ) {
    pictureData = picture.getPictureData();
    byte[] img = pictureData.getData();
    String fileName = pictureData.getFileName();

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

public static void printDescriptionOfImagesInCell(XWPFTableCell cell) {
  List<XWPFParagraph> paragrahs = cell.getParagraphs();
  for (XWPFParagraph paragraph : paragraphs) {
    List<XWPFRun> runs = paragraph.getRuns();
    for (XWPFRun run : runs) {
      List<XWPFPicture> pictures = run.getEmbeddedPictures();
      for (XWPFPicture picture : pictures) {
        //Do anything you want with the picture:
        System.out.println("Picture: " + picture.getDescription());
      }
    }
  }
}

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

public static StringBuilder getStyle( XWPFPicture picture )
{
  StringBuilder htmlStyle = new StringBuilder();
  // Position
  CTPositiveSize2D ext = picture.getCTPicture().getSpPr().getXfrm().getExt();
  long x = ext.getCx();
  long y = ext.getCy();
  float width = dxa2points( x ) / 635;
  float height = dxa2points( y ) / 635;
  XHTMLUtil.addHTMLStyle( htmlStyle, WIDTH, width + "pt" );
  XHTMLUtil.addHTMLStyle( htmlStyle, HEIGHT, height + "pt" );
  return htmlStyle;
}

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

XWPFPictureData data = picture.getPictureData();
if (data != null) {
  AttributesImpl attr = new AttributesImpl();
  attr.addAttribute("", "alt", "alt", "CDATA", picture.getDescription());

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

XWPFDocument doc = new XWPFDocument(new FileInputStream(fileName));
     List<XWPFTable> table = doc.getTables();
     for (XWPFTable xwpfTable : table) {
       List<XWPFTableRow> row = xwpfTable.getRows();
       for (XWPFTableRow xwpfTableRow : row) {
         List<XWPFTableCell> cell = xwpfTableRow.getTableCells();
         for (XWPFTableCell xwpfTableCell : cell) {
           if (xwpfTableCell != null) {
             System.out.println(xwpfTableCell.getText());
             String s = xwpfTableCell.getText();
             for (XWPFParagraph p : xwpfTableCell.getParagraphs()) {
               for (XWPFRun run : p.getRuns()) {
                 for (XWPFPicture pic : run.getEmbeddedPictures()) {
                   byte[] pictureData = pic.getPictureData().getData();
                   System.out.println("picture : " + pictureData);
                 }
               }
             }
           }
         }
       }
     }

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

throws Exception
CTPositiveSize2D ext = picture.getCTPicture().getSpPr().getXfrm().getExt();
long x = ext.getCx();
long y = ext.getCy();
CTPicture ctPic = picture.getCTPicture();
String blipId = ctPic.getBlipFill().getBlip().getEmbed();

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

XWPFPictureData data = picture.getPictureData();
if (data != null) {
  AttributesImpl attr = new AttributesImpl();
  attr.addAttribute("", "alt", "alt", "CDATA", picture.getDescription());

代码示例来源:origin: org.apache.poi/poi-ooxml

XWPFPicture xwpfPicture = new XWPFPicture(pic, this);
pictures.add(xwpfPicture);
return xwpfPicture;

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

XWPFDocument doc = new XWPFDocument(new FileInputStream(fileName));
 List<XWPFTable> table = doc.getTables();
 for (XWPFTable xwpfTable : table) {
   List<XWPFTableRow> row = xwpfTable.getRows();
   for (XWPFTableRow xwpfTableRow : row) {
     List<XWPFTableCell> cell = xwpfTableRow.getTableCells();
     for (XWPFTableCell xwpfTableCell : cell) {
       if (xwpfTableCell != null) {
         System.out.println(xwpfTableCell.getText());
         String s = xwpfTableCell.getText();
         for (XWPFParagraph p : xwpfTableCell.getParagraphs()) {
           for (XWPFRun run : p.getRuns()) {
             for (XWPFPicture pic : run.getEmbeddedPictures()) {
               byte[] pictureData = pic.getPictureData().getData();
               System.out.println("picture : " + pictureData);
             }
           }
         }
       }
     }
   }
 }

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

@Override
protected void visitPicture( XWPFPicture picture, XHTMLPageContentBuffer parentContainer )
  throws Exception
{
  parentContainer.startElementNotEnclosed( IMG_ELEMENT );
  CTPicture ctPic = picture.getCTPicture();
  String blipId = ctPic.getBlipFill().getBlip().getEmbed();
  // Src attribute
  XWPFPictureData pictureData = XWPFPictureUtil.getPictureData( document, blipId );
  if ( pictureData != null )
  {
    String src = pictureData.getFileName();
    if ( StringUtils.isNotEmpty( src ) )
    {
      src = resolver.resolve( WORD_MEDIA + src );
      parentContainer.setAttribute( SRC_ATTR, src );
    }
  }
  StringBuilder htmlStyle = XHTMLStyleUtil.getStyle( picture );
  setAttributStyleIfNeeded( parentContainer, htmlStyle );
  parentContainer.endElementNotEnclosed();
  parentContainer.endElement( IMG_ELEMENT );
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

for (XmlObject o : pictTextObjs) {
  for (CTPicture pict : getCTPictures(o)) {
    XWPFPicture picture = new XWPFPicture(pict, this);
    pictures.add(picture);

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

if(pictures != null && !pictures.isEmpty()) {
  for (XWPFPicture picture : pictures) {
    XWPFPictureData data = picture.getPictureData();
    if(data != null) {
      result.add(data);

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

for(XmlObject o : pictTextObjs) {
  for(CTPicture pict : getCTPictures(o)) {
    XWPFPicture picture = new XWPFPicture(pict, this);
    pictures.add(picture);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

XWPFPicture xwpfPicture = new XWPFPicture(pic, this);
pictures.add(xwpfPicture);
return xwpfPicture;

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

XWPFPicture xwpfPicture = new XWPFPicture(pic, this);
pictures.add(xwpfPicture);
return xwpfPicture;

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com