 |
|
 |
From my point of view the generation is a bit slowly. It takes a lot to genrate a document. I´ve got a template with bookmarks and it takes about 2 seconds to write only a page with bookmaks. Is there a way to improve it?
|
|
|
|
 |
|
 |
I've tested the code with and without the suggestion above, but still when i opened and closed MS Word, i got the exception (the OLE Server is not any more available), I gess the 'is null' check is not enough...
s.
|
|
|
|
 |
|
 |
Great job but a little suggestion :
GetActiveObject() returns any active Word application. If the user has already opened MS Word, it will get this instance which is good. But if the user closes MS Word, you get an exception because the OLE Server is not any more available.
A suggestion would be to test if the server is available each time it is needed :
public bool IsLoaded{
get{try{return (wordApp != null);}catch{return false;}}
}
public MSWordHelper() { Load(); }
public void Load(){
// Check if Word is registered in the ROT.
try {
wordApp = (Word.Application)Marshal.GetActiveObject("Word.Application");
}catch {
wordApp = null;
}
// Load Word if it's not.
if(wordApp == null) {
try {
wordApp = new Word.ApplicationClass();
wordApp.Visible = false;
isNewApp = true;
}catch {
wordApp = null;
}
}
}
public Word.Application Application {
get {
if (!IsLoaded) Load();
return wordApp;
}
}
Thx
Xavier
|
|
|
|
 |
|
 |
I love your Dispose! It's hawt !
|
|
|
|
 |
|
 |
hi,
I am using webbrowser control to load a word document.
The problem is as soon as i open any word document outside in the window,
my word document inside webbrowser gets locked i.e it becomes non-editable
Also Page up,Page Down and View(Normal,print,web) button gets disable.
|
|
|
|
 |
|
 |
Is it necessary that i have to install MS Word for this apllication to execute.
and also if i upgrade or degrade the Word version then whether it effects this code.
Wait for your reply.
|
|
|
|
 |
|
 |
Yes you will need Word to be installed as the code is using "early binding" to access COM interfaces.
This class should work for all versions starting from Word 97.
HTH
Alexander Kojevnikov
MCSD.NET
Leuven, Belgium
|
|
|
|
 |
|
 |
I'm looking for documentation on automating Office 2000 using C#. I can interop with the objects, but need some details on the arguents.
Documents.Open((object) strFileName,(object) null,(object) false,(object) false,(object) null,(object) null,(object) null,(object) null,(object) null,(object) null,(object) null,(object) false);
|
|
|
|
 |
|
 |
Try this code:
object argFileName = "file.doc";
object argReadOnly = false;
object argAddToRecentFiles = false;
object argVisible = false;
object misssing = Missing.Value;
Documents.Open(
ref argFileName, ref missing, ref argReadOnly,
ref argAddToRecentFiles, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref argVisible);
Alexandre Kojevnikov
MCP (SQL2K)
Leuven, Belgium
|
|
|
|
 |
|
 |
but Microsoft has already released the Office XP Primary Interop Assemblies[^]
They deem this the correct way to interact with Office.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
 |
|
 |
Loved this line:
Microsoft has customized the Office XP PIAs to make them easier for managed code to interoperate with the Office XP COM type libraries. Avoid using any Office XP COM interop assembly that is not provided as part of the Office XP PIAs, or any Office XP COM interop assembly that is generated by Microsoft Visual Studio .NET at design time because they are considered unofficial.
Sort of like, "just use Microsoft stuff".
Also, I love how even Microsoft still has you go into DOS (!!!) to register the libraries, with a BATCH FILE!!!
And the stupid thing is, why can't you just open a folder to the directory and double click on the batch file?
When, oh when, will DOS go away???
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator.
|
|
|
|
 |
|
 |
DOS is gone with Windows 9x/Me. NT3.51 and onwards is NT..
The console (cmd.exe as opposed to command.com) is an invaluable tool. Pray it will never dissappear!
--
If I had the ability to smooth talk like John Simmons, this post would be less sarcastic and more to the point.
|
|
|
|
 |
|
|
 |
|
 |
And continuing to read the documentation, what is this BS:
Unlike standard COM interop assemblies, you cannot browse to a PIA and set a reference to it as you would with other assemblies in the Microsoft Visual Studio .NET integrated development environment (IDE). Instead, you set a reference to an existing COM type library; if a PIA exists in the GAC for that COM type library, the PIA will be silently referenced instead.
Is there a REASON to do things differently??? Are they not happy with the way their own tools work???
God, I hate MS. All these exceptions are really starting to turn me off from .NET programming.
I think I'll go to the soapbox now.
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator.
|
|
|
|
 |
|
|
 |
|
 |
Yes, but most of our customers are still using Office 2000... Those PIAs are available only for Office XP.
|
|
|
|
 |
|
 |
Ooops. That's true. I just assume that everybody has Office XP. Sorry 'bout that.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
 |
|
 |
Sorry to tell you but that link doesn't seem to work...
|
|
|
|
 |