apache poi - paragraph.getRuns() to separate a paragraph -
when use apache poi change date of contract automatically, confused @ how dose paragraph.getruns() separate paragraph. have following paragraph 自 2014 年 10 月 1 日起至 2014 年 10 月 31 日止
i use following code see how many xwpfrun paragraph.getruns() return
string currentparagraph = ""; for(xwpfrun xwpfrun : paragraph.getruns()){ currentparagraph += xwpfrun.gettext(0); system.out.println(currentparagraph); }
i find first 5 number xwpfrun independently,eg ,2014,10,1 last number "31" separated 2 xwpfrun :"3", , "1";
this makes hard change date xwpfrun ,and want know how deal , how paragraph.getruns() works?
sometimes text in docx files gets broken arbitrary number of runs. while inconvenient, it's not difficult deal with.
the solution iterate runs in paragraph, , concatenate text each string. then, update date , store text of first run. lastly, can remove or set text in other runs "".
Comments
Post a Comment