我可以使用c#打开word文档,但我也希望它在我的字符串匹配的页面上打开。
protected void New_Click(object sender, EventArgs e)
{
Word.Application app = new Word.Application();
app.Visible = true;
object visible = true;
object filepath = @"D:\Files\Process\TestingDocument-Latest1.docx";
object optional = System.Type.Missing;
Word.Document doc = app.Documents.Open(ref filepath, ref optional, ref
optional, ref optional, ref optional, ref optional, ref optional, ref
optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional);
object findText = "\"Quotation Day\" means";
int docc = doc.Paragraphs.Count;
Word.Range rng = doc.Paragraphs[docc].Range;
rng.Find.ClearFormatting();
rng.Find.Execute(ref findText,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
}
让我知道是否需要其他信息。