# Insert 후에 정상적으로 Insert되지 않는 경우가 있음

**URL:** <https://forum.developer.hancom.com/t/insert-insert/1702>\
**Category:** 웹한글 기안기\
**Created:** [7월 31, 2024, 4:22오전 UTC](https://forum.developer.hancom.com/t/insert-insert/1702 "2024-07-31T04:22:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user154](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/user154/32/619_2.png) [@user154](https://forum.developer.hancom.com/u/user154)\
**Post date:** [7월 31, 2024, 4:22오전 UTC](https://forum.developer.hancom.com/t/insert-insert/1702/1 "2024-07-31T04:22:40Z")

</div>

Insert 후에 정상적으로 Insert되지 않는 경우가 있습니다.

일괄기안에서 안 추가시 현재 본문 끝으로 이동해 페이지 브레이크하고  
서식hwp파일을 Insert하는데  
정상적으로 insert되지 않아 , 콜백함수에서 필드리스트 찍어봤을 때  
추가 전과 추가 후가 동일합니다.

if(window.console) console.log(‘MoveDocEnd’);  
IMPL\_RunAction(‘editor1’, ‘MoveDocEnd’);  
IMPL\_RunAction(‘editor1’, ‘BreakPage’);  
// 웹한글은 이미 있는 본문에 append  
console.log(‘before insert FieldList: ‘, IMPL\_GetFieldListEx(‘editor1’))  
IMPL\_Insert(‘editor1’, formURL, function() {  
console.log(‘after insert FieldList: ‘, IMPL\_GetFieldListEx(‘editor1’))  
if(window.console) console.log(’[Promise] [loadBatchGianForm] load form success’);  
resolve(true);  
if(window.console) console.log(’[Promise] [loadBatchGianForm] END’);  
}, {})

 ![image](https://us1.discourse-cdn.com/flex016/uploads/hancom_dev_forum/original/2X/5/52b245abadb333a8c9e1058baa85f82cac5868b9.png)  
[insert하는파일.hwp](https://forum.developer.hancom.com/uploads/short-url/3QtAg90kDD6aGOjOBTgzw16lMHd.hwp) (91.7 KB)

---

<div class="post-metadata">

**Author:** ![user154](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/user154/32/619_2.png) [@user154](https://forum.developer.hancom.com/u/user154)\
**Post date:** [7월 31, 2024, 7:02오전 UTC](https://forum.developer.hancom.com/t/insert-insert/1702/2 "2024-07-31T07:02:46Z")

</div>

이 문제는 해결되었습니다.  
URL에서 읽어들이는 파일이 hwpx포맷 이라서

hwpCtrl.Insert(url, “HWP”, “”, callback, userData);로 못 읽어들였었네요

=\> hwpCtrl.Insert(url, “”, “”, callback, userData);로 처리했습니다.

---

<div class="post-metadata">

**Author:** ![cgkang](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@cgkang](https://forum.developer.hancom.com/u/cgkang)\
**Post date:** [7월 31, 2024, 10:20오후 UTC](https://forum.developer.hancom.com/t/insert-insert/1702/3 "2024-07-31T22:20:23Z")

</div>

안녕하세요.

다른 문제가 발생하면 언제든지 글 올려 주시기 바랍니다.  
감사합니다.

---

<div class="post-metadata">

**Author:** ![user154](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/user154/32/619_2.png) [@user154](https://forum.developer.hancom.com/u/user154)\
**Post date:** [8월 8, 2024, 8:33오전 UTC](https://forum.developer.hancom.com/t/insert-insert/1702/4 "2024-08-08T08:33:00Z")

</div>

실패할때 다음과 같은 오류로그가 찍힙니다.

filterserver.log에 ERROR [http-nio-8080-exec-7] [com.hancom.webhwp.control.exception.ExceptionControllerAdvice.defaultException(ExceptionControllerAdvice.java:50)] - defaultException :  
com.hancom.webhwp.control.exception.HwpSDKException: -2147467233  
at com.hancom.webhwp.control.exception.DefaultException.hwpSdkException(DefaultException.java:104) ~[classes/:?]  
at com.hancom.webhwp.control.filter.controller.OpenController.convert(OpenController.java:223) ~[classes/:?]  
at com.hancom.webhwp.control.filter.controller.OpenController.documentOpen(OpenController.java:167) ~[classes/:?]  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0\_412]  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0\_412]  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0\_412]  
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0\_412]  
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.17.RELEASE.jar:4.3.17.RELEASE]  
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.17.RELEASE.jar:4.3.17.RELEASE]  
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.17.RELEASE.jar:4.3.17.RELEASE]  
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.17.RELEASE.jar:4.3.17.RELEASE]

---

<div class="post-metadata">

**Author:** ![cgkang](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@cgkang](https://forum.developer.hancom.com/u/cgkang)\
**Post date:** [8월 8, 2024, 11:44오후 UTC](https://forum.developer.hancom.com/t/insert-insert/1702/5 "2024-08-08T23:44:19Z")

</div>

안녕하세요.

해당 오류가 자주 발생 하나요.?  
원인은 Insert 과정중에 필터 데몬 서버의 오류로 보입니다.  
Insert 하려는 문서가 있어야 원인 분석이 가능합니다.  
먼저 현재 사용중인 기안기 서버의 버전이 어떻게 되나요.?

---

<div class="post-metadata">

**Author:** ![user154](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/user154/32/619_2.png) [@user154](https://forum.developer.hancom.com/u/user154)\
**Post date:** [10월 30, 2024, 4:04오전 UTC](https://forum.developer.hancom.com/t/insert-insert/1702/6 "2024-10-30T04:04:45Z")

</div>

해결되었습니다.  
오늘 확인해본 결과 hwpCtrl.Insert의 문제는 아니었습니다.

안 추가시 서식을 본문에 추가Insert하고,  
(서식에 기본적으로 들어있는 본문 클리어를 위해)  
추가된 안의 본문필드 select하여 삭제(클리어)하고,  
1안의 본문셀내용을 추가된 안 본문에 붙여넣기하는데

해당 사이트서식의 경우 본문 전체선택이 정상적으로 되지 않아  
본문을 클리어(본문셀이동 전체선택 삭제)가 제대로 되고 있지 않습니다.  
그래서 서식의 본문과 1안의 본문 포함해서 중복해서 나오고 있었습니다.

본문필드 전체선택 select 하는 로직을  
기존 본문으로 MoveToField 시 필드 selected 상태로 만드는 파라메터 true으로 넘기는 대신  
hwpCtrl.SelectText를 사용하는 로직으로 변경하여 해결하였습니다.

그동안 지원해주셔서 감사합니다.

---

<div class="post-metadata">

**Author:** ![cgkang](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@cgkang](https://forum.developer.hancom.com/u/cgkang)\
**Post date:** [10월 30, 2024, 5:26오전 UTC](https://forum.developer.hancom.com/t/insert-insert/1702/7 "2024-10-30T05:26:53Z")

</div>

안녕하세요.

문제가 해결되었다니 다행이네요.  
다른 문제가 발생하면 언제든지 글 올려 주시기 바랍니다.

감사합니다.
