c# 표 만들기 에러

네. 거의 스크립트 가져와서 파이썬에서 수정하는것과 같이 수정해서 사용하고 있습니다.

아래는. 핸재 테스트 중인 전체 코드 입니다.
(폼 테두리 없이 실행하는 프로그램이라 일반적으로 필요하지 않은 코드들도 있습니다.
아래한글에 글자 입력하는 typing 함수도 잘 작동하고
여백 조정하는 함수도 잘 작동하는데…
파이썬으로 크게 문제 없이 실행되던 표 만들기가 안되길래… 이유를 모르겠네요…
)

using HwpObjectLib; // HWP 컨트롤 위한 참조 선언
using System.Data.Common;
using System.Diagnostics;
using System.Runtime.InteropServices; // 윈도우 폼 이동 위한
using System.Windows.Forms; // 윈도우 폼 이동 위한

namespace hwp_test_01
{
public partial class Form1 : Form
{
public HwpObject hwp = new HwpObject(); // HwpObject hwp 선언

    public Form1()
    {
        InitializeComponent();
        init();
    }

    // 윈도우 API 상수와 함수 선언
    public const int WM_NCLBUTTONDOWN = 0xA1;
    public const int HT_CAPTION = 0x2;

    public bool mouseDown = false;

    [DllImportAttribute("user32.dll")]
    public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

    [DllImportAttribute("user32.dll")]
    public static extern bool ReleaseCapture();


    public void init()
    {
        hwp.XHwpWindows.Item(0).Visible = true;         // 화면 보기
    }

    //여백 설정
    private void button3_Click(object sender, EventArgs e)
    {
        setMargin(hwp, 23, 23, 18, 18, 15, 15);
    }

    private void setMargin(HwpObject hwp, float left, float right, float top, float bottom, float header, float footter)
    {
        hwp.HAction.GetDefault("PageSetup", hwp.HParameterSet.HSecDef.HSet);
        hwp.HParameterSet.HSecDef.PageDef.LeftMargin = hwp.MiliToHwpUnit(left);
        hwp.HParameterSet.HSecDef.PageDef.RightMargin = hwp.MiliToHwpUnit(right);
        hwp.HParameterSet.HSecDef.PageDef.TopMargin = hwp.MiliToHwpUnit(top);
        hwp.HParameterSet.HSecDef.PageDef.BottomMargin = hwp.MiliToHwpUnit(bottom);
        hwp.HParameterSet.HSecDef.PageDef.HeaderLen = hwp.MiliToHwpUnit(header);
        hwp.HParameterSet.HSecDef.PageDef.FooterLen = hwp.MiliToHwpUnit(footter);
        hwp.HParameterSet.HSecDef.HSet.SetItem("ApplyClass", 24);
        hwp.HParameterSet.HSecDef.HSet.SetItem("ApplyTo", 3);
        hwp.HAction.Execute("PageSetup", hwp.HParameterSet.HSecDef.HSet);
    }

    // 현재 커서 위치 정보 확인
    private int[] cursorInfo(HwpObject hwp)
    {
        int seccnt = 0; // 총 구역
        int secno = 0; // 현재 구역
        int prnpageno = 0; // 쪽
        int colno = 0; //단
        int line = 0; //줄
        int pos = 0; //칸
        short over = 0; //삽입/ 겹침
        string ctrlname = "";        //컨트롤 종류
        hwp.KeyIndicator(out seccnt, out secno, out prnpageno, out colno, out line, out pos, out over, out ctrlname);
        Debug.WriteLine("총 구역 : " + seccnt);
        Debug.WriteLine("현재 구역 : " + secno);
        Debug.WriteLine("쪽 : " + prnpageno);
        Debug.WriteLine("단: " + colno);
        Debug.WriteLine("줄: " + line);
        Debug.WriteLine("칸: " + pos);
        Debug.WriteLine("컨트롤 종류: " + ctrlname);
        int[] cursor_info = new int[6];
        cursor_info[0] = seccnt;
        cursor_info[1] = secno;
        cursor_info[2] = prnpageno;
        cursor_info[3] = colno;
        cursor_info[4] = line;
        cursor_info[5] = pos;
        return cursor_info;     // 배열로 리런 [총구역, 현재구역, 쪽, 단, 줄, 칸, 컨트롤 종류]
    }

    // 한글 문서에 문장 입력
    private void typing(HwpObject hwp, string sss)
    {
        var act = hwp.CreateAction("InsertText");
        var pset = act.CreateSet();
        hwp.Run("BreakPara");       //문단 나누기(Enter)
        pset.SetItem("Text", sss);
        act.Execute(pset);
        Debug.WriteLine(cursorInfo(hwp));
    }

    // textBox의 텍스트를 아래한글에 입력하기
    private void button1_Click(object sender, EventArgs e)
    {
        typing(hwp, textBox1.Text);
    }

    private void button2_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }

    private void Form1_MouseDown(object sender, MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            ReleaseCapture();
            SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            mouseDown = true;
        }
    }


    private void Form1_MouseMove(object sender, MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            this.Location = new Point(
                (this.Location.X) + e.X,
                (this.Location.Y) + e.Y);
            this.Update();
        }
    }

    // 마우스 좌 클릭을 떼었을때
    private void Form1_MouseUp(object sender, MouseEventArgs e)
    {
        mouseDown = false;
    }

    protected override void WndProc(ref Message m)
    {
        const int RESIZE_HANDLE_SIZE = 10;
        switch (m.Msg)
        {
            case 0x0084/*NCHITTEST*/ :
                base.WndProc(ref m);
                if ((int)m.Result == 0x01/*HTCLIENT*/)
                {
                    Point screenPoint = new Point(m.LParam.ToInt32());
                    Point clientPoint = this.PointToClient(screenPoint);
                    if (clientPoint.Y <= RESIZE_HANDLE_SIZE)
                    {
                        if (clientPoint.X <= RESIZE_HANDLE_SIZE)
                            m.Result = (IntPtr)13/*HTTOPLEFT*/ ;
                        else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
                            m.Result = (IntPtr)12/*HTTOP*/ ;
                        else
                            m.Result = (IntPtr)14/*HTTOPRIGHT*/ ;
                    }
                    else if (clientPoint.Y <= (Size.Height - RESIZE_HANDLE_SIZE))
                    {
                        if (clientPoint.X <= RESIZE_HANDLE_SIZE)
                            m.Result = (IntPtr)10/*HTLEFT*/ ;
                        else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
                            m.Result = (IntPtr)2/*HTCAPTION*/ ;
                        else
                            m.Result = (IntPtr)11/*HTRIGHT*/ ;
                    }
                    else
                    {
                        if (clientPoint.X <= RESIZE_HANDLE_SIZE)
                            m.Result = (IntPtr)16/*HTBOTTOMLEFT*/ ;
                        else if (clientPoint.X < (Size.Width - RESIZE_HANDLE_SIZE))
                            m.Result = (IntPtr)15/*HTBOTTOM*/ ;
                        else
                            m.Result = (IntPtr)17/*HTBOTTOMRIGHT*/ ;
                    }
                }
                return;
        }
        base.WndProc(ref m);
    }

    private void textBox1_KeyDown(object sender, KeyEventArgs e)
    {
        //if (e.Control && e.KeyCode == Keys.PageUp)     // Ctrl-PageUp            
        if (e.Control && e.KeyCode == Keys.A)     // Ctrl-A            
        {
            if (sender != null) ((TextBox)sender).SelectAll();
        }
    }

    private void button4_Click(object sender, EventArgs e)
    {
        this.Opacity -= 0.1;
        if (this.Opacity < 0.1) { this.Opacity = 0.1; }
    }

    private void button5_Click(object sender, EventArgs e)
    {
        if (this.Opacity < 1)
        {
            this.Opacity += 0.1;
            if (this.Opacity > 1) { this.Opacity = 1; }
        }
    }

    // 종료시 아래한글도 종료하기
    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        hwp.Quit();
    }



    // 표 만들기
    private void create_Table(HwpObject hwp, int row, int column, float width, float height)
    {
        hwp.HAction.GetDefault("TableCreate", hwp.HParameterSet.HTableCreation.HSet);
        hwp.HParameterSet.HTableCreation.Rows = 2;
        hwp.HParameterSet.HTableCreation.Cols = 2;
        hwp.HParameterSet.HTableCreation.WidthType = 0;
        hwp.HParameterSet.HTableCreation.HeightType = 1;
        hwp.HParameterSet.HTableCreation.WidthValue = hwp.MiliToHwpUnit(width / 2);
        hwp.HParameterSet.HTableCreation.HeightValue = hwp.MiliToHwpUnit(height / 2);
        hwp.HParameterSet.HTableCreation.CreateItemArray("ColWidth", 2);
        hwp.HParameterSet.HTableCreation.ColWidth.SetItem(0, hwp.MiliToHwpUnit(70.4));
        hwp.HParameterSet.HTableCreation.ColWidth.SetItem(1, hwp.MiliToHwpUnit(70.4));
        hwp.HParameterSet.HTableCreation.CreateItemArray("RowHeight", 1);
        hwp.HParameterSet.HTableCreation.RowHeight.SetItem(0, hwp.MiliToHwpUnit(9.0));
        hwp.HParameterSet.HTableCreation.TableProperties.Width = 41954;
        hwp.HAction.Execute("TableCreate", hwp.HParameterSet.HTableCreation.HSet);
        hwp.HAction.Run("TBoxTableTemplateInit");




        // 셀 속성 - 가로크기 15으로
        hwp.HAction.Run("TableCellBlock");
        hwp.HAction.GetDefault("TablePropertyDialog", hwp.HParameterSet.HShapeObject.HSet);
        hwp.HParameterSet.HShapeObject.HSet.SetItem("ShapeType", 3);
        hwp.HParameterSet.HShapeObject.HSet.SetItem("ShapeCellSize", 1);
        hwp.HParameterSet.HShapeObject.ShapeTableCell.Width = hwp.MiliToHwpUnit(15.0);
        hwp.HAction.Execute("TablePropertyDialog", hwp.HParameterSet.HShapeObject.HSet);
        hwp.HAction.Run("Cancel");

        // 표 속성 글자처럼 취급하기
        hwp.FindCtrl();     // 고치기
        hwp.HAction.GetDefault("TablePropertyDialog", hwp.HParameterSet.HShapeObject.HSet);
        hwp.HParameterSet.HShapeObject.TreatAsChar = 1; // 글자처럼 취급
        hwp.HParameterSet.HShapeObject.HSet.SetItem("ShapeType", 3);
        hwp.HParameterSet.HShapeObject.HSet.SetItem("ShapeCellSize", 0);
        hwp.HAction.Execute("TablePropertyDialog", hwp.HParameterSet.HShapeObject.HSet);
        hwp.HAction.Run("CloseEx");
    }

    private void button6_Click(object sender, EventArgs e)
    {
        create_Table(hwp, 1, 2, 150, 20);

    }

    // 현재 커서 위치 정보 확인(디버그용)
    private void button7_Click(object sender, EventArgs e)
    {
        cursorInfo(hwp);
    }

    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams cp = base.CreateParams;
            cp.Style |= 0x20000; // <--- use 0x20000
            return cp;
        }
    }
}

}