public BytePropertyNode(int fcStart, int fcEnd, CharIndexTranslator translator, Object buf) {
super(
translator.getCharIndex(fcStart),
- translator.getCharIndex(fcEnd),
+ translator.getCharIndex(fcEnd, translator.getCharIndex(fcStart)),
buf
);
this.startBytes = fcStart;
*/\r
int getCharIndex(int bytePos);\r
\r
+ /**\r
+ * Calculates the char index of the given byte index.\r
+ * Look forward if index is not in table\r
+ *\r
+ * @param bytePos The character offset to check\r
+ * @param startCP look from this characted position \r
+ * @return the char index\r
+ */\r
+ int getCharIndex(int bytePos, int startCP);\r
+\r
/**\r
* Check if index is in table\r
*\r
}
public int getCharIndex(int bytePos) {
+ return getCharIndex(bytePos, 0);
+ }
+
+ public int getCharIndex(int bytePos, int startCP) {
int charCount = 0;
bytePos = lookIndexForward(bytePos);
charCount += toAdd;
}
- if (bytePos>=pieceStart && bytePos<=pieceEnd) {
+ if (bytePos>=pieceStart && bytePos<=pieceEnd && charCount>=startCP) {
break;
}
}
doc.getPicturesTable().getAllPictures(); // just check that we do not throw Exception
}
+ public void testFastSaved3() {
+ HWPFDocument doc = HWPFTestDataSamples.openSampleFile("ob_is.doc");
+
+ doc.getPicturesTable().getAllPictures(); // just check that we do not throw Exception
+ }
+
}