本文整理汇总了C#中Microsoft.Office.Interop.Word.Document.SelectAllEditableRanges方法的典型用法代码示例。如果您正苦于以下问题:C# Document.SelectAllEditableRanges方法的具体用法?C# Document.SelectAllEditableRanges怎么用?C# Document.SelectAllEditableRanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.Word.Document
的用法示例。
在下文中一共展示了Document.SelectAllEditableRanges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
string finalHTML;
List<string> listString = new List<string>();
object True = true;
Word.Application app = new Word.Application();
Word.Document doc = new Word.Document();
string fileName = @"D:\Programming\C#\Word To Markup Converter\hello world.docx";
doc = app.Documents.Open(fileName, Type.Missing, True);
//foreach (Word.Paragraph para in doc.Paragraphs)
//{
// para.Range.Copy();
// stripClasses(Clipboard.GetText(TextDataFormat.Html));
//}
Word.ListParagraphs listpara = doc.ListParagraphs;
IEnumerator ienum = doc.ListParagraphs.GetEnumerator();
List<Tuple<string, Word.WdListType, int>> items = new List<Tuple<string, Word.WdListType, int>>();
while (ienum.MoveNext())
{
Word.Range r = ((Word.Paragraph)ienum.Current).Range;
items.Add(new Tuple<string, Word.WdListType, int>(r.Text, r.ListFormat.ListType, r.ListFormat.ListLevelNumber));
}
items.Reverse();
if (items.Count > 0)
{
listString = createList(items);
}
doc.SelectAllEditableRanges();
doc.Range().Copy();
string returnHTMLText = null;
if (Clipboard.ContainsText(TextDataFormat.Html))
{
Console.WriteLine("html");
returnHTMLText = Clipboard.GetText(TextDataFormat.Html);
//Console.WriteLine(returnHTMLText);
stripClasses(returnHTMLText, listString);
}
else
{
Console.WriteLine("no html");
//Console.WriteLine(doc.);
//returnHTMLText = Clipboard.GetText(TextDataFormat.Html);
}
doc.Close();
app.Quit();
Console.WriteLine("closed");
while (true) ;
}