public void ReplaceDefaultText(TempDocsDetailCollection content) { try { int count = 0; Microsoft.Office.Interop.Word.Shapes tx = PareGooWord.Globals.ThisAddIn.Application.ActiveDocument.Shapes; for (int i = 0; i < tx.Count; i++) { try { if (tx[i].Type == Microsoft.Office.Core.MsoShapeType.msoTextBox) { foreach (TempDocsDetail item in content) { if (item.tpControlKey == tx[i].Name) { tx[i].TextFrame.TextRange.Text = "\n" + item.tpkeyContent; break; } } } } catch (Exception ex) { } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("خطا در آفیس:" + "\r\n" + ex.Message); } }
private void FillTypeChild() { try { if (cmbType.SelectedItemIndex != -1) { TempDocsDetailCollection t = tempDocsDetailManager.GetTempDocsByParentID(cmbType.SelectedItem.Tag.ToString(), conString); if (t != null && t.Count > 0) { ReplaceDefaultText(t); } } } catch (Exception) { } }