# 표/셀 속성에 있는 자동으로 나뉜 표의 경계설정

**URL:** <https://forum.developer.hancom.com/t/topic/1357>\
**Category:** 한글 오토메이션\
**Created:** [2월 23, 2024, 7:46오전 UTC](https://forum.developer.hancom.com/t/topic/1357 "2024-02-23T07:46:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user195](https://avatars.discourse-cdn.com/v4/letter/u/b3f665/32.png) [@user195](https://forum.developer.hancom.com/u/user195)\
**Post date:** [2월 23, 2024, 7:46오전 UTC](https://forum.developer.hancom.com/t/topic/1357/1 "2024-02-23T07:46:08Z")

</div>

c#으로 작업중인데 표/셀 속성에 있는 자동으로 나뉜 표의 경계속성을 변경하고 싶습니다. 그 후 선의 종류도 변경이 가능하게 할 수 있나요?

현재 작업했던 코드는 표를 생성해서 텍스트를 넣고 설정을 할라했는데 BorderColorLeft는 작동하는데 BreakCellSeparateLine은 작동하지않아서 문의 드립니다.

```auto
hwp.HAction.GetDefault("TableCreate", hwp.HParameterSet.HTableCreation.HSet);

hwp.HParameterSet.HTableCreation.Rows = 1; //로우1개
hwp.HParameterSet.HTableCreation.Cols = 1; //셀1개
hwp.HParameterSet.HTableCreation.WidthType = 2; //넓이 임의값
hwp.HParameterSet.HTableCreation.HeightType = 0; //자동
hwp.HParameterSet.HTableCreation.TableProperties.TreatAsChar = 0;  
hwp.HParameterSet.HTableCreation.CreateItemArray("ColWidth", 1);    
hwp.HParameterSet.HTableCreation.ColWidth.item[0] = hwp.MiliToHwpUnit(65.4);
hwp.HAction.Execute("TableCreate", hwp.HParameterSet.HTableCreation.HSet);
hwp.HAction.Run("ParagraphShapeAlignLeft");
hwp.HAction.GetDefault("InsertText", hwp.HParameterSet.HInsertText.HSet);
hwp.HParameterSet.HInsertText.Text = str;
hwp.HAction.Execute("InsertText", hwp.HParameterSet.HInsertText.HSet);

hwp.HAction.GetDefault("CellBorderFill", hwp.HParameterSet.HCellBorderFill.HSet);
hwp.HParameterSet.HCellBorderFill.BorderCorlorLeft = 0x00dddddd;
hwp.HParameterSet.HCellBorderFill.BreakCellSeparateLine = true;
hwp.HAction.Execute("CellBorderFill", hwp.HParameterSet.HCellBorderFill.HSet);

hwp.Run("CloseEx");
hwp.HAction.Run("BreakPara");
hwp.Run("TableCellBlock");

```

↓아래와 같은 상태로 변경하고싶습니다.

 ![2024-02-23 16;39;37](https://us1.discourse-cdn.com/flex016/uploads/hancom_dev_forum/original/1X/a5c05313ffae45fc620ad72a1eb0cf8fd5cdb867.png)

---

<div class="post-metadata">

**Author:** ![user16](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.developer.hancom.com/user16/32/785_2.png) [@user16](https://forum.developer.hancom.com/u/user16)\
**Post date:** [2월 26, 2024, 5:23오전 UTC](https://forum.developer.hancom.com/t/topic/1357/2 "2024-02-26T05:23:51Z")

</div>

위 작업 중

[쪽 경계에서 나눔, 셀 단위로 나눔 및 나누지 않음] 옵션은

`hwp.HParameterSet.HShapeObject.PageBreak`에 각각  
2, 1, 0을 적용하면 변경할 수 있습니다.

아쉽게도 “자동으로 나뉜 표의 경계선 설정” 부분은  
오토메이션API로 변경할 수 있는 부분이 아닌 것 같습니다.

---

<div class="post-metadata">

**Author:** ![jhbang](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jhbang](https://forum.developer.hancom.com/u/jhbang)\
**Post date:** [2월 28, 2024, 5:21오전 UTC](https://forum.developer.hancom.com/t/topic/1357/3 "2024-02-28T05:21:58Z")

</div>

~~user16 님 말씀대로 [표 경계 설정에 대한] 속성 변경을 할 수가 없네요. 😂  
내부에서 수정 검토를 진행하도록 하겠습니다.  
감사합니다.~~

---

<div class="post-metadata">

**Author:** ![jhbang](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jhbang](https://forum.developer.hancom.com/u/jhbang)\
**Post date:** [4월 11, 2024, 10:47오후 UTC](https://forum.developer.hancom.com/t/topic/1357/4 "2024-04-11T22:47:34Z")

</div>

@user195 님,  
아래 예제는 표 경계 설정한 표를 생성하는 javascript 코드입니다.  
(한/글 스크립트 작업창에서 실행 가능)  
참고 부탁드립니다.

```auto
function OnScriptMacro_script1()
{
	var act = CreateAction("TableCreate");
	var createSet = act.CreateSet();
    act.GetDefault(createSet);
    createSet.SetItem("Rows", 5);
    createSet.SetItem("Cols", 5);
    createSet.SetItem("WidthType", 2);
    createSet.SetItem("HeightType", 2);
    
    var tablePropSet = createSet.Item("TableProperties");
    // [글자처럼 취급] 해제
    tablePropSet.SetItem("TreatAsChar", 0);
    // [표, 쪽 경계 속성] "셀 단위 나눔"(2) 으로 설정
    tablePropSet.SetItem("PageBreak", 2);
    
    // [표, 테두리/채우기] 속성 생성
    var tableBorderFillSet;
    if (!tablePropSet.ItemExist("TableBorderFill")) {
			tableBorderFillSet = tablePropSet.CreateItemSet("TableBorderFill", "BorderFill");
    }
    // [표, 자동으로 나뉜 표의 경계선] 체크 설정
    tableBorderFillSet.SetItem("BreakCellSeparateLine", 1);
    // [표, 경계선 종류] "점선"(2) 설정
    tableBorderFillSet.SetItem("DiagonalType", 2);
    // [표, 경계선 종류] "0.15mm"(2) 설정
    tableBorderFillSet.SetItem("DiagonalWidth", 2);
    // [표, 경계선 색상] "빨강"(0x0000FF) 설정
    tableBorderFillSet.SetItem("DiagonalColor", 0x0000FF);
    
    createSet.SetItem("TableProperties", tablePropSet);
    act.Execute(createSet);
}

```
