//打开word
        public void OpenWord(WinWordControl.WinWordControl winWordControl1, string wordUrl)
        {
            if (string.IsNullOrEmpty(wordUrl))
            {
                wordUrl = GetPath() + @"\Template\国废验收报告-标准模版.doc";
            }
            //else
            //{
            // wordUrl = GetPath() + wordUrl;
            //}

            try
            {
                winWordControl1.CloseControl();
            }
            catch { }
            finally
            {
                winWordControl1.document              = null;
                WinWordControl.WinWordControl.wd      = null;
                WinWordControl.WinWordControl.wordWnd = 0;
            }
            try
            {
                winWordControl1.LoadDocument(wordUrl);
                WordComent(winWordControl1.document);
            }
            catch (Exception ex)
            {
                String err = ex.Message;
            }
        }
Ejemplo n.º 2
0
        private void load_Click(object sender, System.EventArgs e)
        {
            //int wordWnd = FindWindow(String.Empty, this.formName);
            //SetWindowPos(wordWnd, this.Handle.ToInt32(), 0, 0, this.Bounds.Width - 20, this.Bounds.Height - 20, SWP_NOZORDER | SWP_NOMOVE | SWP_DRAWFRAME);

            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //IntPtr wordWnd = FindWindow(null, this.Text);
                ////SetWindowPos(wordWnd, IntPtr.Zero, 0, 0, this.Bounds.Width, this.Bounds.Height, SWP_NOZORDER | SWP_NOMOVE);
                //SetParent(IntPtr.Zero, wordWnd);

                //IntPtr wordWnd = FindWindow(null, this.Text);
                //SetWindowPos(wordWnd, IntPtr.Zero, 0, 0, this.Bounds.Width, this.Bounds.Height, SWP_NOZORDER | SWP_NOMOVE);
                //SetParent(IntPtr.Zero, wordWnd);

                //if (wordWnd == 0) wordWnd = FindWindow("Opusapp", null);
                //if (wordWnd == 0) wordWnd = FindWindow(null,this.Text);
                //if(wordWnd != 0){
                //    SetParent(wordWnd, this.Handle.ToInt32());
                //}
                //if (wordWnd == 0) wordWnd = FindWindow(null, this.Text);
                //SetWindowPos(wordWnd, this.Handle.ToInt32(), 0, 0, this.Bounds.Width + 20, this.Bounds.Height + 20, SWP_NOZORDER | SWP_NOMOVE | SWP_DRAWFRAME);
                //MoveWindow(wordWnd, -5, -33, this.Bounds.Width + 10, this.Bounds.Height + 57, true);
                //SetWindowPos(wordWnd, this.Handle.ToInt32(), 0, 0,this.Bounds.Width - 20, this.Bounds.Height - 20,SWP_NOZORDER | SWP_NOMOVE | SWP_DRAWFRAME);

                winWordControl1.LoadDocument(openFileDialog1.FileName);

                //if (wordWnd == 0) wordWnd = FindWindow(null, this.Text);
                //if (wordWnd != 0)
                //{
                //    SetParent(wordWnd, this.Handle.ToInt32());
                //}
            }
        }
Ejemplo n.º 3
0
 private void load_Click(object sender, System.EventArgs e)
 {
     if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         winWordControl1.LoadDocument(openFileDialog1.FileName);
     }
 }