IMHO, the COM API for Word is hardly worth calling an API. It's written on top of the User Interface instead of providing an API to the underlying Document Model.
For example: you need to activate a document before you can use it, you need to explicitly create a selection to change it, you need to programmaticaly type text to insert anything in a document, etc.
I'd rather use a standalone library like Jakarta POI, than having to launch MSWord to programmaticaly create documents.
Discussion on:
View:
Show:
Hi, How do I embed the image inside the MS Words. thanks in advance.
Try to use Spire.Doc (http://www.e-iceblue.com/Introduce/word-for-net-introduce.html) - it is .NET component that supports read and write doc, docx, html, image etc. embed image still support.
Perfect, but what if I want to save the word document as .txt, where should I place the desired format?
this is a cool article. but if server doesn't provide service for word.application,, then what to do.. can you have any idea for providing any sort of api for word.. where we need not to install word.application at the server..
thanking you..
subimal
mckvie.subimal@gmail.com
thanking you..
subimal
mckvie.subimal@gmail.com
doesn't require word to be installed, at least that's what I was told by MS at TechEd when they launched 3.5.
It was about the only good part of the entire thing, (the word API, not TechEd).
It was about the only good part of the entire thing, (the word API, not TechEd).
System.Runtime.InteropServices.COMException (0x800A1436): This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(ranjan.doc)
at Microsoft.Office.Interop.Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument, Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible, Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)
at ResearchAndDevelopment.FormMicrosoftWord.ReadWordDocument(Object fileName, TextBoxBase textFileData) in C:\Documents and Settings\Sun\Desktop\Dot Net\ResearchAndDevelopment\ResearchAndDevelopment\Forms\FormMicrosoftWord.cs:line 84
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(ranjan.doc)
at Microsoft.Office.Interop.Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument, Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible, Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)
at ResearchAndDevelopment.FormMicrosoftWord.ReadWordDocument(Object fileName, TextBoxBase textFileData) in C:\Documents and Settings\Sun\Desktop\Dot Net\ResearchAndDevelopment\ResearchAndDevelopment\Forms\FormMicrosoftWord.cs:line 84
How you are going to deal with ms word com on shared hosting? use some lib like word.net or invoke docx. for example i use invoke for my web project (need to generate documents) online. It's pretty small and simple, check here - http://invoke.co.nz/products/docx.aspx
This one is almost a classic example of why MS's monolithic design philosophy sucks big time.
I gave it go, threw my hands in the air, and dropped the entire idea. You might as well record keystrokes as use this toss.
PS you might want to mention that which version of MS word you have deployed can have a wee impact o what you do and can do.......
I gave it go, threw my hands in the air, and dropped the entire idea. You might as well record keystrokes as use this toss.
PS you might want to mention that which version of MS word you have deployed can have a wee impact o what you do and can do.......
??? ???? ?? ?? ??? ????? ?????
TANK YUO VERY MUCH
TANK YUO VERY MUCH
Thx a lot, It helped me a lot. Keep up ur excellent work.
thank alot...it solve my problem...how can i use for print out
Thanks man... worked like a charm. Put the 's in my word document, built a UI to it, and bam... done. THANKS
thanks for useful artcile, but Microsoft does not recommend using Office application in server-side scenarios. I use Spire.Doc to modify word document, feel great component.
http://www.e-iceblue.com/Introduce/word-for-net-introduce.html
http://www.e-iceblue.com/Introduce/word-for-net-introduce.html
If you really need to modify Word documents using C# (or VB.Net, for that matter) you will save yourself a ton of headaches by using the Aspose Words API. Believe me, it is WELL worth the investment.
http://www.aspose.com/
They have APIs for Excel, Powerpoint, PDF, and a bunch of other good stuff too.
And no, I don't work for Aspose. I just use their excellent products.
http://www.aspose.com/
They have APIs for Excel, Powerpoint, PDF, and a bunch of other good stuff too.
And no, I don't work for Aspose. I just use their excellent products.
I guess the newsletter is no longer available, a search on TR shows none. The listing of available newsletters doesn't show it either.
This is really a great articale and save me a lot of time. Just a small problem am facing when trying the replace funcion. An AccessViolationException is thrown. Any idea is really appreciated
If you're working on the same Microsoft Word version as with your deployment workstation this tutorial will work. In cases that you do have different Word version you can use late binding or reference a dll compatible to the deployment workstation
http://www.centurybrains.com/ms-word-search-replace-late-binding-c/
http://www.centurybrains.com/ms-word-search-replace-late-binding-c/
We left MS Word automation some time ago. It is a messy, unstable and unreliable solution for document creation. We were looking for a solid document generation library and found the Docentric toolkit which doesn't provide APIs for document creation and manipulation. Instead, it provides a solid and template based document generation with the ability to edit document templates in MS Word:
www.docentric.com
If you are looking for the .NET tool that will help you create and maintain complex data-bound documents then check it out.
www.docentric.com
If you are looking for the .NET tool that will help you create and maintain complex data-bound documents then check it out.
Good post. You can also use other free dot net libraries like Bytescout Document SDK. It is very simple to use and explained in http://programmingfree.blogspot.in/2012/06/working-with-word-documents.html
Great articles! Thank you so much. But word automation cannot be used in Asp.net. I used Spire.Doc to Modify Word documents using C#, it easy to use.
Hello,
thank you for the post. I have used this code to replace all the "l" latters with "m" letters, but I have a question: there is also a replaceAll function is available, I'm wondering which one will work faster, if for example I have 1000 or more instances of letter "l" in my file. And I couldn't understand what does it mean: ref replace=2, why 2?
thank you for the post. I have used this code to replace all the "l" latters with "m" letters, but I have a question: there is also a replaceAll function is available, I'm wondering which one will work faster, if for example I have 1000 or more instances of letter "l" in my file. And I couldn't understand what does it mean: ref replace=2, why 2?
- Keyboard Shortcuts:
- Prev
- Next
- Toggle

































