当前位置: 首页>>代码示例>>C#>>正文


C# Office.Core类代码示例

本文整理汇总了C#中Microsoft.Office.Core的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Core类的具体用法?C# Microsoft.Office.Core怎么用?C# Microsoft.Office.Core使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Microsoft.Office.Core类属于命名空间,在下文中一共展示了Microsoft.Office.Core类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddMenu

		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);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:7,代码来源:OfficeApp.cs

示例2: onRegButton

        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");
            }
        }
开发者ID:huankiat,项目名称:excalibur,代码行数:26,代码来源:ExcaliburRibbon.cs

示例3: RibbonLoad

        //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();
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:9,代码来源:Ribbon1.cs

示例4: GetShapesFromLinesInText

        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;
        }
开发者ID:suheti,项目名称:powerpointlabs,代码行数:26,代码来源:HighlightTextFragments.cs

示例5: writeToText_Click

        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);
            }
        }
开发者ID:minikie,项目名称:test,代码行数:26,代码来源:ThisAddIn.cs

示例6: FormAnswerOrder

        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();
        }
开发者ID:plutext,项目名称:OpenDoPE-NoXML-WordAddIn,代码行数:33,代码来源:FormAnswerOrder.cs

示例7: taggerMenuItem_Click

 void taggerMenuItem_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
 {
     //TagWindow win = new TagWindow();
     //TagWindowWpf win = new TagWindowWpf();
     var win = new TestWpfApp.MainWindow();
     win.Show();
 }
开发者ID:ishwormali,项目名称:practices,代码行数:7,代码来源:Tagger.cs

示例8: Application_ItemContextMenuDisplay

 void Application_ItemContextMenuDisplay(Office.CommandBar CommandBar, Outlook.Selection Selection)
 {
     if (Selection[1] is Outlook.MailItem)
     {
         OnMailItenContextMenu(CommandBar, Selection);
     }
 }
开发者ID:ishwormali,项目名称:practices,代码行数:7,代码来源:ThisAddIn.cs

示例9: CreateCommandBarButton

        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;
        }
开发者ID:s0lt4r,项目名称:spamgrabber,代码行数:31,代码来源:ThisAddIn.cs

示例10: updateXPathsPart

        /// <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;
        }
开发者ID:plutext,项目名称:OpenDoPE-Model,代码行数:42,代码来源:XPathPartUtils.cs

示例11: OnButtonClick

        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");
            }
        }
开发者ID:yarongol,项目名称:OutlookStampAddIn,代码行数:28,代码来源:Ribbon1.cs

示例12: GetDescription

 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 "";
 }
开发者ID:ProjectECS,项目名称:ECS,代码行数:33,代码来源:Ribbon.cs

示例13: OnToggleButton1

 public void OnToggleButton1(Office.IRibbonControl control, bool isPressed)
 {
     if (isPressed)
         MessageBox.Show("Pressed");
     else
         MessageBox.Show("Released");
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:7,代码来源:Ribbon1.cs

示例14: OnHighlightAction

 /// <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();
 }
开发者ID:wonderful-panda,项目名称:highlighter,代码行数:11,代码来源:Ribbon.cs

示例15: AddAudioClick

        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();
        }
开发者ID:LIUJIAHAOCS,项目名称:powerpointlabs,代码行数:32,代码来源:Ribbon1.cs


注:本文中的Microsoft.Office.Core类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。