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


C# Interop.Word类代码示例

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


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

示例1: HumanMacroDialog

        public HumanMacroDialog(Word.Range text, int jobNumber)
        {
            this.text = text;
            this.jobNumber = jobNumber;
            InitializeComponent();

            Binding binding = new Binding();
            binding.Source = text;
            binding.Path = new PropertyPath("Text");
            textToWorkWith.SetBinding(TextBox.TextProperty, binding);

            numItems.Content = numSections + " paragraph" + (numSections == 1 ? "" : "s") + " selected, each as a separate task";

            item1 = new ComboBoxItem();
            item1.Content = "Paragraph";
            item2 = new ComboBoxItem();
            item2.Content = "Sentence";

            separatorBox.Items.Add(item1);
            separatorBox.Items.Add(item2);
            separatorBox.SelectedValue = item1;

            returnAsComments = new ComboBoxItem();
            returnAsComments.Content = "Comments";
            returnAsInline = new ComboBoxItem();
            returnAsInline.Content = "In-Line Changes";
            returnTypeBox.Items.Add(returnAsComments);
            returnTypeBox.Items.Add(returnAsInline);
            returnTypeBox.SelectedValue = returnAsComments;
        }
开发者ID:tummykung,项目名称:soylent,代码行数:30,代码来源:HumanMacroDialog.xaml.cs

示例2: UrlListForm

        public UrlListForm(Word.Document doc)
        {
            InitializeComponent();

            if (doc == null)
                return;
            wordDoc = doc;

            hyperlink_urls = WordUrlManager.GetListOfHyperlinkUrls(doc);
            hyperlink_requests = new HttpWebRequest[hyperlink_urls.Length];
            autofind_urls = WordUrlManager.GetListOfAllUrls(doc);
            autofind_requests = new HttpWebRequest[autofind_urls.Length];
            active_urls = hyperlink_urls;
            active_requests = hyperlink_requests;

            InitializeUrlViewList();

            progressBar.Visible = true;
            if (active_urls.Length == 0)
                progressBar.Visible = false;
            progressBar.Minimum = 0;
            progressBar.Maximum = active_urls.Length;
            progressBar.Step = 1;
            progressBar.Value = 0;

            button_RecheckEveryURL.Enabled = false;
            radioButton_autofindUrls.Enabled = false;
            radioButton_wordHyperlinks.Enabled = false;
            listView.BeginUpdate();

            urlTesterThread = null;
            RestartTestingThread = null;
            urlTesterThread_shouldStop = false;
        }
开发者ID:ggmod,项目名称:WordSyntaxHighlighter,代码行数:34,代码来源:UrlListForm.cs

示例3: FormFormatDate

        public FormFormatDate(Word.ContentControl currentCC)
        {
            InitializeComponent();

            this.currentCC = currentCC;

            if (currentCC.XMLMapping.IsMapped)
            {
                String dateValue = currentCC.XMLMapping.CustomXMLNode.Text;
                if (!DateTime.TryParse(dateValue, out thisDate1)) {
                    thisDate1 = DateTime.Now;
                    }
            }
            else
            {
                thisDate1 = DateTime.Now;
            }

            for (int i = 0; i < formatValues.Length; i++)
            {
                FormatChoice fc = new FormatChoice();
                fc.format = formatValues[i];
                fc.display = thisDate1.ToString(fc.format);
                this.listBoxFormat.Items.Add(fc);
            }

            if (currentCC.DateDisplayFormat != null)
            {
                this.textBoxFormat.Text = currentCC.DateDisplayFormat;
            }
        }
开发者ID:plutext,项目名称:OpenDoPE-NoXML-WordAddIn,代码行数:31,代码来源:FormFormatDate.cs

示例4: areOpenDoPEPartsPresent

        public static bool areOpenDoPEPartsPresent(Word.Document document)
        {
            // TODO consider removing this, or moving it,
            // refer instead Model.cs

            // Modified from OpenDoPE_Wed ThisAddIn
            Office.CustomXMLPart xpathsPart = null;
            Office.CustomXMLPart conditionsPart = null;

            foreach (Office.CustomXMLPart cp in document.CustomXMLParts)
            {
                if (cp.NamespaceURI.Equals(Namespaces.XPATHS))
                {
                    // check for duplicate parts; introduced 2013 12 08
                    if (xpathsPart != null)
                    {
                        MessageBox.Show("Duplicate parts detected. This template needs to be manually repaired.  Please contact your help desk.");
                    }

                    xpathsPart = cp;
                }
                else if (cp.NamespaceURI.Equals(Namespaces.CONDITIONS))
                {
                    conditionsPart = cp;
                }
            }

            return (xpathsPart != null && conditionsPart != null);
        }
开发者ID:plutext,项目名称:OpenDoPE-Model,代码行数:29,代码来源:CustomXmlUtilities.cs

示例5: collectWord

        public string collectWord(Word.Document doc)
        {
            doc.ActiveWindow.Selection.WholeStory();
            string str = doc.ActiveWindow.Selection.Text;

            return analyze(str);
        }
开发者ID:gosh-project,项目名称:gosh-officer,代码行数:7,代码来源:WordTest.cs

示例6: ProcessParagraphs

		protected bool ProcessParagraphs(OfficeDocumentProcessor aWordProcessor, Word.Paragraphs aParagraphs)
		{
			foreach (Word.Paragraph aParagraph in aParagraphs)
			{
				// get the Range object for this paragraph
				Word.Range aParagraphRange = aParagraph.Range;

				// if we're picking up where we left off and we're not there yet...
				int nCharIndex = 0;
				if (aWordProcessor.AreLeftOvers)
				{
					if (aWordProcessor.LeftOvers.Start > aParagraphRange.End)
						continue;   // skip to the next paragraph

					nCharIndex = aWordProcessor.LeftOvers.StartIndex;
					aWordProcessor.LeftOvers = null; // turn off "left overs"
				}

				WordRange aThisParagraph = new WordRange(aParagraphRange);
				if (!ProcessRangeAsWords(aWordProcessor, aThisParagraph, nCharIndex))
					return false;
			}

			return true;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:25,代码来源:WordDocumentProcessor.cs

示例7: getRepeatAncestor

        public Word.ContentControl getRepeatAncestor(Word.ContentControl cc)
        {
            Word.ContentControl repeatAncestor = null;

            if (root != null
                && !treeViewRepeat.SelectedNode.Equals(root)) // this varies with some repeat
            {
                // Which one is checked?
                string variesInRepeatId = (string)treeViewRepeat.SelectedNode.Tag;

                Word.ContentControl currentCC = cc.ParentContentControl;
                while (repeatAncestor == null && currentCC != null)
                {
                    if (currentCC.Tag.Contains("od:repeat"))
                    {
                        TagData td = new TagData(currentCC.Tag);
                        string variesXPathID = td.getRepeatID();

                        if (variesXPathID.Equals(variesInRepeatId))
                        {
                            return currentCC;
                        }
                    }
                    currentCC = currentCC.ParentContentControl;
                }
            }

            return null;
        }
开发者ID:plutext,项目名称:OpenDoPE-NoXML-WordAddIn,代码行数:29,代码来源:ControlQuestionVaryWhichRepeat.cs

示例8: WordActiveDocument

        public WordActiveDocument(IOfficeApplication application, MsWord._Document document)
            : base(application, document.FullName)
        {
            _document = document;

            InitializeWsDocument(FullPath);
        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:7,代码来源:WordActiveDocument.cs

示例9: WordUrlManager

 public WordUrlManager(Word.Application wordApp)
 {
     Word.Options options = wordApp.Application.Options;
     originalSettings_ReplaceHyperlinks = options.AutoFormatReplaceHyperlinks;
     originalSettings_AsYouTypeReplaceHyperlinks = options.AutoFormatAsYouTypeReplaceHyperlinks;
     wordAppOptionsChanged = false;
 }
开发者ID:ggmod,项目名称:WordSyntaxHighlighter,代码行数:7,代码来源:WordUrlManager.cs

示例10: OpenDocument

 //private static Word.Application wordapp = new Word.Application();
 public static Document OpenDocument(Word.Application wordapp, string fileName)
 {
     wordapp.Visible = true;
     //Setting for open
     string FileName = fileName;
     bool ConfirmConversions = false;
     bool ReadOnly = false;
     bool AddToRecentFiles = false;
     object PasswordDocument = missing;
     object PasswordTemplate = missing;
     bool Revert = false;
     object WritePasswordDocument = missing;
     object WritePasswordTemplate = missing;
     object Format = missing;
     object Encoding = missing;
     bool Visible = true;
     bool OpenAndRepair = true;
     object DocumentDirection = missing;
     bool NoEncodingDialog = false;
     object XMLTransform = missing;
     //
     return  wordapp.Documents.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,
                                                 PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument,
                                                 WritePasswordTemplate, Format, Encoding, Visible, OpenAndRepair,
                                                 DocumentDirection = missing, NoEncodingDialog, XMLTransform);
 }
开发者ID:IamMan,项目名称:ModelingSignals,代码行数:27,代码来源:MSWordFunctionsProvider.cs

示例11: CreateContact

        private WorkContact CreateContact(Word.Row row, WorkGroup latestGroup)
        {
            try
            {
                //Trainers, Misc and Office have strange formats so don't do them
                if (latestGroup != WorkGroup.Trainer && latestGroup != WorkGroup.Misc && latestGroup != WorkGroup.Office)
                {
                    string nameAndInitials = GetNameAndInitials(row);
                    string[] nameFields = nameAndInitials.Split(' ');
                    string firstname = GetFirstName(nameFields);
                    string surname = GetSurname(nameFields);
                    string initials = GetInitials(nameFields);
                    string mobile = GetMobileNumber(row);
                    string home = GetHomeNumber(row);

                    //if there is at least one number then we can reasonably assume it's a contact
                    if (!string.IsNullOrWhiteSpace(mobile) || !string.IsNullOrWhiteSpace(home))
                    {
                        return WorkContact.FactoryCreate(firstname, surname, initials, mobile, home, latestGroup);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Had the following exception: " + e.Message);
                Console.WriteLine(e.StackTrace);
            }
            return null;
        }
开发者ID:stuartleyland,项目名称:MaintainWorkContacts,代码行数:29,代码来源:WordDocumentParser.cs

示例12: OpenNewApplication

 public static void OpenNewApplication(Word.Application WordApp, object FileName)
 {
     WordApp.Documents.Open(ref FileName,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
        ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);  //新的程序打开原文档
 }
开发者ID:chendaxixi,项目名称:WordAddIn,代码行数:7,代码来源:Tools.cs

示例13: showHome

 public void showHome(Word.Application WordApp)
 {
     this.UseWordApp = WordApp;
     this.webBrowser1.ObjectForScripting = this;
     this.webBrowser1.Navigate(new Uri("http://localhost:8080/alfresco/template?templatePath=/Company%20Home/Data%20Dictionary/Presentation%20Templates/office/my_alfresco.ftl&contextPath=/Company%20Home/Data%20Dictionary/Presentation%20Templates/office/my_alfresco.ftl"));
     //this.webBrowser1.Navigate(new Uri("http://www.alfresco.com"));
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:7,代码来源:UserControl1.cs

示例14: AddDetailsControl

 protected Wd.ContentControl AddDetailsControl(Wd.Range range)
 {
     var detailsControl = range.ContentControls.Add_Safely(Wd.WdContentControlType.wdContentControlText);
     detailsControl.Title = control.Title + " Details";
     detailsControl.Tag = control.Tag.Remove(" Delivery") + " Details";
     return detailsControl;
 }
开发者ID:beachandbytes,项目名称:GorillaDocs,代码行数:7,代码来源:Delivery.cs

示例15: UpdateControls

        public Wd.Range UpdateControls(IList<Contact> contacts, Wd.WdCollapseDirection CollapseDirection = Wd.WdCollapseDirection.wdCollapseEnd)
        {
            try
            {
                var control = doc.ContentControls(x => x.Tag == controlTags.First()).First();
                var range = control.ParentContentControl.Range;
                range.MoveEnd(Wd.WdUnits.wdParagraph, 1);
                range.Copy();

                range.ContentControls.DeleteEmpty();
                range.Collapse(Wd.WdCollapseDirection.wdCollapseEnd);
                for (int i = 2; i <= contacts.Count; i++)
                {
                    range.MoveOutOfContentControl();
                    range.Collapse(Wd.WdCollapseDirection.wdCollapseEnd);
                    range.Paste();
                    UpdateContentControlMappings(range, i);
                    range.ContentControls.DeleteEmpty();
                }
                range = range.CollapseEnd();
                if (range.Paragraphs[1].IsEmpty())
                    range.Paragraphs[1].Range.Delete();

                doc.Bookmarks.DeleteIfExists(Bookmarks);
                UpdateDeliveryDetails();

                range.Move(Wd.WdUnits.wdCharacter, 1);
                return range;
            }
            finally
            {
                ClipboardHelper.Clear();
            }
        }
开发者ID:beachandbytes,项目名称:GorillaDocs,代码行数:34,代码来源:RepeatingContacts.cs


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