|
thanks Pete O'Hanlon
but I don`t want to open a Doc file in Microsoft Word; I want to open a doc file in a viewer in my application
help me immediately please
Hello Friends
|
|
|
|
|
Laji59 wrote: help me immediately please
That's not the way this site works. This is a volunteer site - we're not paid to help you, so you might want to moderate the tone you're using to demand answers.
There are some commercial controls that will render text documents. You could probably use one of these.
|
|
|
|
|
This is a border line repost from another thread on the subject the OP started earlier in this forum.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
You will have to either manually code an interpreter for both of the formats, or look into some third-party SDKs. fly2pdf[^] may help you with pdf display/manipulation/creation and VSTO may help with embedding[?] word documents in your application.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
I think u can use a browser control in ur application
and then navigate to the url of the file.
I hope it helps.
|
|
|
|
|
this is a good way but may be I don`t have PDF reader like acrobat reader installed on my computer
Hello Friends
|
|
|
|
|
I am making an application in which i have a number of forms and each form has number of controls. Now i want to capture all teh key usage and mouse click at the form level so that if i enter some data and try to move to another form, it should pop up some message to save data. The code asn forms are in C#.NET.
|
|
|
|
|
Set the KeyPreview property on the form to true, and handle the PreviewKeyDown events.
Simon
|
|
|
|
|
i have a C# windows application in Visual Studio. I have a form which is opened in a panel.i want to print the data in various controls of the form upon clicking a PRINT button.but i don't want to print the jpg image of the entire form or any of its controls.i want that the text in the controls should be printed.for e.g. i have a label NAME:- and a textbox txtName in front of the label and suppose the user enters the name john in the textbox . iwant that they should be printed as follows:
NAME:- john
the enitre label and text box should not be printed but only the text in them should be printed.....is there any way to do it....is there any alternative way like adding the data in textbox and label to an MS Word document and then printing the document...plz. help...thanx in advance.
|
|
|
|
|
Have a look at the PrintDocument[^] class.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
thanks for the reply teejayem...the link to MSDN print document class was good but in the coding we have to give the path of the file to be printed ....
streamToPrint = new StreamReader
("C:\\Documents and Settings\\Administrator\\My Documents\\doc1.txt");.....
but what i wanted was that the text entered by the user in the text box etc. of the running form should be printed...how can i do that?
|
|
|
|
|
The example just shows the use of a StreamReader; However, it can be what ever type you want it to be (as long as you can get it as a string come time to print). You need a member variable for your data and in the "private void pd_PrintPage(object sender, PrintPageEventArgs ev)" (in the example) you loop through your data and print it accordingly.
EDIT:
Here is a quick example of what you want to do (i think). Here[^] is the image of the form. Here[^] is the image of the output. Below is the code. Please let me know if this is what you need. NOTE: there still needs more work done in the print event handler (like counting the lines for page breaks).
public Form1()
{
InitializeComponent();
printDocument1.PrintPage += printDocument1_PrintPage;
}
private void btnPrint_Click(object sender, EventArgs e)
{
using (PrintDialog pd = new PrintDialog())
{
if (pd.ShowDialog() == DialogResult.OK)
{
printDocument1.PrinterSettings = pd.PrinterSettings;
printDocument1.Print();
}
}
}
void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font objFont = new Font("Tahoma", 8.5F);
float fTopMargin = e.MarginBounds.Top;
float fLeftMargin = 50;
float fRightMargin = e.MarginBounds.Right - 150;
string Name = String.Concat("Name: ", txtName.Text);
string PhoneNumber = String.Concat("Phone Number: ", txtPhoneNum.Text);
string Email = String.Concat("Email Address: ", txtEmail.Text);
string DateOfBirth = String.Concat("Date Of Birth: ", txtDateOfBirth.Text);
e.Graphics.DrawString(Name, objFont, Brushes.Black, fLeftMargin, fTopMargin);
e.Graphics.DrawString(PhoneNumber, objFont, Brushes.Black, fRightMargin - PhoneNumber.Length, fTopMargin);
fTopMargin += objFont.GetHeight() * 2;
e.Graphics.DrawString(Email, objFont, Brushes.Black, fLeftMargin, fTopMargin);
fTopMargin += objFont.GetHeight();
e.Graphics.DrawString(DateOfBirth, objFont, Brushes.Black, fLeftMargin, fTopMargin);
objFont.Dispose();
e.HasMorePages = false;
}
Don't be overcome by evil, but overcome evil with good
modified on Tuesday, August 5, 2008 9:47 AM
|
|
|
|
|
thanks a lot teejayem ...your code works like a charm ...only one correction...
PrintDocument printDocument1 = new PrintDocument();
had to be declared....thanks a lot...u saved my day(infact u saved me many hours of searching on google)
|
|
|
|
|
Hello,
I am developing an application using C# windows application in .NET framework 2.0 all is fine on the local machine I make the service then I call it in the app and it runs fine.
But when I put the app on the main server where the same web service is runing live now here how can I set the settings in my app that it should look for the service on the main server not localhost.
In .NET 1.1 it was simple that we add the service and made it dynamic from the properties window and then change the service address in the app.config file but this is not getting done in .NET 2.0
please help
thanks
regards,
Farrukh
Regards,
Farrukh Malik
+92-300-2564099
|
|
|
|
|
Is there any data structure avilable out of the box in Framework 3.5, kind of reverse lookup dictionary.
Dictionary< key1, key2 > d = new Dictionary< key1, key2>();
Key2 k2 = d[key1];
Key1 k1 = d[key2];
Thanks
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
There is no reverse lookup in a dictionary because one value can lead to multiple keys, but not the other way round.
To get a list of keys that result in a specific value you can use this:
var keys = from key in dic.Keys
where dic[key] == somevalue
select key;
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks,
but in my case both are unique.
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
vytheese wrote: but in my case both are unique.
In this case I would derive a class from IDictionary that will internally hold two dictionaries, one for key->value and one for value->key. Something like:
public class TwoWayDictionary<K, V> : IDictionary<K, V>
Override the methods like Add, Contains etc to allow adding, removing and searching by key and value in both of the dictionaries.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The wrapper will ease from access point of view but Again I will end up in performance issue while searching from value point.
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
Why? You will be looking up the value as a key in your second dictionary.
|
|
|
|
|
Good, Sorry I failed to notice that. But in any case its only a wrapper for me.
What I am looking for is single dictionary with key, values both indexed or hashed.
since in my scenario the collection I am expecting is huge and time for process is having little window. so I want to get the feasible data structure that will helps me in both (space/time).
But with the time contstraint for my execution I have to trade between space vs time for a intial release.
Grazie.
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
vytheese wrote: What I am looking for is single dictionary with key, values both indexed or hashed.
That exactly what a wrapper class with 2 dictionaries will do...
|
|
|
|
|
Yeah, I just use two Dictionaries.
|
|
|
|
|
hi,
can anybody give me a tip (may be a little tip) to create word equations using .tex files automatically.
thanks in advance.
|
|
|
|
|
My Boss give me a project and say read it Compleatly in this Project there is Class Called CaspolSecurityPolicyCreator.cs i serach it on net but did not Found any help can any body tell me why we use it. The Project is Of add-on on Outlook
wasim khan
|
|
|
|