C#操作Word的一点认识
C#操作Word的内涵:C#操作Office套件的时候都需要用到COM组件,需要在项目里添加相应的COM组件。用C#在Word里查找指定关键字的方法有两种:Selection对象和Range对象。
C#操作Word之Selection对象的用法:
// C# internal void SelectionFind() { string strFind = "find me"; Word.Find fnd = ThisApplication.Selection.Find; fnd.ClearFormatting(); fnd.Text = strFind; object missingValue = Type.Missing; if (fnd.Execute(ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue)) { MessageBox.Show("Text found."); } else { MessageBox.Show("The text could not be located."); } }
C#操作Word之Range对象的用法:
相关推荐
TyrionZK 2020-07-18
chensen 2020-11-14
leihui00 2020-09-16
二十不悔三十而立 2020-08-19
shining0 2020-08-02
TyrionZK 2020-07-26
TreasureZ 2020-07-26
natloc 2020-07-19
Bonrui编程路 2020-07-18
TyrionZK 2020-07-04
TreasureZ 2020-06-25
TreasureZ 2020-06-20
TreasureZ 2020-06-16
jameszgw 2020-06-14
Bonrui编程路 2020-06-13
Bonrui编程路 2020-06-07