当前位置: 首页>>代码示例>>Java>>正文


Java Range.getCharacterRun方法代码示例

本文整理汇总了Java中org.apache.poi.hwpf.usermodel.Range.getCharacterRun方法的典型用法代码示例。如果您正苦于以下问题:Java Range.getCharacterRun方法的具体用法?Java Range.getCharacterRun怎么用?Java Range.getCharacterRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.hwpf.usermodel.Range的用法示例。


在下文中一共展示了Range.getCharacterRun方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllPictures

import org.apache.poi.hwpf.usermodel.Range; //导入方法依赖的package包/类
/**
  * Not all documents have all the images concatenated in the data stream
  * although MS claims so. The best approach is to scan all character runs.
  *
  * @return a list of Picture objects found in current document
  */
 public List<Picture> getAllPictures() {
   ArrayList<Picture> pictures = new ArrayList<Picture>();

   Range range = _document.getOverallRange();
   for (int i = 0; i < range.numCharacterRuns(); i++) {
   	CharacterRun run = range.getCharacterRun(i);

       if (run==null) {
           continue;
       }

   	Picture picture = extractPicture(run, false);
   	if (picture != null) {
   		pictures.add(picture);
   	}
}

   searchForPictures(_dgg.getEscherRecords(), pictures);

   return pictures;
 }
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:28,代码来源:PicturesTable.java

示例2: tryDeadField_lookupFieldSeparatorEnd

import org.apache.poi.hwpf.usermodel.Range; //导入方法依赖的package包/类
private int[] tryDeadField_lookupFieldSeparatorEnd(
        HWPFDocumentCore wordDocument, Range range, int beginMark )
{
    int separatorMark = -1;
    int endMark = -1;
    for ( int c = beginMark + 1; c < range.numCharacterRuns(); c++ )
    {
        CharacterRun characterRun = range.getCharacterRun( c );

        String text = characterRun.text();
        if ( text.getBytes().length == 0 )
            continue;

        final byte firstByte = text.getBytes()[0];
        if ( firstByte == FIELD_BEGIN_MARK )
        {
            int[] nested = tryDeadField_lookupFieldSeparatorEnd(
                    wordDocument, range, c );
            if ( nested != null )
            {
                c = nested[1];
            }
            continue;
        }

        if ( firstByte == FIELD_SEPARATOR_MARK )
        {
            if ( separatorMark != -1 )
            {
                // double; incorrect format
                return null;
            }

            separatorMark = c;
            continue;
        }

        if ( text.getBytes()[0] == FIELD_END_MARK )
        {
            if ( endMark != -1 )
            {
                // double;
                return null;
            }

            endMark = c;
            break;
        }
    }

    if ( separatorMark == -1 || endMark == -1 )
        return null;

    return new int[] { separatorMark, endMark };
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:56,代码来源:AbstractWordConverter.java


注:本文中的org.apache.poi.hwpf.usermodel.Range.getCharacterRun方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。