• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Office.Core类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

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


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: OnToggleButton1

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


示例15: 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


示例16: 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


示例17: getXPath

 /// <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]";
     }
 }
开发者ID:plutext,项目名称:OpenDoPE-NoXML-WordAddIn,代码行数:35,代码来源:NodeToXPath.cs


示例18: DisplayPresentation

 public void DisplayPresentation(Office.IRibbonControl control, bool pressed)
 {
     if (ThisAddIn.instance.customPresenterIsEnabled)
         ThisAddIn.instance.customPresenterIsEnabled = false;
     else
         ThisAddIn.instance.customPresenterIsEnabled = true;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:7,代码来源:Ribbon1.cs


示例19: OnMailItemContextMenu

        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 };
        }
开发者ID:ishwormali,项目名称:practices,代码行数:8,代码来源:Tagger.cs


示例20: CopyToClipboard

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Interop.Excel类代码示例发布时间:2022-05-24
下一篇:
C# Microsoft.ManagementConsole类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap