本文整理汇总了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;
}
示例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 };
}