Exemplo n.º 1
0
        private void Send_btn_Click(object sender, EventArgs e)
        {
            if (Tabs_cbx.Text == "")
            {
                MessageBox.Show("Please Select a Tab", "Select a Tab", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Tabs_cbx.Focus();
                return;
            }
            PlanSwift.Tab CurrentTab;
            CurrentTab = TGlobal.pc.Tabs.ByName(Tabs_cbx.Text);
            CurrentTab.MakeActive();
            AuCad         = new Autodesk.AutoCAD.Interop.AcadApplication();
            AuCad.Visible = true;
            AuDocument    = AuCad.ActiveDocument;

            for (int ItemIndex = 0; ItemIndex <= CurrentTab.Count - 1; ItemIndex++)
            {
                GetItems(CurrentTab[ItemIndex]);
            }

            AuCad.ZoomAll();
            AuCad      = null;
            AuDocument = null;
            this.Close();
        }
Exemplo n.º 2
0
        private void Send_btn_Click(object sender, EventArgs e)
        {
            if (Tabs_cbx.Text == "")
            {
                MessageBox.Show("Please Select a Tab", "Select a Tab", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Tabs_cbx.Focus();
                return;
            }

            // Start Word and Get Application Object
            oWord = new Word.Application();
            PlanSwift.Tab CurrentTab;
            oWord.Visible = true;
            object FilePath  = Environment.CurrentDirectory + @"\Templates\Work Order.dotx";
            object Readonly  = false;
            object missing   = System.Reflection.Missing.Value;
            object isVisible = true;
            object TStyle    = "Medium Shading 1 - Accent 1";

            //Open Template
            oDocument = (Word._Document)oWord.Documents.Open(ref FilePath, ref missing, ref Readonly, ref missing, ref missing,
                                                             ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible,
                                                             ref missing, ref missing, ref missing, ref missing);
            // Apply Table Formating Style
            oDocument.Tables[2].set_Style(ref TStyle);
            oDocument.Tables[2].Columns[3].Width = 40;
            oDocument.Tables[2].Columns[4].Width = 70;

            // Get Planswift Items
            CurrentTab = TGlobal.pc.Tabs.ByName(Tabs_cbx.Text);
            CurrentTab.MakeActive();
            for (int ItemIndex = 0; ItemIndex <= CurrentTab.Count - 1; ItemIndex++)
            {
                GetItems(CurrentTab[ItemIndex]);
            }

            //Delete Last unused Row
            oDocument.Tables[2].Rows[ItemNumber].Delete();
            //Free Microsoft Word
            oWord     = null;
            oDocument = null;
            this.Close();
        }