fix fields processing, improve test case
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1147082 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3f4627ec37
commit
3568e18a60
@ -19,11 +19,10 @@ package org.apache.poi.hwpf.converter;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.poi.hwpf.converter.FontReplacer.Triplet;
|
|
||||||
|
|
||||||
import org.apache.poi.hpsf.SummaryInformation;
|
import org.apache.poi.hpsf.SummaryInformation;
|
||||||
import org.apache.poi.hwpf.HWPFDocument;
|
import org.apache.poi.hwpf.HWPFDocument;
|
||||||
import org.apache.poi.hwpf.HWPFDocumentCore;
|
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.Field;
|
||||||
import org.apache.poi.hwpf.model.FieldsTables;
|
import org.apache.poi.hwpf.model.FieldsTables;
|
||||||
import org.apache.poi.hwpf.model.ListFormatOverride;
|
import org.apache.poi.hwpf.model.ListFormatOverride;
|
||||||
@ -118,7 +117,15 @@ public abstract class AbstractWordConverter
|
|||||||
{
|
{
|
||||||
processField( ( (HWPFDocument) hwpfDocument ), range,
|
processField( ( (HWPFDocument) hwpfDocument ), range,
|
||||||
currentTableLevel, aliveField, block );
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +171,8 @@ public abstract class AbstractWordConverter
|
|||||||
{
|
{
|
||||||
if ( stringBuilder.length() > 0 )
|
if ( stringBuilder.length() > 0 )
|
||||||
{
|
{
|
||||||
outputCharacters( block, characterRun, stringBuilder.toString() );
|
outputCharacters( block, characterRun,
|
||||||
|
stringBuilder.toString() );
|
||||||
stringBuilder.setLength( 0 );
|
stringBuilder.setLength( 0 );
|
||||||
}
|
}
|
||||||
processLineBreak( block, characterRun );
|
processLineBreak( block, characterRun );
|
||||||
@ -176,7 +184,8 @@ public abstract class AbstractWordConverter
|
|||||||
}
|
}
|
||||||
if ( stringBuilder.length() > 0 )
|
if ( stringBuilder.length() > 0 )
|
||||||
{
|
{
|
||||||
outputCharacters( block, characterRun, stringBuilder.toString() );
|
outputCharacters( block, characterRun,
|
||||||
|
stringBuilder.toString() );
|
||||||
stringBuilder.setLength( 0 );
|
stringBuilder.setLength( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,10 @@ public class TestWordToHtmlConverter extends TestCase
|
|||||||
{
|
{
|
||||||
String result = getHtmlText( "hyperlink.doc" );
|
String result = getHtmlText( "hyperlink.doc" );
|
||||||
|
|
||||||
assertContains( result, "<a href=\"http://testuri.org/\">" );
|
assertContains( result, "<span>Before text; </span><a " );
|
||||||
assertContains( result, "Hyperlink text" );
|
assertContains( result,
|
||||||
|
"<a href=\"http://testuri.org/\"><span>Hyperlink text</span></a>" );
|
||||||
|
assertContains( result, "</a><span>; after text</span>" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInnerTable() throws Exception
|
public void testInnerTable() throws Exception
|
||||||
|
Loading…
Reference in New Issue
Block a user