|
I am confused You have a add-in written in C# for word 2007, correct?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
yes i have an add-in written in C#. I just want to know if vsto can detect the name of my saved document!
|
|
|
|
|
I am unsure if there is anything "built-in" to do that, but you could easy do that with .NET if there isn't.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
You will save my day if you tell me how to do it with .NET
|
|
|
|
|
Are you saving this file by your Word add-in, or doing it through word? Or does it need to work for either?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I'm saving this file through word
|
|
|
|
|
I don't know much about Addins for Microsoft office, what type of office resources do you have access to? Any access to Events, methods, etc?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I am using office 2007. You said that there is a solution using .NET. You can tell me more about this?
|
|
|
|
|
There isn't a predefined solution for this, but it can be done with .NET. First you have to have access to stuff from MS Word, such as Recent files as suggested below by Colin. If you have access to events and stuff from Word it can be easily done.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
alina_anitei wrote: detect the name
"detect"? what does that mean?
alina_anitei wrote: I just want to know if vsto can
What does the Documentation say?
|
|
|
|
|
it means to find the word document path that i've just created
|
|
|
|
|
alina_anitei wrote: it means to find the word document path that i've just created
And is there nothing in the documentation that tells you how to get at the MRU (Most Recently Used) file list? (I don't know much about the capabilities of Office 2007 integration with .NET, so I'm just trying to get you looking in the right direction so you might be able to see what's there)
|
|
|
|
|
Thanks a lot Colin. I used your advice and i solved my problem.
Here's the code:
using Office = Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;
public void OnTextButton(Office.IRibbonControl control)
{
Word.Range currentRange = Globals.ThisAddIn.Application.Selection.Range;
Microsoft.Office.Interop.Word.Window activeWin = (Microsoft.Office.Interop.Word.Window)control.Context;
if (activeWin.Application.ActiveDocument.Path =="")
{
MessageBox.Show("You didn't save the document.");
return;
}
else
{
currentRange.Text = "Path: " + activeWin.Application.ActiveDocument.Path +
"\r\n" + "Name: " + activeWin.Application.ActiveDocument.Name;
}
}
This works on Office 2007 and returns the name of the current document.
Thanks again!
|
|
|
|
|
alina_anitei wrote: that i've just created
Post that code
|
|
|
|
|
I can poste the add-in code for office 2007. It's ok?
|
|
|
|
|
alina_anitei wrote: I can poste the add-in code for office 2007. It's ok?
Well, just the relevant bits. There is nothing wrong with posting code, it is actively encouraged. Just don't go nuts and post everything.
|
|
|
|
|
i learn c#.i want to be best programmer.i want to your help.please send sample
|
|
|
|
|
lankaudaranga wrote: please send sample
You'd better send me a sterilised sample bottle first then. It might be a little warm by the time it gets to you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: You'd better send me a sterilised sample bottle first then
You beat me to it. I left the page languish for too long as I attended something else before putting in my smart-alec answer.
|
|
|
|
|
Colin Angus Mackay wrote: before putting in my smart-alec answer.
He seems suspiciously Kylesque
|
|
|
|
|
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
lankaudaranga wrote: i learn c#.i want to be best programmer.i want to your help.please send sample
Go buy a couple books on OOP, and C#. Additionally, learn to title your posts properly.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
lankaudaranga wrote: please send sample
Okay - I'll just nip down to my local doctor's office to get a sample container and if you send me your address I'll get it sent to you. Goodness only knows what customs will think of it, especially with a biohazard logo on it.
|
|
|
|
|
OK - yours was worded better than mine.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Both are very funny.
You don't have to use the real stuff, you could just warm up some apple juice in the microwave
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|