/// <summary> /// 导出表格数据到当前标签 /// </summary> /// <param name="view">表格</param> /// <param name="excNoHaveTabs">不包含tab符号</param> public static void exportThisPage(DataGridView view, bool excNoHaveTabs) { // 将表格内容转化为字符串 string s = getDatatabelSelText(view, false); // 判断是否包含制表符 if (excNoHaveTabs) { s = s.Replace("\t", ""); } ControlsUtils.ExportThisPage(s); }
// 下拉框选择子项事件 private void ComboBox_SelectedIndexChanged(object sender, EventArgs e) { ComboBox comB = (ComboBox)sender; if (outputComBox != null && outputComBox.Equals(comB) && comB.Focused) { List <Dictionary <string, string> > dataDic = dateTabelStrToList(inputDGV); // 获取最终内容 string str = beGetSetTotalMethod(dataDic); ExportComBoxValEnum val = ExportComBox.stringToEnum(comB.SelectedValue.ToString()); switch (val) { case ExportComBoxValEnum.EXPORT_NEW_PAGE_VAL: // 新标签 if (str.Length > 0) { MainTabControlUtils.ExportNewPage(str); } break; case ExportComBoxValEnum.EXPORT_THIS_PAGE_VAL: // 当前标签 if (str.Length > 0) { ControlsUtils.ExportThisPage(str); } break; case ExportComBoxValEnum.EXPORT_JAVA_VAL: // java文件 if (str.Length > 0) { FileUtils.SaveJavaFile(str, classNameStr, encoding); } break; case ExportComBoxValEnum.EXPORT_NOTEBOOK_VAL: // 记事本 if (str.Length > 0) { FileUtils.TurnOnNotepad(str); } break; } } if (输入_类型规则_comB.Equals(comB) && comB.Focused) { if ("数据库".Equals(comB.SelectedItem)) { TypeRule = 0; } else if ("JAVA对象".Equals(comB.SelectedItem) && comB.Focused) { TypeRule = 1; } } }
/// <summary> /// 导出数据到当前标签 /// </summary> public void exportThisPage() { string s = resultTextBox.SelectionLength == 0? resultTextBox.Text : resultTextBox.SelectedText; ControlsUtils.ExportThisPage(s); }