|
Of course ,you could open any file and read it's data but you still can't display doc into RichTextBox.Ask google and you will find this question many times and it's answer is the same -you can't.
[EDIT]
doc file is not simple text file and you couldn't view it's contents with Notepad. It's based on binary format specification and RichTextBox doesn't recognize it.
You could view or edit doc file with Word or with some third party libraries or with creating your own parser and viewer.
Life is a stage and we are all actors!
modified on Tuesday, September 1, 2009 6:54 AM
|
|
|
|
|
You can import word doc into richtextbox with following:
private void PreviewRecord(object sender, EventArgs e)
{
string str;
OpenFileDialog openfiledg = new OpenFileDialog();
openfiledg.Filter = "Word Document (*.doc)|*.doc|All Files (*.*)|*.*";
openfiledg.FilterIndex = 2;
openfiledg.RestoreDirectory = true;
if ((openfiledg.ShowDialog() == DialogResult.OK && openfiledg.FileName.Length > 0))
{
IDataObject Data1;
object nullobj, file;
Microsoft.Office.Interop.Word.Document wordDoc;
Microsoft.Office.Interop.Word.ApplicationClass WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
nullobj = System.Reflection.Missing.Value;
file = openfiledg.FileName;
wordDoc = WordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
wordDoc.ActiveWindow.Selection.WholeStory();
wordDoc.ActiveWindow.Selection.Copy();
Data1 = Clipboard.GetDataObject();
str = Data1.GetData(DataFormats.Rtf).ToString();
richTextBox1.Rtf = str;
wordDoc.Close(ref nullobj, ref nullobj, ref nullobj);
}
}
|
|
|
|
|
Hi, I am using CrystalReport XI-R2, in my application. I have used a Types Dataset and DataTables in the report. Data retrieved from querry has been added in the DataTable and in the report the DataSource of the report has been set that DataTable.
This report displays values correctly. There are nearly 5 custom querries and 3 Subreports in the report. The problem is that in the display of report it is displayed nearly after 1 minutes which is very slow in my requirement. Please suggest me, what is its solution.
|
|
|
|
|
Please Check the following:
1) Which DB you are using.
2) Are you retrieving the data in Network
3) Is that Windows application or Web application
Check where is the actual delay
Is that in binding ?
Is that in Fetching ?
then you can get some idea.
|
|
|
|
|
I have used Oracle10g Database. Yes is retrieved by client side from server. This is windows application.
In my report In crystal report oracle Database is not connected. used Dataset and DataTable. my coding pattern is like this.
private void btnTestReceipt_Click(object sender, EventArgs e)
{
ReportDocument rptdmt=new ReportDocument();
DataTable dtr=GetDatas();
string ReportName = Application.StartupPath + "\\Reports\\rptCashReceiptPP.rpt";
rptdmt.Load(ReportName);
rptdmt.SetDataSource(dtr);
CrystalReportViewer.ReportSource = rptdmt;
}
private DataTable GetDatas()
{
StringBuilder sb=new StringBuilder();
sb.Append("SELECT *from TableName WHERE CONDITION");
DataTable dt=_con.ExecuteDataTable(sb.ToString());
DsDataSet.UserDataTable dtrep=new DsDataSet.UserDataTable(); //This is object of DataTable of Typed Dataset named DsDataset.
foreach(DataRow dr in dt.Rows)
{
dtrep.Rows.Add(dr.ItemArray);
}
dtrep.AcceptChanges();
return dtrep;
}
|
|
|
|
|
Hi all,
I am looking for a more advance way of using an indexers. I have searched the net but cannot find anything that explains how I must accomplish the following:
I have three classes namely: Building, Controller, Reader (each with their own fields/properties/methods). I want to make use of an indexer to reference each of the classes so that it can following this pattern:
Building["MyBuilding"].Location = ".....";
Building["MyBuilding"].Controller["MyController"].Area = ".....";
Building["MyBuilding"].Controller["MyController"].Reader["myReader"].Tag = "......";
Many thanks in advance
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Assuming you are not using static classes in your example:
Dictionary <string,Building> building = new Dictionary<string,Building>();
Building myBuilding = new Building();
building.Add("MyBuilding", myBuilding);
building["MyBuilding"];
in the class definition of Building there should be a property like:
public Dictionary <string,Controller> Controller {get; private set;}
And follow the same method for Reader in the controller class.
Let me know if this isn't what you want.
modified on Tuesday, September 1, 2009 6:12 AM
|
|
|
|
|
Hi Keefb,
Thanks for the response.
keefb wrote: Let me know if this isn't what you want.
Well, kinda ... I was actually hoping not to make use of generics collections.
But on the other hand, lets see what I can do with this....
Thanks again.
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
hello everybody,
how to export table in my word document to xml using visual c#. (I'm using office 2003)
|
|
|
|
|
Try this link.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Hi,
I want to query the Active Directory for some objects. How can I list the objects than can be searched in AD. For example I want to find the Domain Controllers in AD.
Thanks,
- ferudun
|
|
|
|
|
|
|
hi;
i have a ms access mdb. my records customers. i want to change records. i want update one record and old value - new value; and plus all records remainders. how i made one click and update all records remainders?
sorry my bad english
|
|
|
|
|
hi,
where do u want to click and where do you want to update.
Reload the Datagridview to refresh.
|
|
|
|
|
i have two value. one value price. and i want update price. but i need update price while all records change remainders. like this; (newprice-oldprice)+ all customers remainders. but iam update only one record price. i hope explanation my problem thnx.
|
|
|
|
|
you have a price column, when you change the price for a single customer
then the entire list of customers should be replaced with the same Price.
if it is why dont you have a another table like customer vs price
|
|
|
|
|
|
Hello,,
Is it possible to send a parameter like below?
CheckBox oCheckBox = new CheckBox();
oCheckBox.Name = "cb_" + currentChild.ID;
oCheckBox.Click += new RoutedEventHandler(this.CheckClick);
Now I want to send the name of check box to the event handler. HOw can I do it?
Like
CheckBox oCheckBox = new CheckBox();
oCheckBox.Name = "cb_" + currentChild.ID;
oCheckBox.Click += new RoutedEventHandler(this.CheckClick,oCheckBox.Name);
so that in
CheckClick(object sender, RoutedEventArgs e) I can get the name of that check box as there will be many dynamically created check box.
|
|
|
|
|
One of the following lines should work, with the caveat that I'm a little rusty on WPF, so apologies if my answer isn't correct!
CheckClick(object sender, RoutedEventArgs e)
{
CheckBox checkBox1 = (CheckBox)sender;
sring id = checkBox1.Name;
CheckBox checkBox2 = (CheckBox)e.OriginalSource;
sring id = checkBox2.Name;
}
|
|
|
|
|
|
Just try with this.
CheckClick(object sender, RoutedEventArgs e)
{
string chkBoxName = ((CheckBox)sender).Name;
}
|
|
|
|
|
|
Hi all,
Is there any way to track the GMAIL input values, while COMPOSSING the Mail.
i am trying like bellow but i could not get:
void browser_BeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel)
{
browser = (SHDocVw.InternetExplorer)pDisp;
mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)browser.Document;
document = (HTMLDocument)doc;
IHTMLElementCollection elcol;
elcol = document.getElementsByTagName("iframe");
foreach (IHTMLElement ielcol in elcol)
{
HTMLIFrame frm = (HTMLIFrame)ielcol;
DispHTMLDocument docfrm = (DispHTMLDocument)((SHDocVw.IWebBrowser2)frm).Document;
IHTMLElementCollection elcolin = docfrm.all;
foreach (IHTMLElement iel in elcolin)
{
if (iel != null)
{
CreateLog(sLogPath, "IHTMLElement" + ":::" + iel.outerText + ":" +iel.outerHTML);
CreateLog(sLogPath, "\r\n -----------------------------------\r\n");
switch (iel.ToString())
{
case "mshtml.HTMLTextAreaElementClass":
mshtml.HTMLTextAreaElementClass tae = (mshtml.HTMLTextAreaElementClass)iel;
if (tae != null)
{
CreateLog(sLogPath, "HTMLTextAreaElementClass" + ":::" + tae.type + ":" + tae.value);
CreateLog(sLogPath, "\r\n -----------------------------------\r\n");
}
break;
}
}
}
}
}
i am trying to take To,CC,BCC,Subject values while sending mail,
Can some one suggest me how to go with...
thanks in advance
|
|
|
|
|
I am creating a mp3 player through C#.Net I have kept a CheckBox that shows the play list. I have created the player such that it when ever the user cicks on the selection on checkbox the player play the corresponding song. so the user has to click on the next song to play the next song once the previous song is finished.
Now I would like to know is it possible for the player to automatically play the next song once the previous song is finished? If so how do I go about doing this on C#.Net
Please let me know... Thanks!
|
|
|
|