示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Formatshapes fobj = new Formatshapes();
            int          sldNum;
            string       shpname;

            sldNum  = Convert.ToInt32(lblErrortype.Text.Replace("Format Review : Slide =", ""));
            shpname = chk_shpname.Text;
            fobj.CorrectFormat_Selected(sldNum, shpname);
            this.Close();
        }
示例#2
0
        private void btn_Caption_Click(object sender, EventArgs e)
        {
            int           sld_num = ppApp.ActiveWindow.Selection.SlideRange.SlideNumber;
            float         top_adjust = 0;
            int           cnt = 0;
            Formatshapes  obj = new Formatshapes();
            string        CAGR, dText = null;
            List <string> SelectedCharts = new List <string>();

            try
            {
                SelectedCharts = PPTshpchk.FindSelectedCharts();
                string           shp_nam = SelectedCharts[0];
                PowerPoint.Shape myShape = ActivePPT.Slides[sld_num].Shapes[shp_nam];
                int num_shapes           = ActivePPT.Slides[sld_num].Shapes.Count;
                for (int i = 1; i <= num_shapes; i++)
                {
                    if (ActivePPT.Slides[sld_num].Shapes[i].Name == shp_nam + " CAGR Box")
                    {
                        cnt++;
                    }
                }
                if (cnt > 0)
                {
                    top_adjust = (float)18.13 * cnt + 5;
                }
                CAGR = lbl_Value.Text;
                string cmbText = cmb_calcType.Text;
                if (cmbText == "AAGR")
                {
                    dText = "AAGR (" + cmb_stDate.Text + "–" + cmb_endDate.Text + "): " + CAGR;
                }
                else
                {
                    if (CAGR.Substring(0, 1) != "-")
                    {
                        dText = "CAGR (" + cmb_stDate.Text + "–" + cmb_endDate.Text + "): " + CAGR;
                    }
                    else if (CAGR.Substring(0, 1) == "-")
                    {
                        dText = "CARC (" + cmb_stDate.Text + "–" + cmb_endDate.Text + "): " + CAGR;
                    }
                }

                float tp = ActivePPT.Slides[sld_num].Shapes[shp_nam].Top;
                foreach (PowerPoint.Shape shp in ActivePPT.Slides[sld_num].Shapes)
                {
                    if (shp.Name == shp_nam + " CAGR Box")
                    {
                        shp.Delete();
                        break;
                    }
                }

                PowerPoint.Shape aShp = ActivePPT.Slides[sld_num].Shapes.AddShape(MsoAutoShapeType.msoShapeRectangle, myShape.Left + myShape.Width, myShape.Top + top_adjust, 120, (float)23.5);
                aShp.TextFrame.TextRange.Text           = dText;
                aShp.TextEffect.Alignment               = MsoTextEffectAlignment.msoTextEffectAlignmentCentered;
                aShp.TextFrame.TextRange.Font.Bold      = MsoTriState.msoTrue;
                aShp.TextFrame.TextRange.Font.Size      = 12;
                aShp.TextFrame.TextRange.Font.Color.RGB = System.Drawing.Color.FromArgb(0, 0, 0).ToArgb();
                aShp.TextFrame.TextRange.Font.Name      = "Calibri";
                aShp.Fill.Visible       = MsoTriState.msoFalse;
                aShp.Line.Weight        = (float)0.75;
                aShp.Line.DashStyle     = MsoLineDashStyle.msoLineSolid;
                aShp.Line.Style         = MsoLineStyle.msoLineSingle;
                aShp.Line.Transparency  = 0;
                aShp.Line.Visible       = MsoTriState.msoTrue;
                aShp.Line.ForeColor.RGB = System.Drawing.Color.FromArgb(23, 94, 84).ToArgb();
                aShp.Line.BackColor.RGB = System.Drawing.Color.FromArgb(23, 94, 84).ToArgb();
                aShp.Name = shp_nam + " CAGR Box";
                string     objType   = "Cagr Box";
                PPTActions actionObj = new PPTActions();
                DataTable  dt        = actionObj.get_specification(objType);
                obj.FormatShape(sld_num, aShp.Name, dt, false, false);
                this.Close();
            }
            catch (Exception err)
            {
                this.Close();
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "btn_Caption_Click");
                MessageBox.Show("Check chart type and chart value", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        private void btn_Review_Click(object sender, EventArgs e)
        {
            string       whichSlides = cmb_RType.Text;
            Algorithms   algObj      = new Algorithms();
            List <int>   selSlides   = new List <int>();
            Reviewformat formatObj   = new Reviewformat();
            Formatshapes shpobj      = new Formatshapes();
            frmErrorlist frmObj      = new frmErrorlist();
            //int[] selSlides ;
            int selectedSlides = 0;

            try
            {
                bool uUnload = false, globalErrors = false;
                selectedSlides = ppApp.ActiveWindow.Selection.SlideRange.Count;
                this.Close();
                if (whichSlides == "Current" || whichSlides == "Selected")
                {
                    if (selectedSlides == 0)
                    {
                        MessageBox.Show("Please select a slide and try again"); this.Close();
                    }
                    else
                    {
                        for (int i = 1; i <= selectedSlides; i++)
                        {
                            selSlides.Add(ppApp.ActiveWindow.Selection.SlideRange[i].SlideIndex);
                        }
                        //Array.Sort(selSlides);
                        selSlides.Sort();
                    }
                }
                else if (whichSlides == "All")
                {
                    selectedSlides = ppApp.ActivePresentation.Slides.Count;
                    for (int i = 1; i <= selectedSlides; i++)
                    {
                        selSlides.Add(i);
                    }
                }
                if (selectedSlides == 0)
                {
                    MessageBox.Show("Please select a slide and try again"); this.Close(); return;
                }
                else
                {
                    for (int i = 0; i < selectedSlides; i++)
                    {
                        int sldNum = selSlides[i];
                        algObj.SetNamesUnique(sldNum);                            // -Set the unique name of each object for get the property
                        ppApp.ActiveWindow.View.GotoSlide(sldNum);
                        ActivePPT.Slides[sldNum].Select();
                        if (rb_Review.Checked == true)
                        {
                            formatObj.CheckFormat(sldNum, "method1");
                        }
                        else if (rb_ReviewCorrect.Checked == true)
                        {
                            formatObj.CheckFormat(sldNum, "method2");
                        }
                        else if (rb_CorrectAll.Checked == true)
                        {
                            shpobj.CorrectFormat(sldNum);
                        }
                    }
                    if (PPTAttribute.exitFlag == false)
                    {
                        MessageBox.Show("Format review and correction has been done", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                // - After review select a first slide
                if (rb_CorrectAll.Checked == true)
                {
                    MessageBox.Show("Format review and correction has been done", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                this.Close();               // Close the user forms
                if (whichSlides == "All")
                {
                    ActivePPT.Slides[1].Select();
                }
            }
            catch (Exception err)
            {
                PPTAttribute.exitFlag = true;
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "Review Format");
            }
        }
示例#4
0
        private void btn_Submit_Click(object sender, EventArgs e)
        {
            pptfunctions funObj       = new pptfunctions();
            PPTActions   actionObj    = new PPTActions();
            Formatshapes PPTshpFormat = new Formatshapes();

            ppApp.DisplayAlerts = PowerPoint.PpAlertLevel.ppAlertsNone;
            try
            {
                if (rbselectedppt.Checked == true)          // Work on Current PPT
                {
                    OpenedPPT.PageSetup.SlideWidth  = 960;
                    OpenedPPT.PageSetup.SlideHeight = 540;
                    ppApp.ActivePresentation.ApplyTheme(PPTAttribute.mPPTPath);
                    funObj.DeleteOldTSCMasters();

                    foreach (PowerPoint.Slide sld in OpenedPPT.Slides)
                    {
                        foreach (PowerPoint.Shape shp in sld.Shapes)
                        {
                            if (shp.Name == "Road Map" || shp.Name == "Title Box" || shp.Name == "Note Box" || shp.Name == "Source Box")
                            {
                                DataTable dt = actionObj.get_specification(shp.Name);
                                FormatShape(sld.SlideIndex, shp.Name, dt);
                            }
                        }
                    }
                    this.Close();
                }
                else if (rbselectedslide.Checked == true)   // Work on Current Slide
                {
                    OpenedPPT.PageSetup.SlideWidth  = 960;
                    OpenedPPT.PageSetup.SlideHeight = 540;
                    ppApp.ActivePresentation.ApplyTheme(PPTAttribute.mPPTPath);
                    funObj.DeleteOldTSCMasters();

                    int sldnum           = ppApp.ActiveWindow.Selection.SlideRange.SlideNumber;
                    PowerPoint.Slide sld = OpenedPPT.Slides[sldnum];
                    foreach (PowerPoint.Shape shp in sld.Shapes)
                    {
                        if (shp.Name == "Road Map" || shp.Name == "Title Box" || shp.Name == "Note Box" || shp.Name == "Source Box")
                        {
                            DataTable dt = actionObj.get_specification(shp.Name);
                            FormatShape(sld.SlideIndex, shp.Name, dt);
                        }
                    }
                    this.Close();
                }
                else if (rbtn_selectfolder.Checked == true)
                {
                    string pathString = System.IO.Path.Combine(selectedFolder, "TSC_PPT_29032018");
                    System.IO.Directory.CreateDirectory(pathString);
                    string pptPath = null, newfilepath = null;
                    int    rowscount = fileGridView.Rows.Count;
                    foreach (DataGridViewRow row in fileGridView.Rows)
                    {
                        //for templated control
                        if (Convert.ToBoolean(row.Cells[2].Value) == true)
                        {
                            string fileName = row.Cells[0].Value.ToString();
                            newfilepath = pathString + "\\" + fileName;
                            pptPath     = selectedFolder + "\\" + fileName;
                            OpenedPPT   = ppApp.Presentations.Open(pptPath);
                            //-- Apply New TSC Theme
                            ppApp.DisplayAlerts             = PowerPoint.PpAlertLevel.ppAlertsNone;
                            OpenedPPT.PageSetup.SlideWidth  = 960;
                            OpenedPPT.PageSetup.SlideHeight = 540;
                            ppApp.ActivePresentation.ApplyTheme(PPTAttribute.mPPTPath);
                            funObj.DeleteOldTSCMasters();
                            // -- Format Slide
                            foreach (PowerPoint.Slide sld in OpenedPPT.Slides)
                            {
                                foreach (PowerPoint.Shape shp in sld.Shapes)
                                {
                                    if (shp.Name == "Road Map" || shp.Name == "Title Box" || shp.Name == "Note Box" || shp.Name == "Source Box")
                                    {
                                        DataTable dt = actionObj.get_specification(shp.Name);
                                        FormatShape(sld.SlideIndex, shp.Name, dt);
                                    }
                                }
                            }
                            row.Cells[1].Value = "Done";
                            OpenedPPT.SaveAs(newfilepath);
                            OpenedPPT.Close();
                            // If Process has been done the update the status Done
                        }
                    } // Close Outer For loop
                    ppApp.DisplayAlerts = PowerPoint.PpAlertLevel.ppAlertsAll;
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "Format -All Slide");
            }
        }