private static List<PowerPoint.Shape> GetShapesFromLinesInText(PowerPointSlide currentSlide, Office.TextRange2 text, PowerPoint.Shape shape)
        {
            List<PowerPoint.Shape> shapesToAnimate = new List<PowerPoint.Shape>();

            foreach (Office.TextRange2 line in text.Lines)
            {
                PowerPoint.Shape highlightShape = currentSlide.Shapes.AddShape(
                    Office.MsoAutoShapeType.msoShapeRoundedRectangle,
                    line.BoundLeft,
                    line.BoundTop,
                    line.BoundWidth,
                    line.BoundHeight);

                highlightShape.Adjustments[1] = 0.25f;
                highlightShape.Fill.ForeColor.RGB = Utils.Graphics.ConvertColorToRgb(backgroundColor);
                highlightShape.Fill.Transparency = 0.50f;
                highlightShape.Line.Visible = Office.MsoTriState.msoFalse;
                Utils.Graphics.MoveZToJustBehind(highlightShape, shape);
                highlightShape.Name = "PPTLabsHighlightTextFragmentsShape" + Guid.NewGuid().ToString();
                highlightShape.Tags.Add("HighlightTextFragment", highlightShape.Name);
                highlightShape.Select(Office.MsoTriState.msoFalse);
                shapesToAnimate.Add(highlightShape);
            }

            return shapesToAnimate;
        }
예제 #2
0
        public DataTable get_ChatColorCode(string colname, int srCount)
        {
            DataTable dt = new DataTable();
            string    qText;
            string    cnText = @"Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";Data Source=" + PPTAttribute.dbPath;

            if (srCount <= 5)
            {
                qText = "select " + colname + " from [ChartColor$A1:E11]";
            }
            else
            {
                qText = "select " + colname + " from [ChartColor$J1:N11]";
            }
            try
            {
                OleDbDataAdapter da = new OleDbDataAdapter(qText, cnText);
                da.Fill(dt);
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "get_ChatColorCode");
            }
            return(dt);
        }
예제 #3
0
파일: ThisAddIn.cs 프로젝트: minikie/test
        void writeToText_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            try
            {
                System.DateTime currentDateTime = System.DateTime.Now;
                string dateStamp = currentDateTime.ToString("yyyyMMdd");

                string fileName =
                    System.Environment.GetFolderPath
                    (Environment.SpecialFolder.MyDocuments) + "\\\\" + dateStamp + ".txt";
                System.IO.StreamWriter sw = new System.IO.StreamWriter(fileName);

                foreach (Excel.Range cell in selectedCells.Cells)
                {
                    if (cell.Value2 != null)
                    {
                        sw.WriteLine(cell.Value2.ToString());
                    }
                }
                sw.Close();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
예제 #4
0
 void taggerMenuItem_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
 {
     //TagWindow win = new TagWindow();
     //TagWindowWpf win = new TagWindowWpf();
     var win = new TestWpfApp.MainWindow();
     win.Show();
 }
예제 #5
0
        public void OnButtonClick(Office.IRibbonControl control)
        {
            Microsoft.Office.Interop.Outlook.Inspector
                myInspector = Globals.ThisAddIn.Application.ActiveInspector();

            // Only works in Word
            if (myInspector.EditorType == Outlook.OlEditorType.olEditorWord)
            {
                Word.Document wd = (Word.Document)myInspector.WordEditor;

                object start = wd.Application.Selection.Range.Start;
                object end = wd.Application.Selection.Range.End;
                Word.Range rng = wd.Range(ref start, ref end);

                // Get pre designated color.
                int iColor = Convert.ToInt32(Globals.ThisAddIn.strColor);
                rng.Text = " [" + Globals.ThisAddIn.strName + " - " + System.DateTime.Now.ToString("MMM d, yyyy", CultureInfo.CreateSpecificCulture("en-US")) + "] ";

                rng.Select();
                rng.Font.Color = (Microsoft.Office.Interop.Word.WdColor)iColor;
                rng.Start = rng.End;
                rng.Select();
            }
            else
            {
                MessageBox.Show("The Signiture add-in will only work when Outlook is using the Word editor. You can change your editor under Outlook options");
            }
        }
 /// <summary>
 /// Recursively construct the node's XPath, something like 
 ///   /answers/repeat[@qref='rpt1']/row[1]/answer[@id='qa_1']
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public static string getXPath(Office.CustomXMLNode node)
 {
     if (node.BaseName.Equals("answers"))
     {
         return "/oda:answers";
     }
     else if (node.BaseName.Equals("answer"))
     {
         return getXPath(node.ParentNode) + "/oda:answer[@id='"
             + CustomXMLNodeHelper.getAttribute(node, "id") + "']";
     }
     else if (node.BaseName.Equals("row"))
     {
         return getXPath(node.ParentNode) + "/oda:row[1]";
     }
     else if (node.BaseName.Equals("repeat"))
     {
         return getXPath(node.ParentNode) + "/oda:repeat[@qref='"
             + CustomXMLNodeHelper.getAttribute(node, "qref") + "']";
     }
     else if (node.NamespaceURI.Equals("http://opendope.org/answers"))
     {
         return getXPath(node.ParentNode) + "/oda:" + node.BaseName + "[1]";
     }
     else
     {
         return getXPath(node.ParentNode) + "/" + node.BaseName + "[1]";
     }
 }
예제 #7
0
        /// <summary>
        /// Stuff required to create XPath element
        /// (except for ID, which this method generates)
        /// </summary>
        /// <param name="xpath"></param>
        /// <param name="storeItemID"></param>
        /// <param name="prefixMappings"></param>
        /// <param name="questionID"></param>
        public static xpathsXpath updateXPathsPart(
            Office.CustomXMLPart xpathsPart,
            string xpath, 
            string xpathId,
            string storeItemID, string prefixMappings,
                                        string questionID)
        {
            //Office.CustomXMLPart xpathsPart = ((WedTaskPane)this.Parent.Parent.Parent).xpathsPart;

            xpaths xpaths = new xpaths();
            xpaths.Deserialize(xpathsPart.XML, out xpaths);

            xpathsXpath item = new xpathsXpath();
            item.id = xpathId; //System.Guid.NewGuid().ToString();

            if (!string.IsNullOrWhiteSpace(questionID))
                item.questionID = questionID;

            xpathsXpathDataBinding db = new xpathsXpathDataBinding();
            db.xpath = xpath;
            db.storeItemID = storeItemID;
            if (!string.IsNullOrWhiteSpace(prefixMappings))
                db.prefixMappings = prefixMappings;
            item.dataBinding = db;

            xpaths.xpath.Add(item);

            // Save it in docx
            string result = xpaths.Serialize();
            log.Info(result);
            CustomXmlUtilities.replaceXmlDoc(xpathsPart, result);

            return item;
        }
예제 #8
0
        public DataTable iconlist(string searchstring, string type)
        {
            DataTable dt     = new DataTable();
            string    cnText = null;
            string    qText  = null;

            cnText = @"Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";Data Source=" + PPTAttribute.Iconmapping;
            if (type == "Icon")
            {
                qText = "select * from [IConmapping$A1:B5000] where Tag_Name like'%" + searchstring + "%'";
            }
            else if (type == "flag")
            {
                qText = "select * from [flags$A1:B5000] where Tag_Name like'%" + searchstring + "%'";
            }
            else if (type == "map")
            {
                //map
                qText = "select * from [map$A1:D5000] where CountryName like'%" + searchstring + "%'";
            }
            try
            {
                OleDbDataAdapter da = new OleDbDataAdapter(qText, cnText);
                da.Fill(dt);
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "get_ChartSpacification");
            }
            return(dt);
        }
예제 #9
0
 public void insert_Slide_in_ActivePPT(int CslideIndex, int PslideIndex, string slideType = null, int cnt = 0)
 {
     PowerPoint.Presentation actPPT = null, CurrentPPT;
     try
     {
         CurrentPPT = ppApp.ActivePresentation;
         actPPT     = ppApp.Presentations.Open(PPTAttribute.standardppt, MsoTriState.msoFalse);
         actPPT.Slides[CslideIndex].Copy();
         CurrentPPT.Slides.Paste(PslideIndex);
         //CurrentPPT.Slides.Paste(1);
         if (slideType == "CSlide")
         {
             CurrentPPT.Slides[PslideIndex].Name = "Title Slide" + cnt + 1;
         }
         else if (slideType == "ESlide")
         {
             CurrentPPT.Slides[PslideIndex].Name = "End Page" + cnt + 1;
         }
         actPPT.Close();
         CurrentPPT.Slides[PslideIndex].Select();
     }
     catch (Exception ex)
     {
         string errtext = ex.Message;
         PPTAttribute.ErrorLog(errtext, "insert_Slide_in_ActivePPT");
         actPPT.Close();
     }
 }
예제 #10
0
        //Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1

        public void RibbonLoad(Office.IRibbonUI ribbonUi)
        {
            _ribbon = ribbonUi;

            SetVoicesFromInstalledOptions();
            SetCoreVoicesToSelections();
        }
예제 #11
0
 public void DisplayPresentation(Office.IRibbonControl control, bool pressed)
 {
     if (ThisAddIn.instance.customPresenterIsEnabled)
         ThisAddIn.instance.customPresenterIsEnabled = false;
     else
         ThisAddIn.instance.customPresenterIsEnabled = true;
 }
예제 #12
0
        public void onRegButton(Office.IRibbonControl control)
        {
            Excel.Application exApp = Globals.ThisAddIn.Application as Excel.Application;
            Excel.Workbook wb = exApp.ActiveWorkbook as Excel.Workbook ;
            string filename = wb.Name.ToString();

            Microsoft.Office.Core.DocumentProperties properties;
            properties = (Office.DocumentProperties)wb.CustomDocumentProperties;

            Channel ch = new Channel();
            ch.setAuthToken(TokenStore.getTokenFromStore());

            if (ch.checkSpreadSheetID(wb) == "0")
            {

                string fileID = ch.getSpreadSheetID(filename);
                MessageBox.Show(fileID, "File ID");

                properties.Add("Excalibur ID", false,
                    Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString, fileID);
            }
            else
            {
                MessageBox.Show("ID Exists - Excalibur ID: " + ch.checkSpreadSheetID(wb), "File Already Registered");
            }
        }
예제 #13
0
 public void OnToggleButton1(Office.IRibbonControl control, bool isPressed)
 {
     if (isPressed)
         MessageBox.Show("Pressed");
     else
         MessageBox.Show("Released");
 }
예제 #14
0
        public void AddAudioClick(Office.IRibbonControl control)
        {
            var currentSlide = PowerPointCurrentPresentationInfo.CurrentSlide;

            if (PowerPointCurrentPresentationInfo.SelectedSlides.Any(slide => slide.NotesPageText.Trim() != ""))
            {
                RemoveAudioEnabled = true;
                RefreshRibbonControl("RemoveAudioButton");
            }

            var allAudioFiles = NotesToAudio.EmbedSelectedSlideNotes();

            var recorderPane = Globals.ThisAddIn.GetActivePane(typeof(RecorderTaskPane));

            if (recorderPane == null) return;

            var recorder = recorderPane.Control as RecorderTaskPane;

            if (recorder == null) return;

            // initialize selected slides' audio
            recorder.InitializeAudioAndScript(PowerPointCurrentPresentationInfo.SelectedSlides.ToList(),
                                                  allAudioFiles, true);

            // if current list is visible, update the pane immediately
            if (recorderPane.Visible)
            {
                recorder.UpdateLists(currentSlide.ID);
            }

            PreviewAnimationsIfChecked();
        }
예제 #15
0
		protected void AddMenu(ref Office.CommandBarButton btn, Office.CommandBar bar,
			string strCaption, string strTooltip,
			Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler handler)
		{
			btn = (Office.CommandBarButton)bar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, missing, true);
			AddMenu(btn, strCaption, strTooltip, handler);
		}
예제 #16
0
 /// <summary>
 /// Called when SplitButton or it's submenus are clicked.
 /// </summary>
 /// <param name="control"></param>
 public void OnHighlightAction(Office.IRibbonControl control)
 {
     if (!string.IsNullOrEmpty(control.Tag))
         _defaultLang = ColorCode.Languages.FindById(control.Tag);
     _host.Highlight(new Parser(_defaultLang));
     this.ribbon.Invalidate();
 }
예제 #17
0
파일: Ribbon.cs 프로젝트: ProjectECS/ECS
 public string GetDescription(Office.IRibbonControl control)
 {
     switch (control.Id)
     {
         case "spaceAvailable":
         case "spaceAvailableEx":
             return Resources.description_available_storage;
         case "toggleDynamic":
         case "toggleDynamicEx":
             return  Resources.description_dynamic_content;
         case "toggleEncrypted":
         case "toggleEncryptedEx":
             return  Resources.description_encrypted;
         case "toggleAllowForwarding":
         case "toggleAllowForwardingEx":
             return Resources.description_allow_forwarding;
         case "toggleNoPlaceholder":
         case "toggleNoPlaceholderEx":
             return Resources.description_no_placeholder;
         case "buttonEditContent":
             return  Resources.description_edit_content;
         case "buttonDeleteContent":
             return Resources.description_delete_content;
         case "buttonChiaraMailAccount":
         case "groupChiaraAccount":
             return  Resources.tooltip_config_button;
         case "taskChiaraMailHelp":
             return  Resources.description_help;
         case "taskChiaraMailSupport":
             return Resources.description_support;
     }
     return "";
 }
예제 #18
0
        private Office.CommandBarButton CreateCommandBarButton(
            Office.CommandBar commandBar, string captionText, string tagText,
            string tipText, Office.MsoButtonStyle buttonStyle, System.Drawing.Bitmap picture,
            bool beginGroup, bool isVisible, object objBefore, Office._CommandBarButtonEvents_ClickEventHandler handler)
        {
            // Determine if button exists
            Office.CommandBarButton aButton = (Office.CommandBarButton)
                commandBar.FindControl(buttonStyle, null, tagText, null, null);

            if (aButton == null)
            {
                // Add new button
                aButton = (Office.CommandBarButton)
                    commandBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, tagText, objBefore, true);

                aButton.Caption = captionText;
                aButton.Tag = tagText;
                if (buttonStyle != Office.MsoButtonStyle.msoButtonCaption)
                {
                    aButton.Picture = (IPictureDisp)AxHost2.GetIPictureDispFromPicture(picture);
                }
                aButton.Style = buttonStyle;
                aButton.TooltipText = tipText;
                aButton.BeginGroup = beginGroup;
                aButton.Click += handler;
            }

            aButton.Visible = isVisible;

            return aButton;
        }
예제 #19
0
        public int get_LastSelectedSlide()
        {
            int lSlide = 0, temp, selected_Slides_Count;

            try
            {
                try { selected_Slides_Count = ppApp.ActiveWindow.Selection.SlideRange.Count; }
                catch (Exception ex) { selected_Slides_Count = 0; }
                lSlide = 0;
                for (int sld = 1; sld <= selected_Slides_Count; sld++)
                {
                    temp = ppApp.ActiveWindow.Selection.SlideRange[sld].SlideNumber;
                    if (temp > lSlide)
                    {
                        lSlide = temp;
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "get_LastSelectedSlide");
            }
            return(lSlide);
        }
        public FormAnswerOrder(Office.CustomXMLPart answersPart, Office.CustomXMLPart questionsPart)
        {
            InitializeComponent();

            // To populate the tree view, we need to traverse
            // the answers.  We could do this at the DOM level,
            // or using our answers object.
            // Best to use our answers object.

            this.answersPart = answersPart;
            answersObj = new answers();
            OpenDope_AnswerFormat.answers.Deserialize(answersPart.XML, out answersObj);

            // We want to show the question text in the tree view
            questionnaire = new questionnaire();
            questionnaire.Deserialize(questionsPart.XML, out questionnaire);

            ImageList TreeviewIL = new ImageList();
            TreeviewIL.Images.Add(System.Drawing.Image.FromStream(
                System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("OpenDope_AnswerFormat.folder.png")));
            TreeviewIL.Images.Add(System.Drawing.Image.FromStream(
                System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("OpenDope_AnswerFormat.Icons.LogicTree.variable_chevron.png")));
            TreeviewIL.Images.Add(System.Drawing.Image.FromStream(
                System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("OpenDope_AnswerFormat.Icons.LogicTree.repeat.png")));
            this.treeView1.ImageList = TreeviewIL;

            addNodes(answersObj.Items, root);
            this.treeView1.Nodes.Add(root);
            root.ImageIndex = 0;
            root.SelectedImageIndex = 0;

            treeView1.ExpandAll();
        }
예제 #21
0
 void Application_ItemContextMenuDisplay(Office.CommandBar CommandBar, Outlook.Selection Selection)
 {
     if (Selection[1] is Outlook.MailItem)
     {
         OnMailItenContextMenu(CommandBar, Selection);
     }
 }
        public FormAddNode(IXPathNavigable node, Office.CustomXMLPart part)
        {
            InitializeComponent();

            //set up state
            m_xn = node as XmlNode;
            m_cxp = part;
        }
예제 #23
0
        public FormQuestion(Office.CustomXMLPart questionsPart, string xpath, string xpathId)
        {
            InitializeComponent();
            this.questionsPart = questionsPart;

            this.textBoxXPath.Text = xpath;
            this.textBoxQID.Text = "q" + xpathId;
        }
예제 #24
0
        public IEnumerable<Office.CommandBarControl> OnMailItemContextMenu(Office.CommandBar CommandBar,Office.CommandBarPopup agileCommand, IEnumerable<Outlook.MailItem> selectedMailItems)
        {
            var taggerMenuItem=(Office.CommandBarButton)agileCommand.Controls.Add(Office.MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true);

            taggerMenuItem.Caption = "Tag";
            taggerMenuItem.Click += new Office._CommandBarButtonEvents_ClickEventHandler(taggerMenuItem_Click);
            return new List<Office.CommandBarControl>() { taggerMenuItem };
        }
예제 #25
0
 private void CopyToClipboard(Office.CommandBarButton btn, ref bool cancel)
 {
     Explorer exp = Globals.ThisAddIn.Application.ActiveExplorer();
     if (exp.Selection.Count > 0)
     {
         Clipboard.SetText(Reporting.GetMessageSource((MailItem)exp.Selection[1], false));
     }
 }
예제 #26
0
 /* Globalスコープ・プロシージャ用のコメントラインを出力 */
 public void cmdGlobalComment_Click(Office.CommandBarButton ctrl, ref bool cancel)
 {
     try{
         int startLine, startColumn, endLine, endColumn;
         vbe.ActiveCodePane.GetSelection(out startLine, out startColumn, out endLine, out endColumn);
         vbe.ActiveCodePane.CodeModule.InsertLines(startLine, "'****************************************************************************************************");
     }catch (Exception){
     }
 }
        public void SendMessageUsingGroupDocsMetadata(Office.IRibbonControl control)
        {
            try
            {
                //Create open file dialog...
                OpenFileDialog ofdAttachFile = new OpenFileDialog();

                //Initialize open file dialog...
                InitializeOpenFileDialog(ofdAttachFile);

                DialogResult result = ofdAttachFile.ShowDialog();

                string strFileName = string.Empty;
                string message = string.Empty;

                if (result == DialogResult.OK)
                {
                    MessageBox.Show("Cleaning of multiple files may take time. Please be patient.");
                    foreach (string fileName in ofdAttachFile.FileNames)
                    {
                        //Get file name...
                        strFileName = fileName;

                        try
                        {
                            //Clean metadata of file...
                            message = MetadataCleaner.CleanFile(strFileName);
                        }
                        catch (Exception exp)
                        {
                            MessageBox.Show("Exception in cleaning file: " + exp.Message);
                        }
                        try
                        {
                            //Get mail item of Outlook...
                            Outlook.MailItem mail = Globals.ThisAddIn.Application.ActiveInspector().CurrentItem;
                            
                            //Attach file with mail
                            mail.Attachments.Add(strFileName, Outlook.OlAttachmentType.olByValue, 1, strFileName);
                            
                            //Display mail...
                            mail.Display();

                        }
                        catch (Exception exp)
                        {
                            MessageBox.Show("Exception in attachment: " + exp.Message);
                        }
                    }
                }

            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
예제 #28
0
 void HighlightTextRange(Office.TextRange2 textRange, Core.Parser parser)
 {
     textRange.Font.Fill.ForeColor.RGB = System.Drawing.Color.Black.ToMsoColor();
     foreach (var f in parser.Parse(textRange.Text))
     {
         // NOTE: indices of Characters are 1-based
         textRange.get_Characters(1 + f.Start, f.Length).Font.Fill.ForeColor.RGB = f.ForegroundColor.ToMsoColor();
     }
 }
		/// <summary>
		/// Paste a text from cliboard to cells comments, starting with the first selected.
		/// Text should be \t and \n separated (for cols and rows accordingly)
		/// </summary>
		private void PasteAsCommentButton_Click(Office.CommandBarButton cmdBarbutton, ref bool cancel)
		{
			try
			{
				var app = Application;

				var clipBoardText = System.Windows.Forms.Clipboard.GetText().Replace("\r\n", "\n");
				var clipBoard = clipBoardText.Split('\n').Select(txt => txt.Split('\t'));

				var selected = Application.Selection as IEnumerable;

				if (Application.Selection is Excel.Range && selected != null)
				{
					dynamic cell = selected.Cast<dynamic>().First();

					var rowNum = cell.Row;
					var colNum = cell.Column;

					var firstCol = colNum;

					foreach (var row in clipBoard)
					{
						foreach (var val in row)
						{
							cell = app.Cells[rowNum, colNum];

							if (cell.Comment != null)
							{
								cell.Comment.Delete();
							}

							if (String.IsNullOrEmpty(val))
							{
								colNum++;

								continue;
							}

							var comment = val.Replace(@"\n", "\n").Replace(@"\t", "\t");

							cell.AddComment(comment);

							colNum++;
						}

						colNum = firstCol;
						rowNum++;
					}
				}
			}
			catch (Exception ex)
			{
				System.Windows.Forms.MessageBox.Show(ex.Message, @"Paste As Comment");
				throw;
			}
		}
        //Add highlight shape for paragraphs within selected shape which have bullets or with text selected by user
        private static bool AddNewShapesToAnimate(PowerPointSlide currentSlide, List<PowerPoint.Shape> shapesToUse, Office.TextRange2 selectedText)
        {
            bool anySelected = false;

            foreach (var sh in shapesToUse)
            {
                sh.Name = "HighlightBackgroundShape" + Guid.NewGuid();
            }

            if (userSelection == HighlightBackgroundSelection.kTextSelected)
            {
                foreach (var sh in shapesToUse)
                {
                    foreach (Office.TextRange2 paragraph in sh.TextFrame2.TextRange.Paragraphs)
                    {
                        if (paragraph.Start <= selectedText.Start + selectedText.Length
                            && selectedText.Start <= paragraph.Start + paragraph.Length - 1
                            && paragraph.TrimText().Length > 0)
                        {
                            GenerateHighlightShape(currentSlide, paragraph, sh);
                            anySelected = true;
                        }
                    }
                }
            }
            else
            {
                foreach (var sh in shapesToUse)
                {
                    bool anySelectedForShape = false;
                    foreach (Office.TextRange2 paragraph in sh.TextFrame2.TextRange.Paragraphs)
                    {
                        if (paragraph.ParagraphFormat.Bullet.Visible == Office.MsoTriState.msoTrue
                            && paragraph.TrimText().Length > 0)
                        {
                            GenerateHighlightShape(currentSlide, paragraph, sh);
                            anySelected = true;
                            anySelectedForShape = true;
                        }
                    }
                    if (anySelectedForShape)
                    {
                        continue;
                    }
                    foreach (Office.TextRange2 paragraph in sh.TextFrame2.TextRange.Paragraphs)
                    {
                        if (paragraph.TrimText().Length > 0)
                        {
                            GenerateHighlightShape(currentSlide, paragraph, sh);
                            anySelected = true;
                        }
                    }
                }
            }
            return anySelected;
        }
예제 #31
0
        private void refreshAll(Office.CommandBarButton cmdBarbutton, ref bool cancel)
        {
            Excel.Application exApp = Globals.ThisAddIn.Application as Excel.Application;
            Excel.Workbook wb = exApp.ActiveWorkbook as Excel.Workbook;
            Channel ch = new Channel();
            string txt;

            txt = ch.channelsRefresh(wb);
            MessageBox.Show(txt, "Refresh");
        }
예제 #32
0
        public void onRefreshButton(Office.IRibbonControl control)
        {
            Excel.Application exApp = Globals.ThisAddIn.Application as Excel.Application;
            Excel.Workbook wb = exApp.ActiveWorkbook as Excel.Workbook;
            Channel ch = new Channel();
            ch.setAuthToken(TokenStore.getTokenFromStore());

            string txt = ch.channelsRefresh(wb);
            MessageBox.Show(txt, "Refresh");
        }
 public string GetLabel(Office.IRibbonControl control)
 {
     switch (control.Id)
     {
         case "saveHtmlWithImagesBtn":
             return Properties.Resources.SaveHtmlWithImagesBtnLabel;
         default:
             return null;
     }
 }
        public string AutoCorrectContextMenu_GetContent(Office.IRibbonControl control)
        {
            string word = GetCurrentWord();
            if (word == null)
                return String.Empty;

            SpellingSuggestions suggestions = GetSpellingSuggestions(word);

            return BuildMenu(word, suggestions);
        }
예제 #35
0
        public DataTable get_SlideIndex(string cri)
        {
            DataTable dt = new DataTable();
            //string ExSpacificationPath = @"C:\Users\Devendra.Tripathi\Documents\visual studio 2015\Projects\TSCPPT_Addin\TSCPPT_Addin\AppData\Mapping\PPT_Specification.xlsx";
            string cnText = @"Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";Data Source=" + PPTAttribute.dbPath;
            string qText  = "select * from [Slide$A1:B50] where SlideName='" + cri + "'";

            try
            {
                OleDbDataAdapter da = new OleDbDataAdapter(qText, cnText);
                da.Fill(dt);
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "get_SlideIndex");
            }
            return(dt);
        }
예제 #36
0
        public string InsertPlaceholder(int sldNum, DataTable dt, string shpType)
        {
            PowerPoint.Shape oPlaceholder;
            string           shpName = null;
            List <string>    txtStr = new List <string>();
            int shpCount = 0, shpNumber = 0;

            try
            {
                //char splitChar = '|';
                float  shpLeft   = (float)Convert.ToDouble((dt.Rows[0]["ShapeLeft"]));
                float  shpTop    = (float)Convert.ToDouble((dt.Rows[0]["ShapeTop"]));
                float  shpWidth  = (float)Convert.ToDouble((dt.Rows[0]["ShapeWidth"]));
                float  shpHeight = (float)Convert.ToDouble((dt.Rows[0]["ShapeHeight"]));
                string dText     = Convert.ToString(dt.Rows[0]["DefaultText"]);
                //ActivePresentation.Slides(sldNum).Shapes.AddTextbox(msoTextOrientationHorizontal, shpLeft, shpTop, shpWidth, shpHeight)

                oPlaceholder = ActivePPT.Slides[sldNum].Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, shpLeft, shpTop, shpWidth, shpHeight);

                oPlaceholder.TextFrame.TextRange.Text = dText;

                shpName  = oPlaceholder.Name;
                shpCount = ActivePPT.Slides[sldNum].Shapes.Count;
                if (shpType != "Text Box")
                {
                    for (int shpIndex = 1; shpIndex <= shpCount; shpIndex++)
                    {
                        if (ActivePPT.Slides[sldNum].Shapes[shpIndex].Name == shpName)
                        {
                            shpNumber = shpIndex; break;
                        }
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "InsertPlaceholder");
            }
            return(shpName);
        }
예제 #37
0
        public int Slidemapindex(string country)
        {
            DataTable dt       = new DataTable();
            int       sldIndex = 0;
            //string ExSpacificationPath = @"C:\Users\Devendra.Tripathi\Documents\visual studio 2015\Projects\TSCPPT_Addin\TSCPPT_Addin\AppData\Mapping\PPT_Specification.xlsx";
            string cnText = @"Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";Data Source=" + PPTAttribute.dbPath;
            string qText  = "select * from [Countrymaps$A1:C500] where CountryName='" + country + "'";

            try
            {
                OleDbDataAdapter da = new OleDbDataAdapter(qText, cnText);
                da.Fill(dt);
                sldIndex = Convert.ToInt32(dt.Rows[0]["SlideIndex"]);
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "get_ChartSpacification");
            }
            return(sldIndex);
        }