예제 #1
0
        private void InitAdd(IList <LayoutContent> ls, WordBuilder tx2)
        {
            foreach (LayoutContent bs in ls)
            {
                try
                {
                    //////tx2.wordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
                    //////tx2.wordApp.Selection.Font.Bold = 1;
                    //////tx2.wordApp.Selection.Font.Size = 18;
                    //MessageBox.Show(tx2.wordApp.Selection.get_Style().ToString());
                    //tx2.wordApp.Selection.
                    //tx2.wordApp.Selection.TypeText("\r\n");



                    tx2.wordApp.Selection.TypeText(bs.ChapterName + "\r\n");
                    object obj = "标题 1";


                    Style  testStyle  = tx2.wordApp.Application.ActiveDocument.Styles.get_Item(ref obj);
                    object listObject = testStyle;
                    tx2.wordApp.Selection.set_Style(ref listObject);

                    tx2.InsertFromStreamGzip(bs.Contents);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
예제 #2
0
 private void InitAdd(IList <byte[]> ls, WordBuilder tx2)
 {
     foreach (byte[] bs in ls)
     {
         try
         {
             tx2.InsertFromStreamGzip(bs);
         }
         catch
         {
         }
     }
 }
예제 #3
0
 public void GetTop(string id, WordBuilder tx2)
 {
     byte[] vi = null;
     try
     {
         LayoutType lt1 = Services.BaseService.GetOneByKey <LayoutType>(id);
         if (lt1 != null)
         {
             vi = lt1.ExcelData;
             tx2.InsertFromStreamGzip(vi);
         }
     }
     catch { }
 }
예제 #4
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }



            string         uid  = treeList1.FocusedNode["UID"].ToString();
            LayoutContent  obj  = Services.BaseService.GetOneByKey <LayoutContent>(uid);
            WaitDialogForm wait = null;


            WordBuilder wb = new WordBuilder();

            //if (fb != null)
            //    wb.InsertFromStreamGzip(fb);

            try
            {
                wait = new WaitDialogForm("", "正在下载数据, 请稍候...");

                if (obj.Contents != null && obj.Contents.Length > 0)
                {
                    if (fb != null)
                    {
                        wb.InsertFromStreamGzip(obj.Contents);
                        dsoFramerWordControl1.FileData = wb.FileData;
                    }
                    else
                    {
                        dsoFramerWordControl1.FileDataGzip = obj.Contents;
                    }
                }
                else
                {
                    dsoFramerWordControl1.FileNew();
                }
                dsoFramerWordControl1.AxFramerControl.Menubar = true;
                wait.Close();
            }
            catch (Exception ex)
            {
                wait.Close();
                MessageBox.Show(ex.Message);
            }
        }
예제 #5
0
 public void GetTop(string id, WordBuilder tx2)
 {
     byte[] vi = null;
     try
     {
         LayoutType lt1 = Services.BaseService.GetOneByKey<LayoutType>(id);
         if (lt1 != null)
         {
             vi = lt1.ExcelData;
             tx2.InsertFromStreamGzip(vi);
         }
     }
     catch { }
 }
예제 #6
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (treeList1.FocusedNode == null)
                return;

            string uid = treeList1.FocusedNode["UID"].ToString();
            LayoutContent obj = Services.BaseService.GetOneByKey<LayoutContent>(uid);
            WaitDialogForm wait=null;

            WordBuilder wb = new WordBuilder();
            //if (fb != null)
            //    wb.InsertFromStreamGzip(fb);

            try
            {
                wait = new WaitDialogForm("", "������������, ���Ժ�...");

                if (obj.Contents != null && obj.Contents.Length > 0)
                {
                    if (fb != null)
                    {
                        wb.InsertFromStreamGzip(obj.Contents);
                        dsoFramerWordControl1.FileData = wb.FileData;
                    }
                    else
                    {
                        dsoFramerWordControl1.FileDataGzip = obj.Contents;
                    }
                }
                else
                {
                    dsoFramerWordControl1.FileNew();
                }
                dsoFramerWordControl1.AxFramerControl.Menubar = true;
                wait.Close();
            }
            catch (Exception ex)
            {
                wait.Close();
            MessageBox.Show(ex.Message);

            }
        }
예제 #7
0
        private void InitAdd(IList<byte[]> ls, WordBuilder tx2)
        {
            foreach (byte[] bs in ls)
            {
                try
                {

                    tx2.InsertFromStreamGzip(bs);
                }
                catch
                {

                }

            }
        }
예제 #8
0
        private void InitAdd(IList<LayoutContent> ls, WordBuilder tx2)
        {
            foreach (LayoutContent bs in ls)
            {
                try
                {

                    //////tx2.wordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
                    //////tx2.wordApp.Selection.Font.Bold = 1;
                    //////tx2.wordApp.Selection.Font.Size = 18;
                    //MessageBox.Show(tx2.wordApp.Selection.get_Style().ToString());
                    //tx2.wordApp.Selection.
                    //tx2.wordApp.Selection.TypeText("\r\n");

            tx2.wordApp.Selection.TypeText(bs.ChapterName+"\r\n");
            object obj = "���� 1";

            Style testStyle = tx2.wordApp.Application.ActiveDocument.Styles.get_Item(ref obj);
            object listObject = testStyle;
            tx2.wordApp.Selection.set_Style(ref listObject);

            tx2.InsertFromStreamGzip(bs.Contents);

                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

            }
        }
예제 #9
0
        private void InitAdd(IList<LayoutContentANTL> ls, WordBuilder tx2)
        {
            foreach (LayoutContentANTL bs in ls)
            {

                try
                {
                    //ע�Ͳ���Ϊ���½�������ĵ����ⲿ��
                    //tx2.wordApp.Selection.TypeText(bs.ChapterName+"\r\n");
                    //object obj = "���� 1";
                    //Style testStyle = tx2.wordApp.Application.ActiveDocument.Styles.get_Item(ref obj);
                    //object listObject = testStyle;
                    //tx2.wordApp.Selection.set_Style(ref listObject);
                    tx2.InsertFromStreamGzip(bs.Contents);
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message);
                }

            }
        }
예제 #10
0
        //���仯�����¸ı�word����
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            killAllProcess();
            //���㷢���仯ʱ�����ݿ�����ȡ�µ�word�ļ�
            if (treeList1.FocusedNode == null)
                return;
            string uid = treeList1.FocusedNode["UID"].ToString();
            LayoutContentANTL obj = Services.BaseService.GetOneByKey<LayoutContentANTL>(uid);
            WaitDialogForm wait=null;
            WordBuilder wb = new WordBuilder();

            // public static Word.Bookmarks W_Bkm =

            //if (fb != null)
            //    wb.InsertFromStreamGzip(fb);

            //��һ�µ�ǰword�еı�ǩ
            //�ı�һ�µ�ǰ��¼��word��UID���Ա����±�ǩʱʹ��
            LayoutID = treeList1.FocusedNode["UID"].ToString();

            try
            {
                wait = new WaitDialogForm("", "������������, ���Ժ�...");

                if (obj.Contents != null && obj.Contents.Length > 0)
                {
                    if (fb != null)
                    {
                        wb.InsertFromStreamGzip(obj.Contents);
                        dsoFramerWordControl1.FileData = wb.FileData;
                        Staword = wb;

                    }
                    else
                    {
                        dsoFramerWordControl1.FileDataGzip = obj.Contents;
                    }
                }
                else
                {
                    dsoFramerWordControl1.FileNew();
                }
                dsoFramerWordControl1.AxFramerControl.Menubar = true;
                if(dsoFramerWordControl1.AxFramerControl.DocumentFullName!=null)
                {
                 W_Doc = (Word.Document)dsoFramerWordControl1.AxFramerControl.ActiveDocument;
                }

                wait.Close();

            }

            catch (Exception ex)
            {
                wait.Close();
            MessageBox.Show(ex.Message);

            }
        }
예제 #11
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (treeList1.FocusedNode == null)
                return;

            if (!isstate)
                return;

            string uid = treeList1.FocusedNode["UID"].ToString();
            RtfCategory obj = Services.BaseService.GetOneByKey<RtfCategory>(uid);
            WaitDialogForm wait=null;

            this.ctrlRtfAttachFiles1.Category = uid;
            this.ctrlRtfAttachFiles1.RefreshData();

            WordBuilder wb = new WordBuilder();
            if(fb!=null)
            wb.InsertFromStreamGzip(fb);

            try
            {
                wait = new WaitDialogForm("", "������������, ���Ժ�...");
                //txEdit1.ResetContents();
                //txEdit1.m_LoadStream(obj.RtfContents);
                if (obj.RtfContents != null && obj.RtfContents.Length > 0)
                {
                    if (fb != null)
                    {
                        wb.InsertFromStreamGzip(obj.RtfContents);
                        dsoFramerWordControl2.FileData = wb.FileData;
                    }
                    else
                    {
                        dsoFramerWordControl2.FileDataGzip = obj.RtfContents;
                    }

                    //////dsoFramerWordControl2.FileDataGzip = obj.RtfContents;
                }
                else
                {
                    ////////LayoutType lt1 = Services.BaseService.GetOneByKey<LayoutType>("LayoutModule");
                    ////////dsoFramerWordControl2.FileDataGzip = lt1.ExcelData;
                    dsoFramerWordControl2.FileNew();
                }

                //if (!(AddRight || EditRight))
                //    dsoFramerWordControl2.IsReadOnly = true;
                dsoFramerWordControl2.AxFramerControl.Menubar = true;
                wait.Close();
            }
            catch (Exception ex)
            {
                //dsoFramerWordControl2.FileDataGzip = wb.FileDataGzip;
                wait.Close();
                MessageBox.Show(ex.Message); }//MsgBox.Show("�������쳣������Office�Ƿ�װ��ȷ��"); }
        }
예제 #12
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (!isstate)
            {
                return;
            }

            string         uid  = treeList1.FocusedNode["UID"].ToString();
            RtfCategory    obj  = Services.BaseService.GetOneByKey <RtfCategory>(uid);
            WaitDialogForm wait = null;

            this.ctrlRtfAttachFiles1.Category = uid;
            this.ctrlRtfAttachFiles1.RefreshData();


            WordBuilder wb = new WordBuilder();

            if (fb != null)
            {
                wb.InsertFromStreamGzip(fb);
            }


            try
            {
                wait = new WaitDialogForm("", "正在下载数据, 请稍候...");
                //txEdit1.ResetContents();
                //txEdit1.m_LoadStream(obj.RtfContents);
                if (obj.RtfContents != null && obj.RtfContents.Length > 0)
                {
                    if (fb != null)
                    {
                        wb.InsertFromStreamGzip(obj.RtfContents);
                        dsoFramerWordControl2.FileData = wb.FileData;
                    }
                    else
                    {
                        dsoFramerWordControl2.FileDataGzip = obj.RtfContents;
                    }

                    //////dsoFramerWordControl2.FileDataGzip = obj.RtfContents;
                }
                else
                {
                    ////////LayoutType lt1 = Services.BaseService.GetOneByKey<LayoutType>("LayoutModule");
                    ////////dsoFramerWordControl2.FileDataGzip = lt1.ExcelData;
                    dsoFramerWordControl2.FileNew();
                }

                //if (!(AddRight || EditRight))
                //    dsoFramerWordControl2.IsReadOnly = true;
                dsoFramerWordControl2.AxFramerControl.Menubar = true;
                wait.Close();
            }
            catch (Exception ex)
            {
                //dsoFramerWordControl2.FileDataGzip = wb.FileDataGzip;
                wait.Close();
                MessageBox.Show(ex.Message);
            }                                 //MsgBox.Show("程序发生异常,请检查Office是否安装正确!"); }
        }