コード例 #1
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");
            }
        }
コード例 #2
0
ファイル: Shapecheck.cs プロジェクト: tdev131287/techandmate
        public string SelectedShapeNumber(int sldNum, PowerPoint.Shape selShape)
        {
            string selshpname = null;

            try
            {
                string selShpName = selShape.Name;
                float  selShpWd   = selShape.Width;
                float  selShpHt   = selShape.Height;
                float  selShpLf   = selShape.Left;
                float  selShpTp   = selShape.Top;

                for (int sn = 1; sn <= ActivePPT.Slides[sldNum].Shapes.Count; sn++)
                {
                    string tempShpName = ActivePPT.Slides[sldNum].Shapes[sn].Name;
                    float  tempShpWd   = ActivePPT.Slides[sldNum].Shapes[sn].Width;
                    float  tempShpHt   = ActivePPT.Slides[sldNum].Shapes[sn].Height;
                    float  tempShpLf   = ActivePPT.Slides[sldNum].Shapes[sn].Left;
                    float  tempShpTp   = ActivePPT.Slides[sldNum].Shapes[sn].Top;
                    if (tempShpName == selShpName && tempShpWd == selShpWd && tempShpHt == selShpHt && tempShpLf == selShpLf && tempShpTp == selShpTp)
                    {
                        selshpname = ActivePPT.Slides[sldNum].Shapes[sn].Name;
                        break;
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "SelectedShapeNumber");
            }
            return(selshpname);
        }
コード例 #3
0
 public MsoTriState getMsoTriState(int dbVal)
 {
     //int dbVal = Convert.ToInt32(dt.Rows[0]["FillVisible"]);
     try
     {
         if (dbVal == 1)
         {
             objValue = MsoTriState.msoCTrue;
         }
         else if (dbVal == 0)
         {
             objValue = MsoTriState.msoFalse;
         }
         else if (dbVal == -2)
         {
             objValue = MsoTriState.msoTriStateMixed;
         }
         else if (dbVal == -3)
         {
             objValue = MsoTriState.msoTriStateToggle;
         }
         else if (dbVal == -1)
         {
             objValue = MsoTriState.msoTrue;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "getMsoTriState");
     }
     return(objValue);
 }
コード例 #4
0
ファイル: tscformat.cs プロジェクト: tdev131287/techandmate
 public void Format_XGrids(PowerPoint.Chart myChart, bool hasXGrids, string chType)
 {
     try
     {
         if (chType == "Pie" || chType == "Doughnut")
         {
             if (hasXGrids == true)
             {
                 if (myChart.Axes(XlAxisType.xlCategory).HasMajorGridlines == true)
                 {
                     myChart.Axes(XlAxisType.xlCategory).MajorGridlines.Border.Color     = System.Drawing.Color.FromArgb(127, 127, 127).ToArgb();
                     myChart.Axes(XlAxisType.xlCategory).MajorGridlines.Border.LineStyle = PowerPoint.XlLineStyle.xlDot;
                 }
             }
             else if (hasXGrids == false)
             {
                 myChart.HasAxis[XlAxisType.xlCategory] = false;
             }
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "Format_XGrids");
     }
 }
コード例 #5
0
ファイル: Shapecheck.cs プロジェクト: tdev131287/techandmate
        public void CreateBullet(int sldNum, string shpname)
        {
            try
            {
                PowerPoint.TextRange txtRng = ActivePPT.Slides[sldNum].Shapes[shpname].TextFrame.TextRange;

                float indentVal  = (float)0.64;
                var   paragraphs = txtRng.Paragraphs(-1, -1);

                for (int index = 1; index <= txtRng.Paragraphs().Count; index++)
                {
                    //string paraText = txtRng.Paragraphs(index).Text;

                    txtRng.Paragraphs(index).IndentLevel = index;
                    txtRng.Paragraphs(index).ParagraphFormat.Alignment              = PowerPoint.PpParagraphAlignment.ppAlignLeft;
                    txtRng.Paragraphs(index).ParagraphFormat.HangingPunctuation     = MsoTriState.msoTrue;
                    txtRng.Paragraphs(index).ParagraphFormat.SpaceBefore            = 6;
                    txtRng.Paragraphs(index).ParagraphFormat.SpaceAfter             = 0;
                    txtRng.Paragraphs(index).ParagraphFormat.SpaceWithin            = (float)0.85;
                    txtRng.Paragraphs(index).Parent.Ruler.Levels[index].FirstMargin = indentVal;//18 * (index - 1);
                    txtRng.Paragraphs(index).Parent.Ruler.Levels[index].LeftMargin  = 18 * (index);
                    indentVal = indentVal + (float)0.47;
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "CreateBullet");
            }
        }
コード例 #6
0
 // -- Main method to correct Each shapes format
 public void CorrectFormat_Selected(int sldNum, string shpName)
 {
     try
     {
         PowerPoint.Presentation ActivePPT = ppApp.ActivePresentation;
         CorrectFormat_ShapeInSlide(sldNum, shpName);
         if (ActivePPT.Slides[sldNum].CustomLayout.Name == "Title Slide")
         {
             CorrectFormat_TitleSlide(sldNum, shpName);
         }
         else if (ActivePPT.Slides[sldNum].CustomLayout.Name == "Content Slide")
         {
             CorrectFormat_ContentSlide(sldNum, shpName);
         }
         else if (ActivePPT.Slides[sldNum].CustomLayout.Name == "Divider Slide")
         {
             CorrectFormat_DividerSlide(sldNum, shpName);
         }
         else
         {
             CorrectFormat_MainSlide(sldNum, shpName);
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "CorrectFormat_Selected");
     }
 }
コード例 #7
0
ファイル: Algorithms.cs プロジェクト: tdev131287/techandmate
        public void SetNamesUnique(int sldNum)
        {
            int shpCount = ActivePPT.Slides[sldNum].Shapes.Count;

            try
            {
                for (int i = 1; i <= shpCount; i++)
                {
                    PowerPoint.Shape osh = ActivePPT.Slides[sldNum].Shapes[i];
                    if (osh.Type == MsoShapeType.msoGroup)
                    {
                        for (int x = 1; x <= osh.GroupItems.Count; x++)
                        {
                            string shpName = osh.GroupItems[x].Name;
                            ChangeNames(sldNum, shpName, x);
                        }
                    }
                    else
                    {
                        string shpName = osh.Name;
                        ChangeNames(sldNum, shpName, i);
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "SetNamesUnique");
            }
        }
コード例 #8
0
ファイル: tscformat.cs プロジェクト: tdev131287/techandmate
 //'This function formats the y-grids line style, tick marks, title and ticklables font name, style, size, color, sub-super script, underline
 public void Format_YGrids(PowerPoint.Chart myChart, bool hasYAxis, string chType, bool ch3D)
 {
     try
     {
         bool hasYGrids = false;
         if (chType == "Pie" || chType == "Doughnut")
         {
             return;
         }
         if (chType == "Radar" || (hasYAxis && ch3D == true))
         {
             hasYGrids = true;
         }
         if (hasYGrids == true)
         {
             myChart.Axes(XlAxisType.xlValue).HasMajorGridlines               = true;
             myChart.Axes(XlAxisType.xlValue).MajorGridlines.Border.Color     = System.Drawing.Color.FromArgb(127, 127, 127).ToArgb();
             myChart.Axes(XlAxisType.xlValue).MajorGridlines.Border.LineStyle = PowerPoint.XlLineStyle.xlContinuous;
         }
         else if (hasYGrids == false)
         {
             myChart.Axes(XlAxisType.xlValue).HasMajorGridlines = false;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "Format_YGrids");
     }
 }
コード例 #9
0
 public PowerPoint.PpChangeCase txtChangeCase(int dbVal)
 {
     try
     {
         if (dbVal == 2)
         {
             objValue4 = PowerPoint.PpChangeCase.ppCaseLower;
         }
         else if (dbVal == 1)
         {
             objValue4 = PowerPoint.PpChangeCase.ppCaseSentence;
         }
         else if (dbVal == 4)
         {
             objValue4 = PowerPoint.PpChangeCase.ppCaseTitle;
         }
         else if (dbVal == 5)
         {
             objValue4 = PowerPoint.PpChangeCase.ppCaseToggle;
         }
         else if (dbVal == 3)
         {
             objValue4 = PowerPoint.PpChangeCase.ppCaseUpper;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "txtChangeCase");
     }
     return(objValue4);
 }
コード例 #10
0
        private void cmb_stDate_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int l = cmb_stDate.SelectedIndex;
                cmb_endDate.Items.Clear();
                for (int i = l; i < num_points; i++)
                {
                    string xx = Regex.Match(chtData[i, 0], @"\d+").Value;
                    cmb_endDate.Items.Add(xx);
                }
                cmb_endDate.SelectedIndex = cmb_endDate.Items.Count - 1;
                //Calculate_CAGR();

                string cmbText = cmb_calcType.Text;
                if (cmbText == "AAGR")
                {
                    Calculate_AAGR();
                }
                else
                {
                    Calculate_CAGR();
                }
            }
            catch (Exception err)
            {
                this.Close();
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "cmb_stDate_SelectedIndexChanged");
                MessageBox.Show("Check chart type and chart value", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #11
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");
            }
        }
コード例 #12
0
ファイル: Algorithms.cs プロジェクト: tdev131287/techandmate
 public void ChangeNames(int sldNum, string shpName, int index)
 {
     try
     {
         for (int j = 1; j <= ActivePPT.Slides[sldNum].Shapes.Count; j++)
         {
             PowerPoint.Shape osh1 = ActivePPT.Slides[sldNum].Shapes[j];
             if (osh1.Type == MsoShapeType.msoGroup)
             {
                 for (int y = 1; y <= osh1.GroupItems.Count; y++)
                 {
                     string tName = osh1.GroupItems[y].Name;
                     if (tName == shpName && y != index)
                     {
                         osh1.GroupItems[y].Name = osh1.GroupItems[y].Name + "_C";
                     }
                 }
             }
             else
             {
                 string tName = osh1.Name;
                 if (tName == shpName && j != index)
                 {
                     osh1.Name = osh1.Name + "_C";
                 }
             }
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "ChangeNames");
     }
 }
コード例 #13
0
 public PowerPoint.PpBulletType getPpBulletType(int dbVal)
 {
     try
     {
         if (dbVal == 1)
         {
             objValue5 = PowerPoint.PpBulletType.ppBulletUnnumbered;
         }
         else if (dbVal == -2)
         {
             objValue5 = PowerPoint.PpBulletType.ppBulletMixed;
         }
         else if (dbVal == 0)
         {
             objValue5 = PowerPoint.PpBulletType.ppBulletNone;
         }
         else if (dbVal == 2)
         {
             objValue5 = PowerPoint.PpBulletType.ppBulletNumbered;
         }
         else if (dbVal == 3)
         {
             objValue5 = PowerPoint.PpBulletType.ppBulletPicture;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "getPpBulletType");
     }
     return(objValue5);
 }
コード例 #14
0
 public static void saveSpacification(StringBuilder str, string shpName)
 {
     try
     {
         string newPath = logfile + @"TheSmartCube\Log\";
         string path    = newPath + "Spacification_" + shpName + ".txt";
         if (!File.Exists(path))
         {
             using (StreamWriter sw = File.CreateText(path))
             {
                 sw.WriteLine(str);
                 sw.Close();
             }
         }
         else if (File.Exists(path))
         {
             using (StreamWriter sw = File.AppendText(path))
             {
                 sw.WriteLine(str);
                 sw.Close();
             }
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "saveSpacification");
     }
 }
コード例 #15
0
ファイル: tscformat.cs プロジェクト: tdev131287/techandmate
        public void Format_Series(PowerPoint.Chart myChart, bool hasYAxis, string chType)
        {
            try
            {
                //bool secAxis = false;
                PowerPoint.SeriesCollection sc = myChart.SeriesCollection();
                if (chType == "Pie" || chType == "Doughnut" || chType == "Surface")
                {
                    return;
                }
                if (chType == "Column")
                {
                    for (int i = 1; i <= sc.Count; i++)
                    {
                        PowerPoint.Series chartSeries = myChart.SeriesCollection(i);

                        myChart.SeriesCollection(i).Format.Line.Visible       = MsoTriState.msoTrue;
                        myChart.SeriesCollection(i).Format.Line.ForeColor.RGB = System.Drawing.Color.FromArgb(255, 255, 255).ToArgb();
                        chartSeries.Format.Line.Weight = (float)0.75;
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "Format_PlotArea");
            }
        }
コード例 #16
0
        public void CorrectFormat_DividerSlide(int sldNum, string shpName)
        {
            try
            {
                PowerPoint.Shape shp = ActivePPT.Slides[sldNum].Shapes[shpName];
                if (shp.Type == MsoShapeType.msoAutoShape || shp.Type == MsoShapeType.msoPlaceholder || shp.Type == MsoShapeType.msoTextBox)
                {
                    if (shp.HasTextFrame == MsoTriState.msoTrue)
                    {
                        DataTable dt1    = actionObj.get_specification("Section Title");
                        string    STitle = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt1);

                        DataTable dt2      = actionObj.get_specification("Section Content");
                        string    SContent = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt2);

                        if (shpName == STitle && dt1.Rows.Count != 0)
                        {
                            FormatShape(sldNum, shpName, dt1, false);
                        }
                        else if (shpName == SContent && dt2.Rows.Count != 0)
                        {
                            FormatShape(sldNum, shpName, dt2, false);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "CorrectFormat_DividerSlide");
            }
        }
コード例 #17
0
        public static void ErrorLog(string ErrDis, string rib)
        {
            String strUserName;
            String strWholeText;

            try
            {
                PowerPoint.Presentation ActivePPT = Globals.ThisAddIn.Application.ActivePresentation;
                string newPath;
                if (!Directory.Exists(logfile + @"TheSmartCube\Log\"))
                {
                    newPath = logfile + @"TheSmartCube\Log\";
                }
                else
                {
                    newPath = logfile + @"TheSmartCube\Log\";
                }
                System.IO.Directory.CreateDirectory(newPath);
                string path = newPath + "ErrorLog_" + DateTime.Now.ToString("ddMMyyyy") + ".txt";
                strUserName = Environment.UserName;
                if (rib.Length <= 12)
                {
                    return;
                }
                if (getButtonDiscription(rib) != null)
                {
                    strWholeText = strUserName + "|" + getButtonDiscription(rib) + "|" + ErrDis + "|" + DateTime.Now.ToString() + "|" + ActivePPT.Name;
                }
                else
                {
                    strWholeText = strUserName + "|" + rib + "|" + ErrDis + "|" + DateTime.Now.ToString() + "|" + ActivePPT.Name;
                }
                if (!File.Exists(path))
                {
                    //File.Create(path);
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(strWholeText);
                        sw.Close();
                    }
                }
                else if (File.Exists(path))
                {
                    using (StreamWriter sw = File.AppendText(path))
                    {
                        sw.WriteLine(strWholeText);
                        sw.Close();
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "ErrorLog");
            }
        }
コード例 #18
0
ファイル: Shapecheck.cs プロジェクト: tdev131287/techandmate
        public bool chart3D(PowerPoint.Chart myChart)
        {
            bool chart3dVal = false;

            try
            {
                if (myChart.ChartType == XlChartType.xl3DBarClustered || myChart.ChartType == XlChartType.xl3DBarStacked || myChart.ChartType == XlChartType.xl3DBarStacked100 ||
                    myChart.ChartType == XlChartType.xlCylinderBarClustered || myChart.ChartType == XlChartType.xlCylinderBarStacked || myChart.ChartType == XlChartType.xlCylinderBarStacked100 ||
                    myChart.ChartType == XlChartType.xlConeBarClustered || myChart.ChartType == XlChartType.xlConeBarStacked || myChart.ChartType == XlChartType.xlConeBarStacked100 ||
                    myChart.ChartType == XlChartType.xlPyramidBarClustered || myChart.ChartType == XlChartType.xlPyramidBarStacked || myChart.ChartType == XlChartType.xlPyramidBarStacked100)
                {
                    chart3dVal = true;
                }
                else if (myChart.ChartType == XlChartType.xl3DColumnClustered || myChart.ChartType == XlChartType.xl3DColumnStacked || myChart.ChartType == XlChartType.xl3DColumnStacked100 ||
                         myChart.ChartType == XlChartType.xlCylinderColClustered || myChart.ChartType == XlChartType.xlCylinderColStacked || myChart.ChartType == XlChartType.xlCylinderColStacked100 ||
                         myChart.ChartType == XlChartType.xlConeColClustered || myChart.ChartType == XlChartType.xlConeColStacked || myChart.ChartType == XlChartType.xlConeColStacked100 ||
                         myChart.ChartType == XlChartType.xlPyramidColClustered || myChart.ChartType == XlChartType.xlPyramidColStacked || myChart.ChartType == XlChartType.xlPyramidColStacked100 ||
                         myChart.ChartType == XlChartType.xl3DColumn || myChart.ChartType == XlChartType.xlConeCol || myChart.ChartType == XlChartType.xlCylinderCol || myChart.ChartType == XlChartType.xlPyramidCol)
                {
                    chart3dVal = true;
                }
                else if (myChart.ChartType == XlChartType.xl3DLine)
                {
                    chart3dVal = true;
                }
                else if (myChart.ChartType == XlChartType.xl3DPie || myChart.ChartType == XlChartType.xl3DPieExploded)
                {
                    chart3dVal = true;
                }
                else if (myChart.ChartType == XlChartType.xl3DArea || myChart.ChartType == XlChartType.xl3DAreaStacked || myChart.ChartType == XlChartType.xl3DAreaStacked100)
                {
                    chart3dVal = true;
                }
                else if (myChart.ChartType == XlChartType.xlBubble3DEffect)
                {
                    chart3dVal = true;
                }
                else if (myChart.ChartType == XlChartType.xlSurface || myChart.ChartType == XlChartType.xlSurfaceWireframe)
                {
                    chart3dVal = true;
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "chart3D");
            }

            return(chart3dVal);
        }
コード例 #19
0
ファイル: Shapecheck.cs プロジェクト: tdev131287/techandmate
        // Function chekc if shape allready exist the return shape name
        public string  CheckIfBoxAlreadyExist1(int sldIndex, DataTable dt)
        {
            int    boxNum      = 0;
            String returnValue = null;

            try
            {
                string shpName   = Convert.ToString(dt.Rows[0]["Name"]);
                float  shpLeft   = (float)Convert.ToDecimal((dt.Rows[0]["ShapeLeft"]));
                float  shpTop    = (float)Convert.ToDecimal((dt.Rows[0]["ShapeTop"]));
                float  shpWidth  = (float)Convert.ToDecimal((dt.Rows[0]["ShapeWidth"]));
                float  shpHeight = (float)Convert.ToDecimal((dt.Rows[0]["ShapeHeight"]));

                int shpCount = ActivePPT.Slides[sldIndex].Shapes.Count;
                int cnt      = 0;
                foreach (PowerPoint.Shape shp in ActivePPT.Slides[sldIndex].Shapes)
                {
                    if (shp.Name == shpName)
                    {
                        cnt++;
                    }
                }
                if (cnt == 0)
                {
                    boxNum = FindWhenNoBox(sldIndex, shpName, shpWidth, shpHeight, shpLeft, shpTop);
                }
                else if (cnt == 1)
                {
                    boxNum = FindWhenOneBox(sldIndex, shpName, shpWidth, shpHeight, shpLeft, shpTop);
                }
                else if (cnt > 1)
                {
                    boxNum = FindWhenMultipleBox(sldIndex, shpName, shpWidth, shpHeight, shpLeft, shpTop);
                }
                if (boxNum > 0)
                {
                    returnValue = ActivePPT.Slides[sldIndex].Shapes[boxNum].Name;
                }
                else
                {
                    returnValue = null;
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "CheckIfBoxAlreadyExist1");
            }
            return(returnValue);
        }
コード例 #20
0
        public float fCalculateHypotenuse(float sngBase, float sngHeight)
        {
            float fCalculate = 0;

            try
            {
                //fCalculate = Math.Sqrt(sngBase ^ 2 + sngHeight ^ 2);
                fCalculate = (float)Math.Sqrt(Math.Pow(sngBase, 2) + Math.Pow(sngHeight, 2));
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "fCalculateHypotenuse");
            }
            return(fCalculate);
        }
コード例 #21
0
        static public void UserTracker(Office.IRibbonControl rib)
        {
            String strUserName;
            String strWholeText;

            try
            {
                PowerPoint.Presentation ActivePPT = Globals.ThisAddIn.Application.ActivePresentation;
                string newPath;
                if (!Directory.Exists(logfile + @"TheSmartCube\Log\"))
                {
                    newPath = logfile + @"TheSmartCube\Log\";
                }
                else
                {
                    newPath = logfile + @"TheSmartCube\Log\";
                }
                string path = newPath + "UserLog_" + DateTime.Now.ToString("ddMMyyyy") + ".txt";
                strUserName = Environment.UserName;

                strWholeText = strUserName + "|" + getButtonDiscription(rib.Id) + "|" + DateTime.Now.ToString() + "|" + ActivePPT.Name;

                if (!File.Exists(path))
                {
                    //File.Create(path);
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(strWholeText);
                        sw.Close();
                    }
                }
                else if (File.Exists(path))
                {
                    using (StreamWriter sw = File.AppendText(path))
                    {
                        sw.WriteLine(strWholeText);
                        sw.Close();
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "UserTracker");
                //MessageBox.Show("Error in errorlog After Apply Theme");
            }
        }
コード例 #22
0
        public string CheckFormat_MainSlide(int sldNum, string shpName)
        {
            string shperr = null;
            string dbShape;

            try
            {
                DataTable        dt1 = new DataTable();                 // Get the specification of Title
                PowerPoint.Shape shp = ActivePPT.Slides[sldNum].Shapes[shpName];
                if (shp.Type == MsoShapeType.msoAutoShape || shp.Type == MsoShapeType.msoPlaceholder || shp.Type == MsoShapeType.msoTextBox)
                {
                    if (shp.HasTextFrame == MsoTriState.msoTrue)
                    {
                        // -----------------------------------------------------------
                        int hasspliter = shpName.IndexOf("_");
                        if (hasspliter != -1)
                        {
                            dbShape = shpName.Substring(0, hasspliter);
                        }
                        else
                        {
                            dbShape = shpName;
                        }
                        if (dbShape == "Text Box")
                        {
                            return(shperr);
                        }                                                              // -Avoid a Text box review
                        dt1 = actionObj.get_specification(dbShape);
                        if (dt1.Rows.Count != 0)
                        {
                            shperr = shperr + CheckFormat_SBox(sldNum, shpName, dt1);
                        }
                        ;
                    }
                }
                else if (shp.Type == MsoShapeType.msoChart)
                {
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "CheckFormat_MainSlide");
            }
            return(shperr);
        }
コード例 #23
0
        public string CheckFormat_TitleSlide(int sldNum, string shpName)
        {
            string shperr = null, sErr = null;

            //bool Tchkfind = false, Dchkfind=false,client=false;

            try
            {
                PowerPoint.Shape shp = ActivePPT.Slides[sldNum].Shapes[shpName];
                if (shp.Type == MsoShapeType.msoAutoShape || shp.Type == MsoShapeType.msoPlaceholder || shp.Type == MsoShapeType.msoTextBox)
                {
                    if (shp.HasTextFrame == MsoTriState.msoTrue)
                    {
                        DataTable dt1      = actionObj.get_specification("Project Title");
                        string    Tchkfind = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt1);

                        DataTable dt2      = actionObj.get_specification("Project Date");
                        string    Dchkfind = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt2);

                        DataTable dt3    = actionObj.get_specification("Client Name");
                        string    client = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt3);

                        if (Tchkfind == shpName && dt1.Rows.Count != 0)
                        {
                            sErr = sErr + CheckFormat_SBox(sldNum, shpName, dt1);
                        }
                        else if (Dchkfind == shpName && dt2.Rows.Count != 0)
                        {
                            sErr = sErr + CheckFormat_SBox(sldNum, shpName, dt2);
                        }
                        else if (client == shpName && dt3.Rows.Count != 0)
                        {
                            sErr = sErr + CheckFormat_SBox(sldNum, shpName, dt3);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "CheckFormat_TitleSlide");
            }
            return(sErr);
        }
コード例 #24
0
 public PowerPoint.PpParagraphAlignment ParagraphFormatAlignment(int dbVal)
 {
     try
     {
         if (dbVal == 2)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignCenter;
         }
         else if (dbVal == 5)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignDistribute;
         }
         else if (dbVal == 4)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignJustify;
         }
         else if (dbVal == 7)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignJustifyLow;
         }
         else if (dbVal == 1)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignLeft;
         }
         else if (dbVal == -2)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignmentMixed;
         }
         else if (dbVal == 3)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignRight;
         }
         else if (dbVal == 6)
         {
             objValue3 = PowerPoint.PpParagraphAlignment.ppAlignThaiDistribute;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "getMsoTriState");
     }
     return(objValue3);
 }
コード例 #25
0
ファイル: tscformat.cs プロジェクト: tdev131287/techandmate
        public void Format_Legend(PowerPoint.Chart myChart, bool hasLegend)
        {
            int Num;

            try
            {
                if (hasLegend == true)
                {
                    if (myChart.HasLegend == true)
                    {
                        PowerPoint.LegendEntries ln = myChart.Legend.LegendEntries();
                        Num = ln.Count;
                    }
                    else
                    {
                        PowerPoint.SeriesCollection sc = myChart.SeriesCollection();
                        Num = sc.Count;
                    }
                    if (Num > 1)
                    {
                        if (myChart.HasLegend == false)
                        {
                            myChart.HasLegend = true;
                        }
                        myChart.Legend.Font.Name = "Calibri";
                        myChart.Legend.Font.Size = 11;
                        myChart.Legend.Font.Bold = MsoTriState.msoFalse;
                        myChart.Legend.Position  = PowerPoint.XlLegendPosition.xlLegendPositionBottom;
                    }
                    else if (hasLegend == false)
                    {
                        if (myChart.HasLegend == true)
                        {
                            myChart.Legend.Delete();
                        }
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "Format_Legend");
            }
        }
コード例 #26
0
 public MsoTextOrientation getOrientation(int dVal)
 {
     try
     {
         if (dVal == 3)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationDownward;
         }
         else if (dVal == 3)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationDownward;
         }
         else if (dVal == 1)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationHorizontal;
         }
         else if (dVal == 6)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationHorizontalRotatedFarEast;
         }
         else if (dVal == -2)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationMixed;
         }
         else if (dVal == 2)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationUpward;
         }
         else if (dVal == 5)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationVertical;
         }
         else if (dVal == 4)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationVerticalFarEast;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "getOrientation");
     }
     return(objValue6);
 }
コード例 #27
0
        public string CheckFormat_ContentSlide(int sldNum, string shpName)
        {
            string shperr = null;

            try
            {
                PowerPoint.Shape shp = ActivePPT.Slides[sldNum].Shapes[shpName];
                if (shp.Type == MsoShapeType.msoAutoShape || shp.Type == MsoShapeType.msoPlaceholder || shp.Type == MsoShapeType.msoTextBox)
                {
                    if (shp.HasTextFrame == MsoTriState.msoTrue)
                    {
                        DataTable dt       = actionObj.get_specification("Content Title");
                        string    CTitle   = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt);
                        DataTable dt1      = actionObj.get_specification("Content Section");
                        string    CSection = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt1);
                        DataTable dt2      = actionObj.get_specification("Content Number");
                        string    CNumber  = chkObj.CheckIfBoxAlreadyExist1(sldNum, dt2);
                        if (shpName == CTitle && dt.Rows.Count != 0)
                        {
                            shperr = shperr + CheckFormat_SBox(sldNum, shpName, dt);
                        }
                        else if (shpName == CSection && dt1.Rows.Count != 0)
                        {
                            shperr = shperr + CheckFormat_SBox(sldNum, shpName, dt1);
                        }
                        else if (shpName == CNumber && dt2.Rows.Count != 0)
                        {
                            shperr = shperr + CheckFormat_SBox(sldNum, shpName, dt2);
                        }
                    }
                }
                else
                {
                    shpErr = shpErr + "Non Standard object in the slide." + '\n';
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "CheckFormat_ContentSlide");
            }
            return(shperr);
        }
コード例 #28
0
        public void Calculate_AAGR()
        {
            List <float> diffVal = new List <float>();

            lbl_Value.Text = "";
            float sum = 0;
            int   stYear, lYear;

            try
            {
                int type = cmb_Series.SelectedIndex + 1;
                stYear = Convert.ToInt32(cmb_stDate.Text);
                lYear  = Convert.ToInt32(cmb_endDate.Text);
                for (int x = 1; x < num_points; x++)
                {
                    string output = Regex.Match(chtData[x, 0], @"\d+").Value;
                    int    year   = (int)Convert.ToDouble(output);


                    if (year >= stYear && year <= lYear)
                    {
                        float diff = (float)Convert.ToDouble(chtData[x, type]) / (float)Convert.ToDouble(chtData[x - 1, type]);
                        diff = diff - 1;
                        diffVal.Add(diff);
                    }
                }
                foreach (float x in diffVal)
                {
                    sum = sum + x;
                }
                float AAGR = sum / diffVal.Count;
                lbl_type.Text  = "AAGR";
                lbl_Value.Text = AAGR.ToString("P");
            }
            catch (Exception err)
            {
                //this.Close();
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "Calculate_AAGR");
                MessageBox.Show("Check chart type and chart value", PPTAttribute.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #29
0
        public List <int> get_RGBValue(string rgbValue)
        {
            List <string> rgbIndex      = new List <string>();
            List <int>    finalrgbIndex = new List <int>();

            try
            {
                rgbIndex = rgbValue.Split(splitChar).ToList();
                foreach (string item in rgbIndex)
                {
                    finalrgbIndex.Add(Convert.ToInt32(item));
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "get_RGBValue");
            }
            return(finalrgbIndex);
        }
コード例 #30
0
ファイル: tscformat.cs プロジェクト: tdev131287/techandmate
 public void Format_Title(PowerPoint.Chart myChart)
 {
     try
     {
         myChart.HasTitle                      = true;
         myChart.ChartTitle.Font.Name          = "Calibri";
         myChart.ChartTitle.Font.Bold          = MsoTriState.msoTrue;
         myChart.ChartTitle.Font.Size          = 11;
         myChart.ChartTitle.Font.Color         = System.Drawing.Color.FromArgb(0, 0, 0).ToArgb();
         myChart.ChartTitle.Font.Strikethrough = MsoTriState.msoFalse;
         myChart.ChartTitle.Font.Superscript   = MsoTriState.msoFalse;
         myChart.ChartTitle.Font.Subscript     = MsoTriState.msoFalse;
         myChart.ChartTitle.Font.Shadow        = MsoTriState.msoFalse;
         myChart.ChartTitle.Font.Underline     = XlUnderlineStyle.xlUnderlineStyleNone;
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "Format_Title");
     }
 }