mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
Add test for bug 58805
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923055 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
38e7fe63a8
commit
534d24dc74
@ -27,6 +27,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -784,4 +786,21 @@ class TestBugs {
|
||||
assertNotNull(pictures);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@Test
|
||||
void test58805() throws IOException {
|
||||
try (HWPFDocument doc = openSampleFile("header_footer_replace.doc")) {
|
||||
|
||||
Range oRange = doc.getHeaderStoryRange();
|
||||
for (int i = 0; i < oRange.numCharacterRuns(); i++) {
|
||||
CharacterRun run = oRange.getCharacterRun(i);
|
||||
run.replaceText("_TEST_", "This text is longer than the initial text. It goes on and on without interruption.");
|
||||
}
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(new File("/tmp/test.doc"))) {
|
||||
doc.write(fos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
test-data/document/header_footer_replace.doc
Normal file
BIN
test-data/document/header_footer_replace.doc
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user