超简单的问题 两个问题1.如何让label控件显示的时间与电脑的时间同步,不考虑用timer控件?2.在richtextbox控件中如何打开word文档,并将word的内容在richtextbox中显示? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1.Hook系统的时间消息(因该有这样的消息吧)。2.不知道 2.在richtextbox控件中如何打开word文档,并将word的内容在richtextbox中显示? public string[] getWords(string strFileName) { object missing = System.Reflection.Missing.Value; //Temporary cache to store words. string[] result = null; // Open a document. fileName = strFileName; //file name Microsoft.Office.Interop.Word.Application oWordApplic = null; Microsoft.Office.Interop.Word.Document oDoc = null; try { oWordApplic = new Microsoft.Office.Interop.Word.Application(); oWordApplic.Visible = false; oDoc = oWordApplic.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); if (oDoc == null) { errMsg = "The file " + strFileName + " is null."; return null; } // Get words of a document,save them in a temporary array named result[]. oDoc.Activate(); //Get count of words. int wordsCount = oDoc.Words.Count; result = new string[wordsCount]; System.Collections.IEnumerator ieNum = oDoc.Words.GetEnumerator(); for (int i = 0; i < wordsCount; i++) { ieNum.MoveNext(); result[i] = ((Microsoft.Office.Interop.Word.Range)ieNum.Current).Text; } } //Capture exception when reading document. catch { // ...... } }//Add words to richtextbox for(int i=0;i<result.Length;i++){ RichTextBox.text +=result[i];} 1.如何让label控件显示的时间与电脑的时间同步,不考虑用timer控件?为什么不使用timer呢??这个市最直接的方法。当然用线程也可以。不要以为多个线程系统会多点开销。这点开销根本忽略不计的 C# 绘制问题 问一个VB问题 绑定数据的问题! 请问如何在asp.net中为每个http请求加入预处理代码? [COMException (0x80010105): 服务器出现意外情况。] 单点登录的测试用例(或则是测试思想 安全方面) 请版主帮忙,datagrid模板列中的checkbox控件如何使用checkedchanged事件 请问做应用开发的朋友:你们做项目的时候考虑用设计模式吗,如果是,你们常用哪几种模式? 急。。短信 接口的问题!! dataset.merge()的实际含义是什么? 【急问】怎么在C#里面绘制坐标图啊 升到VS2005的问题/
2.不知道
public string[] getWords(string strFileName)
{
object missing = System.Reflection.Missing.Value;
//Temporary cache to store words.
string[] result = null; // Open a document.
fileName = strFileName; //file name
Microsoft.Office.Interop.Word.Application oWordApplic = null;
Microsoft.Office.Interop.Word.Document oDoc = null;
try
{
oWordApplic = new Microsoft.Office.Interop.Word.Application();
oWordApplic.Visible = false;
oDoc = oWordApplic.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref
missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref
missing, ref missing, ref missing); if (oDoc == null)
{
errMsg = "The file " + strFileName + " is null.";
return null;
}
// Get words of a document,save them in a temporary array named result[]. oDoc.Activate();
//Get count of words.
int wordsCount = oDoc.Words.Count;
result = new string[wordsCount];
System.Collections.IEnumerator ieNum = oDoc.Words.GetEnumerator(); for (int i = 0; i < wordsCount; i++)
{
ieNum.MoveNext();
result[i] = ((Microsoft.Office.Interop.Word.Range)ieNum.Current).Text; } }
//Capture exception when reading document.
catch
{
// ......
}
}//Add words to richtextbox for(int i=0;i<result.Length;i++)
{
RichTextBox.text +=result[i];
}
为什么不使用timer呢??这个市最直接的方法。当然用线程也可以。不要以为多个线程系统会多点开销。这点开销根本忽略不计的