private void treeView1_DoubleClick(object sender, EventArgs e) { try { //写入配套词句 if (_selWordDatas != null) { _selWordDatas.Clear(); } if (treeView1.SelectedNode == null) { return; } if (treeView1.SelectedNode.Tag is ReportWordsClassData) { return; } ReportWordsInfoData wordData = treeView1.SelectedNode.Tag as ReportWordsInfoData; if (wordData == null) { MessageBox.Show("无效词句内容数据。", "提示"); return; } if (_selWordDatas == null) { _selWordDatas = new BizDataItems(); } if (wordData.词句信息.词句类型 == (int)ReportWordType.rwtFree) { foreach (JReportWordSection wordSection in wordData.词句信息.词句明细) { BizDataItem bi = new BizDataItem(); bi.Add("sectionname", wordSection.段落名称); bi.Add("text", wordSection.段落内容); bi.Add("formattext", wordSection.段落格式); _selWordDatas.Add(bi); } } DoActions(_designEvents[WordProviderEventDefine.WriteWord], sender); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private void WordContext_Click(object sender, EventArgs e) { try { if (_selWordDatas != null) { _selWordDatas.Clear(); } //写入选择词句 if (wordContext1.SelectedItem == null) { return; } string sectionName = wordContext1.SelectedItem.Tag; if (_selWordDatas == null) { _selWordDatas = new BizDataItems(); } BizDataItem bi = new BizDataItem(); bi.Add("sectionname", sectionName); if (string.IsNullOrEmpty(wordContext1.SelectedItem.SelText)) { bi.Add("text", wordContext1.SelectedItem.Text); bi.Add("formattext", wordContext1.SelectedItem.Rtf); } else { bi.Add("text", wordContext1.SelectedItem.SelText); bi.Add("formattext", wordContext1.SelectedItem.SelRtf); } _selWordDatas.Add(bi); DoActions(_designEvents[WordProviderEventDefine.WriteWord], sender); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }