import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.poi.hwpf.converter.FontReplacer.Triplet;
-
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFDocumentCore;
+import org.apache.poi.hwpf.converter.FontReplacer.Triplet;
import org.apache.poi.hwpf.model.Field;
import org.apache.poi.hwpf.model.FieldsTables;
import org.apache.poi.hwpf.model.ListFormatOverride;
protected boolean processCharacters( HWPFDocumentCore hwpfDocument,
int currentTableLevel, Range range, final Element block )
{
- if (range == null)
+ if ( range == null )
return false;
boolean haveAnyText = false;
{
processField( ( (HWPFDocument) hwpfDocument ), range,
currentTableLevel, aliveField, block );
- c = aliveField.getEndOffset();
+
+ int continueAfter = aliveField.getEndOffset();
+ while ( range.getCharacterRun( c ).getEndOffset() <= continueAfter
+ && c < range.numCharacterRuns() )
+ c++;
+
+ if ( c < range.numCharacterRuns() )
+ c--;
+
continue;
}
}
{
if ( stringBuilder.length() > 0 )
{
- outputCharacters( block, characterRun, stringBuilder.toString() );
+ outputCharacters( block, characterRun,
+ stringBuilder.toString() );
stringBuilder.setLength( 0 );
}
- processLineBreak(block, characterRun);
+ processLineBreak( block, characterRun );
}
else
{
}
if ( stringBuilder.length() > 0 )
{
- outputCharacters( block, characterRun, stringBuilder.toString() );
+ outputCharacters( block, characterRun,
+ stringBuilder.toString() );
stringBuilder.setLength( 0 );
}
}
{
String result = getHtmlText( "hyperlink.doc" );
- assertContains( result, "<a href=\"http://testuri.org/\">" );
- assertContains( result, "Hyperlink text" );
+ assertContains( result, "<span>Before text; </span><a " );
+ assertContains( result,
+ "<a href=\"http://testuri.org/\"><span>Hyperlink text</span></a>" );
+ assertContains( result, "</a><span>; after text</span>" );
}
public void testInnerTable() throws Exception