コード例 #1
0
        public void DeleteFormatComments_M1(int sldNum)
        {
            int numComments = ActivePPT.Slides[sldNum].Comments.Count;

            try
            {
                if (numComments > 0)
                {
                    for (int xx = numComments; xx >= 1; xx--)
                    {
                        PowerPoint.Comment myComment = ActivePPT.Slides[sldNum].Comments[xx];
                        if (myComment.AuthorInitials == "TFR")
                        //if (myComment.Author == shpName + " Error" && myComment.AuthorInitials == "TFR")
                        {
                            myComment.Delete();
                            // break;
                        }
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "DeleteFormatComments_M1");
            }
        }
コード例 #2
0
        public void DeleteFormatComments_M3(int sldnum)
        {
            int numComments = ActivePPT.Slides[sldnum].Comments.Count;

            PowerPoint.Comment myComment = null;
            try
            {
                if (numComments > 0)
                {
                    for (int i = numComments; i >= 1; i--)
                    {
                        myComment = ActivePPT.Slides[sldnum].Comments[i];
                        if (myComment.AuthorInitials == "TFR")
                        {
                            myComment.Delete();
                        }
                    } // ---
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "DeleteFormatComments_M3");
            }
        }
コード例 #3
0
        /// <summary>
        ///     Add a comment to the specified slide
        /// </summary>
        /// <param name="slide">PPT.Slide object instance to add the comment to</param>
        /// <param name="comment">SlideComment object containing configuration for the slide comment</param>
        /// <returns></returns>
        public PPT.Slide AddComment(PPT.Slide slide, SlideComment comment)
        {
            PPT.Comment newComment = slide.Comments.Add(
                comment.LeftPosition,
                comment.TopPosition,
                comment.Author,
                comment.AuthorInitials,
                comment.Comment);

            return(slide);
        }
コード例 #4
0
        public void CheckFormat(int sldNum, string method)
        {
            shpNames.Clear();                               // Clear the list box -
            shpNames = NameAllShapes(sldNum);
            char          spltChar = '\n';
            List <string> errA     = new List <string>();
            string        shpName;

            try
            {
                if (shpNames.Count != 0)
                {
                    DeleteFormatComments_M1(sldNum);                    // Delete all comment from slide
                    for (int s = 0; s < shpNames.Count; s++)
                    {
                        shpErr = null;
                        PowerPoint.Shape shp = ActivePPT.Slides[sldNum].Shapes[shpNames[s]];
                        shpName = shp.Name;
                        shpErr  = shpErr + CheckFormat_ShapeInSlide(sldNum, shpName);
                        if (ActivePPT.Slides[sldNum].CustomLayout.Name == "Title Slide")
                        {
                            shpErr = shpErr + CheckFormat_TitleSlide(sldNum, shpName) + '\n';
                        }
                        else if (ActivePPT.Slides[sldNum].CustomLayout.Name == "Contents Slide")
                        {
                            shpErr = shpErr + CheckFormat_ContentSlide(sldNum, shpName) + '\n';
                        }
                        else if (ActivePPT.Slides[sldNum].CustomLayout.Name == "Divider Slide")
                        {
                            shpErr = shpErr + CheckFormat_DividerSlide(sldNum, shpName) + '\n';
                        }
                        else
                        {
                            shpErr = shpErr + CheckFormat_MainSlide(sldNum, shpName) + '\n';
                        }

                        errA  = shpErr.Split(spltChar).ToList();
                        errAU = UniqueValues(errA);
                        //string fshpErr = null;
                        //int counter = 1;
                        //foreach (string err in errAU)
                        //{
                        //    fshpErr = fshpErr + (counter + 1) + ")  " + err + '\n';
                        //}

                        if (method == "method1")
                        {
                            float lf = ActivePPT.Slides[sldNum].Shapes[shpName].Left;
                            float wb = ActivePPT.Slides[sldNum].Shapes[shpName].Width;
                            float tp = ActivePPT.Slides[sldNum].Shapes[shpName].Top;
                            if (shpErr != null && string.IsNullOrEmpty(shpErr.Replace("\n", "")) == false)
                            {
                                PowerPoint.Comment cmtNew = ActivePPT.Slides[sldNum].Comments.Add((lf + wb), tp, shpName + " Error", "TFR", shpErr);
                            }
                        }
                        else if (method == "method2")
                        {
                            if (shpErr != null && string.IsNullOrEmpty(shpErr.Replace("\n", "")) == false)
                            {
                                ActivePPT.Slides[sldNum].Shapes[shpName].Select();
                                List <string> lstError = new List <string>();
                                lstError = shpErr.Split('\n').ToList();
                                foreach (string errType in lstError)
                                {
                                    //MessageBox.Show("Static Value: " +Convert.ToString(PPTAttribute.exitFlag));
                                    if (errType != "" && PPTAttribute.exitFlag == false)
                                    {
                                        StreamWriter sw = new StreamWriter(PPTAttribute.supportfile);
                                        //string errtxt = sldNum + "|" + shpErr.Replace("\n", "") + "|" + shpName;
                                        string errtxt = sldNum + "|" + errType + "|" + shpName;
                                        sw.WriteLine(errtxt);
                                        frmErrorlist frmobj = new frmErrorlist();
                                        sw.Close();
                                        frmobj.ShowDialog();
                                    }
                                }
                            }
                        }
                    }// - Close Loop

                    //if (String.IsNullOrWhiteSpace(shpErr)) { MessageBox.Show("There is no error found in format review",PPTAttribute.msgTitle,MessageBoxButtons.OK, MessageBoxIcon.Information); }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "CheckFormat");
            }
        }