|
I doubt you will be work around this because it's more of a security feature. I use it all the time to verify what link I am actually clicking on, since what's displayed has nothing to do with the underlying link.
For example, http://www.apple.com
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
using c#,I want to get date, month, year from date seperately.
thanks
You get the best out of others when you give the best of yourself.
|
|
|
|
|
Cross posting is rude. Please don't do it.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Check the available properties of Datetime[^] structure.
*jaans
|
|
|
|
|
System.DateTime moment = new System.DateTime(
1999, 1, 13, 3, 57, 32, 11);
// Year gets 1999.
int year = moment.Year;
// Month gets 1 (January).
int month = moment.Month;
// Day gets 13.
int day = moment.Day;
// Hour gets 3.
int hour = moment.Hour;
// Minute gets 57.
int minute = moment.Minute;
// Second gets 32.
int second = moment.Second;
// Millisecond gets 11.
int millisecond = moment.Millisecond;
|
|
|
|
|
Hi,
I would like to retrieve the comments from a word document using c#.net. Is there any method available?
Regards,
PS@CodeProj
|
|
|
|
|
Convert the word doc to an xml format (using an invisible instance of word itself), then parse the xml for the data you need.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Thanks for your post,
but would you please describe it in detail.
Or Is there any library to convert doc to xml?
Help with more detail. Thanks.
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) I made a class WordInstance as follows, that instantiates and hides a word instance...
...
using Word = Microsoft.Office.Interop.Word;
...
public class WordInstance : IDisposable {
private const string WORD_APPLICATION_EXE = "WINWORD.EXE";
...
private static readonly object s_Lock = new object();
private Word.Application m_WordApp = null;
...
public WordInstance() {
try {
int attempt = 0;
do {
IList<IntPtr> allWordWinsPrior, allWordWinsAfter;
lock (s_Lock) {
allWordWinsPrior = WinAPI.GetAllRootWindowsOfClass("OpusApp");
Word.Application temp = new Word.Application();
m_WordApp = new Word.Application();
temp.Quit(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
m_WordApp.DocumentOpen += new Microsoft.Office.Interop.Word
.ApplicationEvents4_DocumentOpenEventHandler(m_WordApp_DocumentOpen);
allWordWinsAfter = WinAPI.GetAllRootWindowsOfClass("OpusApp");
}
foreach (IntPtr ptr in allWordWinsPrior)
allWordWinsAfter.Remove(ptr);
if (allWordWinsAfter.Count > 1) {
for (int i = allWordWinsAfter.Count - 1; i >= 0; --i)
if (WinAPI.IsWindowVisible(allWordWinsAfter[i]))
allWordWinsAfter.RemoveAt(i);
}
if (allWordWinsAfter.Count > 0) {
m_Handle = allWordWinsAfter[0];
return;
}
} while (++attempt < 3);
throw new Exception();
} catch {
Dispose();
}
}
...
public void Dispose() {
if (m_WordApp != null) {
try {
if (m_WordApp.Documents.Count > 0)
m_WordApp.Documents.Close(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
m_WordApp.Quit(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
} catch {
if (m_Handle != IntPtr.Zero)
WinAPI.DestroyWindow(m_Handle);
}
m_WordApp = null;
m_Handle = IntPtr.Zero;
}
}
...
private void m_WordApp_DocumentOpen(Word.Document Doc) {
if (m_WordApp == null)
return;
WinAPI.ShowWindow(m_Handle, (uint)WinAPI.SW.HIDE);
string documentName = Doc.Name;
string documentFullName = Doc.FullName;
Doc.Close(ref s_QuitNoSave, ref s_QuitEmpty, ref s_QuitEmpty);
if (documentFullName.Equals(documentName))
openDocInNewWordInstance(null);
else
openDocInNewWordInstance(documentFullName);
}
...
private void openDocInNewWordInstance(string pathFileName) {
ProcessStartInfo wordStartInfo = new ProcessStartInfo(WORD_APPLICATION_EXE);
wordStartInfo.UseShellExecute = true;
wordStartInfo.Arguments = (string.IsNullOrEmpty(pathFileName)
? "/w" : string.Format("/w \"{0}\"", pathFileName));
wordStartInfo.WindowStyle = ProcessWindowStyle.Normal;
Process.Start(wordStartInfo);
}
} After instantiating word, use the word API to save the file in the xml doc format. Then close word, load the doc and parse the xml. You will need to become familiar with some WinAPI functions along with the Word API. Good luck.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi all,
I am developing a windows service using C#.I need to set this service for a domain user.Only this user is able to start the service.
I put my account type as User.but it is still open for other user .
How to do this.
Please help me.
Thanks
Narendra
|
|
|
|
|
You can use WindowsIdentity and WindowsPrincipal Class
|
|
|
|
|
asdfsadf
Just do the American thing and shoot him... - Jim Crafton on Linux Users
Wh3n my l33t skillz 1mpr0v3, I w1ll h4ck M$, 4nd th3n wh0 w1ll b3 l4ugh1ng ? N0t Bill. H4 h4 h4 h4 h4 h4 h4. - Christian Graus
|
|
|
|
|
hhhhhh
In India, when someone says "mad cow", you know it's actually a bull charging at him.
-- Rohit Sinha
|
|
|
|
|
Stop posting crap to the forums!!!!
|
|
|
|
|
Hi,
I am kind of confused about using type "String" and "string", I understand that String is a class and string is a premetive type, but I do not understand when should I use String and when should I use string ? Is there any performance issue related in these different types ? say for example, if I use String type, is it more performance friendly than string type ?
Thank you.
|
|
|
|
|
They're the same bloody thing!
string is merely an alias for String .
|
|
|
|
|
There is no performance difference since they are the same...
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
String is the actual underlying CLR (.NET Framework) data type while string is simply the C# alias (keyword) for the String class. They are identical and there are no performance concerns.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
hi ,
There are no differences between string and Stirng.
The name "string" is an intrinsic type that is mapped to "String" class.
-Mohan Kumar
|
|
|
|
|
They are the same. The string keyword is an alias for System.String .
There is no difference in performance, as it's the same type. The only difference is that the string keyword works even if you don't have using System; at the top of the page.
In some rare places you can only use the keywords and not the system type. For example you can specify the type int for an enum, but not the System.Int32 type.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
bashiwala wrote: I understand that String is a class and string is a premetive type,
This is a C# forum, what you are describing is Java.
|
|
|
|
|
No difference when both can be used, as stated by a number of other posters. However, I have come accross two instances where you are required to use one or the other. The first is in the using statement:
using BaseType = System.UInt32;
using BaseType = uint; The second is in enumerations:
public enum foo : uint {
...
}
public enum foo : System.UInt32 {
...
} Other than these two examples, I have yet to discover any difference.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Skippums wrote: the using statement
That's a using directive, not a using statement.
|
|
|
|
|
Touche! At first when I read your reply, I thought, "Wow, way to be anal-retentive about unmeaningful semantics." But then I remembered that there actually IS a using statement for things that implement the IDisposable interface, so your response is valid (and appreciated). Thanks for the correction,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
And any time I can point that out I will. I'm anal that way. ![Big Grin | :-D](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|