示例#1
0
        private void BtnGenerateCode_Click(object sender, RibbonControlEventArgs e)
        {
            Excel.Application app   = Globals.ThisAddIn.Application;
            Excel.Worksheet   sheet = app.ActiveSheet;

            if (sheet.UsedRange.Columns.Count < 2 || sheet.UsedRange.Rows.Count < 2)
            {
                Utils.ShowMessage("시트 데이터가 존재하지 않습니다. 시트 서식화 후 진행하세요.");
            }
            else
            {
                string fieldText, columnText;
                string code = ColumnGenerator.GenerateCode(sheet, out fieldText, out columnText);
                if (!String.IsNullOrEmpty(code))
                {
                    if (this.codeForm == null)
                    {
                        codeForm = new CodeForm();
                    }
                    codeForm.FieldInfo  = fieldText;
                    codeForm.ColumnInfo = columnText;
                    codeForm.SourceCode = code;
                    codeForm.ShowDialog();
                }
            }
        }
示例#2
0
 private void RealGridAddin_Close(object sender, EventArgs e)
 {
     if (codeForm != null)
     {
         codeForm.Dispose();
         codeForm = null;
     }
 }