public void UpdateNode() { //treeView1.BeginUpdate(); if (treeView.SelectedNode.Tag is SeSchemaItem) { SeSchemaItem ssi = (SeSchemaItem)treeView.SelectedNode.Tag; treeView.SelectedNode.Text = ssi.ToString(); } else if (treeView.SelectedNode.Tag is SeSchema) { SeSchema ss = (SeSchema)treeView.SelectedNode.Tag; treeView.SelectedNode.Text = ss.ToString(); } //treeView1.EndUpdate(); }
private void выгрузитьВWordToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFD_DOCX.ShowDialog() == DialogResult.Cancel) { return; } // получаем выбранный файл SeSchema seSchema = (SeSchema)comboBox_SchemaList.SelectedItem; string path = saveFD_DOCX.FileName; DocX doc = DocX.Create(path); var titleParagraph = doc.InsertParagraph(); titleParagraph.Append(seSchema.ToString()); titleParagraph.Bold(); var infoParagraph = doc.InsertParagraph(); infoParagraph.Append($"Данная схема имеет подтаблиц - {seSchema.SchemaItems.Count - 1}");//!!! var emptyParagraph = doc.InsertParagraph(); emptyParagraph.Append(" "); foreach (SeSchemaItem si in seSchema.SchemaItems) { foreach (SeSchemaItem sic in si.SchemaItemsChildren) { int i = 1; var tableInfoParagraph = doc.InsertParagraph(); tableInfoParagraph.Append(si.ToString() + ":"); tableInfoParagraph.Bold(); emptyParagraph.Append(" "); foreach (SeSchemaItem sicchild in sic.SchemaItemsChildren) { if (sic.SchemaItemsChildren.Count > 0) { var tableParagraph = doc.InsertParagraph(); if (sicchild.CheckToCommonTypes() != true) { tableParagraph.Append($"{i}. {sicchild.ToString()}: (данные таблицы {sicchild.Type})"); } else { tableParagraph.Append($"{i}. {sicchild.ToString()}:______________________________"); } i++; } var emptyParagraph1 = doc.InsertParagraph(); emptyParagraph1.Append(" "); } var emptyParagraph2 = doc.InsertParagraph(); emptyParagraph2.Append(" "); } } doc.Save(); string filename = Path.GetFileName(path); MessageBox.Show($"Файл {filename}.docx успешно сохранен"); }