回答編集履歴
2
再修正
answer
CHANGED
@@ -27,12 +27,16 @@
|
|
27
27
|
var ElementText2 = nextElements.asText().getText();//段落内の文字列を取得
|
28
28
|
var SearchResult2 = ElementText2.search(reg2);//DFGで始まる段落であるかをsearch
|
29
29
|
if (SearchResult2 == 0){
|
30
|
+
//1つ前の段落との結合をしてよい場合の例
|
30
|
-
//nextElements.merge();
|
31
|
+
//nextElements.merge();
|
32
|
+
|
33
|
+
//1つ前の段落に該当文字を移動してから置換の場合の例
|
31
34
|
body.getChild(i).asText().setText(ElementText + string2);
|
32
35
|
body.getChild(i+1).asText().setText(ElementText2.substr(string2.length));
|
36
|
+
|
37
|
+
body.replaceText(string1 + string2, string3);
|
33
38
|
}
|
34
39
|
}
|
35
|
-
body.replaceText(string1 + string2, string3);
|
36
40
|
}
|
37
41
|
|
38
42
|
function docReplace2() {
|
1
rem変更
answer
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
var ElementText2 = nextElements.asText().getText();//段落内の文字列を取得
|
28
28
|
var SearchResult2 = ElementText2.search(reg2);//DFGで始まる段落であるかをsearch
|
29
29
|
if (SearchResult2 == 0){
|
30
|
-
//nextElements.merge();//1つ前の段落と結合
|
30
|
+
//nextElements.merge();//1つ前の段落との結合でよい場合
|
31
31
|
body.getChild(i).asText().setText(ElementText + string2);
|
32
32
|
body.getChild(i+1).asText().setText(ElementText2.substr(string2.length));
|
33
33
|
}
|