# 유통문서 본문 파싱 관련 문의

**URL:** <https://forum.developer.hancom.com/t/topic/1282>\
**Category:** 웹한글 기안기\
**Created:** [1월 18, 2024, 5:55오전 UTC](https://forum.developer.hancom.com/t/topic/1282 "2024-01-18T05:55:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user174](https://avatars.discourse-cdn.com/v4/letter/u/9de0a6/32.png) [@user174](https://forum.developer.hancom.com/u/user174)\
**Post date:** [1월 18, 2024, 5:55오전 UTC](https://forum.developer.hancom.com/t/topic/1282/1 "2024-01-18T05:55:13Z")

</div>

안녕하세요.

웹한글 기안기를 통해 생성된 유통문서 본문을 다시 파싱하면  
들여쓰기에 문제가 있는 것이 확인됩니다.

재현방식은 아래와 같습니다.

1. 문서는 아래와 같이 작성합니다.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/hancom_dev_forum/original/1X/547ca116495573fcb9d87860cf347e98aee5c276.png)

2. pubdoc(웹한글 기안기 제공 기능) 이 아래와 같이 생성됩니다.

```xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE pubdoc [<!ENTITY nbsp "&#160;">]>
<pubdoc>
<body>
<content>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">내용입니다.</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">&nbsp;</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">1. 1번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">1.1. <a name="#1b0edb0d"></a>1-1번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">1.2. <a name="#1b0edb0f"></a>1-2번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">2. <a name="#1b0edb16"></a>2번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">2.1. <a name="#1b0edb19"></a>2-1번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">2.2. <a name="#1b0edb1a"></a>2-2번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">3. <a name="#1b0edb1b"></a>3번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">&nbsp;</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">끝입니다.</p>
</content>
</body>
</pubdoc>

```

1. pubdoc의 contents 태그에 대해서 setTextFile 수행

```auto
HwpCtrl.SetTextFile(pubdoc content 태그 내 html 코드 , 'html', 'insertfile');

```

1. 화면에 보이는 결과는 들여쓰기가 이상합니다.  
text-indent, adjust 관련해서 확인을 부탁드립니다.!

![image](https://us1.discourse-cdn.com/flex016/uploads/hancom_dev_forum/original/1X/20c3013a4ddb5c8882cf449fca75d96c2fb312c5.png)

감사합니다.

---

<div class="post-metadata">

**Author:** ![bart](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bart](https://forum.developer.hancom.com/u/bart)\
**Post date:** [1월 21, 2024, 11:55오후 UTC](https://forum.developer.hancom.com/t/topic/1282/2 "2024-01-21T23:55:42Z")

</div>

안녕하세요.

공문서 필터는 SetTextFile 시 format에 “PUBDOCBODY” 형식으로 설정해야 합니다.  
설정 이후에도 동일하게 잘못 표시되면 다시 문의 부탁드립니다.

감사합니다.

---

<div class="post-metadata">

**Author:** ![user174](https://avatars.discourse-cdn.com/v4/letter/u/9de0a6/32.png) [@user174](https://forum.developer.hancom.com/u/user174)\
**Post date:** [1월 22, 2024, 5:22오전 UTC](https://forum.developer.hancom.com/t/topic/1282/3 "2024-01-22T05:22:47Z")

</div>

안녕하세요.  
답변 주신대로 시도해봤는데, 본문 삽입 자체가 되지 않습니다.!

> **[SetTextFile](https://developer.hancom.com/webhwp/devguide/hwpctrl/methods/settextfile)**
>
> SetTextFile

여기에도 PUBDOCBODY 관련 인자는 없는 것 같은데, 따로 유통필터를 제공받아야 하나요?

이렇게 시도했는데요, 예시코드 주시면 다시 시도해보겠습니다.  
test변수에 pubdoc 태그만 넣거나 body만 넣거나 해도 동일하게 동작을 안합니다.  
확인 부탁드립니다.

```javascript
1. 본문 설정
var test = `<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE pubdoc [<!ENTITY nbsp "&#160;">]>
<pubdoc>
<body>
<content>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">내용입니다.</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">&nbsp;</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">1. 1번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">1.1. <a name="#1b0edb0d"></a>1-1번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">1.2. <a name="#1b0edb0f"></a>1-2번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">2. <a name="#1b0edb16"></a>2번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">2.1. <a name="#1b0edb19"></a>2-1번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:17.6394mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">2.2. <a name="#1b0edb1a"></a>2-2번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;margin-left:0.0000mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">3. <a name="#1b0edb1b"></a>3번</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">&nbsp;</p>
<p style="font-family:돋움;font-size:12pt;line-height:6.7735mm;text-indent:-8.8197mm;margin-left:8.8197mm;margin-right:0.0000mm;margin-top:0.0000mm;margin-bottom:0.0000mm;" align="adjust">끝입니다.</p>
</content>
</body>
</pubdoc>`

2. 본문 삽입 
HwpCtrl.SetTextFile(test, 'PUBDOCBODY', 'insertfile');

```
