Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

Automation of Word from .net 2


Hello,
I'm developing an intranet (win XP, .NET 2, Visual Studio 2005,
Microsoft.Office.Interop.Word.dll in references) and needed to
implement find-replace in word doc before sending letter and it worked
fine on my station.
I've go it fine on my station, and it doesn't work at all on the web
server.
1.  What should be the configuration of the server? There is .net SDK
2 and I've installed the oxppia.exe there. And changed the permissions
in DCOMCNFG for Word doc for ASP.NET user.
Should I also install there Offce XP?

2.  Do I undestand correctly, that using Office 2003 will require
purchasing VSTO also?

PLEASE answer my questions, I'm completely lost and we planned on
starting to work with the site next week.

Thanks in advance

<liya.tan@gmail.com> wrote in message

news:1170029905.346451.206420@h3g2000cwc.googlegroups.com...

> I'm developing an intranet (win XP, .NET 2, Visual Studio 2005,
> Microsoft.Office.Interop.Word.dll in references)

Firstly, you really need to understand that server-side automation of Office
is not recommended at all to the extent that Microsoft won't actually
support any application which uses it:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

If you absolutely *have* to use Microsoft Word for what appears to be a
fairly simple mail function, then you need to consider a 3rd-party solution
like this:
http://www.aspose.com/Products/Aspose.Words/Default.aspx

There are several other possible solutions:

1) Create the email as an HTML document. If you save it and give it a .doc
extension, Word will open it just like a native Word document

2) Use this:
http://www.microsoft.com/downloads/details.aspx?familyid=fe118952-354...

3) If your email absolutely has to be in the form of an attachment, consider
using a PDF document instead of a Word document.

-----------------------------------------------Reply-----------------------------------------------

Thank you  for your quick answer.

My requirements are very strict.
The intranet will be used with existing docs, so PDF is not an option.
The client wants to send word only (not html) because his clients
requests word.
3-rd party is not also an option :(

So I need to use Word.

Do I need Office on the server for the automation? Will Office XP
answer my problems?

I'm asking also about Office 2003 and VSTo (if it is a must or not for
office 2003) , since the system administrator at my client's office
have installed Office 2003 on the web server and it surely didn't help
me, since I'm using xp redistributables. Tried ti switch to Office
2003, but couldn't find any article about web sites without mentioning
VSTO, so I'm just lost and very stressed on this.
Sorry for the simple questions.

On Jan 29, 2:33 am, "Mark Rae" <m@markNOSPAMrae.com> wrote:

On Jan 29, 12:57 am, liya.tan@gmail.com wrote:

> Thank you  for your quick answer.

> My requirements are very strict.
> The intranet will be used with existing docs, so PDF is not an option.
> The client wants to send word only (not html) because his clients
> requests word.
> 3-rd party is not also an option :(

> So I need to use Word.

You will need office on the server but as Mark pointed out you
shouldn't use Office automation on a webserver, I had the same issue
as you (tho I needed excel) from a server. After looking into and
having the problems which office automation has from aspnet it was
cheaper and easier to use the Aspose library. The cost, trouble and
lack of support of server side office automation means you should stay
clear of it (remebering you will require a license to install office
on the server). It is cheaper and far easier to go the 3rd party
route.

why is 3rd party not an option? If it's cost then IMO it would be
cheaper to purchase the aspose library and get something you know will
work and is supported.

-----------------------------------------------Reply-----------------------------------------------

<liya.tan@gmail.com> wrote in message

news:1170032257.171611.256930@v33g2000cwv.googlegroups.com...

> The client wants to send word only (not html) because his clients
> requests word.

You might find that they'd never know the difference! If they receive an
email with an attachment called e.g. Document.doc, what would they care if
it's actually an HTML document or a Word document...? When they click it, it
will display in Word just like a native Word document...

> So I need to use Word.

Best of luck, then...

> Do I need Office on the server for the automation?

Probably - how many licenses have you got...?

> Will Office XP answer my problems?

I have no idea...

> I'm asking also about Office 2003 and VSTo

Hasn't that already been discontinued...?
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1006730&SiteID=1

> since the system administrator at my client's office have installed Office
> 2003
> on the web server

Wow!

> so I'm just lost and very stressed on this.

I appreciate that. However, you asked for advice and I gave it - I can't
help it if it's not what you wanted to hear...

You say you're stressed now - if you do go down this route, I can guarantee
you're going to get a lot more stressed as soon as your site goes live...

Office automation is not designed for this scenario. Please read the
Microsoft article again:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

-----------------------------------------------Reply-----------------------------------------------

Thank you for your time.
Unfortunately, I have given documents that I need to send more then
once with different changes ( to different clients),
so I'll continue with the headache :))

THank you again

On Jan 29, 3:32 am, "Mark Rae" <m@markNOSPAMrae.com> wrote:

There are many ways to generate Word documents without using COM automation
on the server (which is not recommended.)
Here are more details on generated Word (and Excel) documents:
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/articles/ExportPanel.aspx

Here are some decent 3rd party options that can help with opening existing
Word docs and modifying the content before sending it out:
http://SteveOrr.net/reviews/AsposeWord.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

<liya.tan@gmail.com> wrote in message

news:1170029905.346451.206420@h3g2000cwc.googlegroups.com...

<liya.tan@gmail.com> wrote in message

news:1170055333.086878.40220@p10g2000cwp.googlegroups.com...

> Unfortunately, I have given documents that I need to send more then
> once with different changes ( to different clients),

You really don't get it, do you...?

> so I'll continue with the headache :))

It's going to get much, much worse once your site goes live - you do *know*
that, don't you...?

I wonder how your clients would feel about you if they knew that you are
continuing to pursue a development strategy which in all likelihood will not
work properly...?

-----------------------------------------------Reply-----------------------------------------------

"Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <S@Orr.net> wrote in
message news:B27E8081-C228-44F8-ABAC-6CD88FBE7920@microsoft.com...

> There are many ways to generate Word documents without using COM
> automation on the server (which is not recommended.)

The OP has already been given these recommendations but has chosen to ignore
them in favour of COM automation in the full knowledge that there is more
than a good chance that it will not work...

-----------------------------------------------Reply-----------------------------------------------
Mark,

I agree with you that it's not a good idea.
But, it could work if his scalability requirements are VERY low and he has
excellent error recovery in place...

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

"Mark Rae" <m@markNOSPAMrae.com> wrote in message

news:OY8%23%23o3QHHA.3520@TK2MSFTNGP05.phx.gbl...

Mark,

I agree with you that it's not a good idea.
But, it could work if his scalability requirements are VERY low and he has
excellent error recovery in place...

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

"Mark Rae" <m@markNOSPAMrae.com> wrote in message

news:uNDhPr3QHHA.496@TK2MSFTNGP06.phx.gbl...

"Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <S@Orr.net> wrote in
message news:EF49706B-CBC1-40B7-BDB2-6C1374DB4914@microsoft.com...

> I agree with you that it's not a good idea.
> But, it could work if his scalability requirements are VERY low and he has
> excellent error recovery in place...

Of course - but surely nobody in their right mind would ever contemplate a
solution which only "could" work...?

-----------------------------------------------Reply-----------------------------------------------
I agree.  I have done a lot of work with word automation from within asp.net
and its not a good idea at all.

The only safe way is to queue the jobs in asp.net and work out a way of
processing them singularly, within a desktop environment where it belongs.
Create some form of wordserver application that can access the data on the
asp.net server and seperate the activities.

--
--
Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <S@Orr.net> wrote in
message news:C7365B96-3188-45C7-A55F-74DD774F996C@microsoft.com...

"John Timney (MVP)" <x_j@timney.eclipse.co.uk> wrote in message
news:SuudnbmvN4NdRiDYnZ2dnUVZ8v2vnZ2d@eclipse.net.uk...

>I agree.  I have done a lot of work with word automation from within
>asp.net and its not a good idea at all.

I have a feeling none of this will make very much difference to the OP,
though...:-)

> The only safe way is to queue the jobs in asp.net and work out a way of
> processing them singularly, within a desktop environment where it belongs.
> Create some form of wordserver application that can access the data on the
> asp.net server and seperate the activities.

Unless the documents are incredibly complex, I've always found the HTML
approach to be the most efficient - give it a .doc extension, and the
recipient of the email will have no idea that it's not a native Word
document...

-----------------------------------------------Reply-----------------------------------------------
On Jan 29, 12:02 pm, "Mark Rae" <m@markNOSPAMrae.com> wrote:

> "John Timney (MVP)" <x_j@timney.eclipse.co.uk> wrote in messagenews:SuudnbmvN4NdRiDYnZ2dnUVZ8v2vnZ2d@eclipse.net.uk...

> >I agree.  I have done a lot of work with word automation from within
> >asp.net and its not a good idea at all.I have a feeling none of this will make very much difference to the OP,
> though...:-)

> > The only safe way is to queue the jobs in asp.net and work out a way of
> > processing them singularly, within a desktop environment where it belongs.
> > Create some form of wordserver application that can access the data on the
> > asp.net server and seperate the activities.Unless the documents are incredibly complex, I've always found the HTML
> approach to be the most efficient - give it a .doc extension, and the
> recipient of the email will have no idea that it's not a native Word
> document...

Couldn't another possibility be to use Word 2007 format, since it's
xml based this should cause no problems and allow the OP to write the
code themselve instead of using 3rd party (still far too much work and
time than needed). Of course this would require either Office 2007
installed on the client or the docx plugin for Office 2003. Tho the
requirement for it to work with existing documents would probably make
this not an option.

I don't get people who ask for advice and never listen to it.

-----------------------------------------------Reply-----------------------------------------------

"Luke" <m@lukesmith.net> wrote in message

news:1170091637.358374.167770@q2g2000cwa.googlegroups.com...

> Couldn't another possibility be to use Word 2007 format, since it's
> xml based this should cause no problems and allow the OP to write the
> code themselve instead of using 3rd party (still far too much work and
> time than needed).

Yes.

> Of course this would require either Office 2007 installed on the client
> or the docx plugin for Office 2003. Tho the requirement for it to work
> with existing documents would probably make this not an option.

Depends on your perspective, I guess...

> I don't get people who ask for advice and never listen to it.

It's incredible...

-----------------------------------------------Reply-----------------------------------------------

not very nice I'd say.
learnt a lot from the discussion and 'll try to change as much as I
could.
but one thing: I'll try to stay away from the groups, didn't like your
approach of "go to the corner".
You should be very proud of yourself being an expert. I've just asked
about something that never touched and never heard before.

on the over hand, why am I bothering teaching someone manners?

On Jan 29, 7:41 pm, "Mark Rae" <m@markNOSPAMrae.com> wrote:

I do listen, I just don't have the money for 3rd party and licences
for Office (xp and 2003) already purchased.
We planned to start using the automation and then to choose our
strategy, since there are many limitations of time
Also we are talking about intranet (not more then 30 users).
I'll have a hardtime persuading the client to switch the strategy
right now.

On Jan 29, 7:27 pm, "Luke" <m@lukesmith.net> wrote:

Hi, thank you for your answer.
unfortunately investing more money right now is not an option for my
client,
so it might happen that Office is the only choise right now.
I'm checking your exmples

On Jan 29, 9:48 am, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"

hi, thank you for your answer.
Could you please point me to some articles explaining your advise?
It would be of great help.
Sorry for the late answer , didn't see your answer before.

On Jan 29, 1:34 pm, "John Timney \(MVP\)"

<liya.tan@gmail.com> wrote in message

news:1170111772.066971.102160@p10g2000cwp.googlegroups.com...

> I do listen,

You obviously don't...

> I'll have a hardtime persuading the client to switch the strategy
> right now.

And what will you say to your client when your application doesn't work...?
You'll have a much harder time then, won't you...!

Your original post asked for help implementing server-side Office
automation.

You were advised my several people, some much more experienced and
well-respected than me, that this strategy will almost certainly not work
because it's simply not designed to work this way.

I provided you with a link to a Microsoft article explaining this in much
greater detail, why they do not recommend this approach, and how they will
not support any application which uses it...

You didn't like this... No doubt it will be very embarrassing at this late
stage for you to go to your client and tell them that your lack of
experience has led you to designing a solution which will almost certainly
never work. If you're lucky, maybe all they will do is terminate your
contract and not pay you - if you're very unlucky, maybe they will sue you
for professional negligence - there's not much anybody here can do about
that...

You're the only person who can fix this...

Several alternative solutions have been offered to you, some of them
COMPLETELY FREE.

You don't have to choose any of them.

There's an expression in English which says: "There's none so blind as those
who will not see."

Best of luck to you - you're really going to need it... :-)

-----------------------------------------------Reply-----------------------------------------------

The concept is quite simple really.  Your document uploads, data capture
(email) etc etc. are done using asp.net and the role of asp.net pretty much
ends there.  Its job is to accept work and stick it in a queue.

Another machine processes the queue sequentially and returns the processed
work to the initiator.  On a busy site there is a wait period, so the
replies are normally by email.  As the jobs are sequential, your single
instance of office should easily cope.  To scale out the solution, add more
job servers.

As people have pointed out, word is not best suited for automation on web
servers - so think outside the box and remove that specific element of the
problem.

--
Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

<liya.tan@gmail.com> wrote in message

news:1170112204.825946.81660@k78g2000cwa.googlegroups.com...

This queueing strategy seems like the best advice anyone came up with
for this question.  Of course, her client isn't going to like it
because the emails will be delayed a few minutes.  I wish her the best
of luck explaining why it has to be that way.

As for the rest of you... have you never had a client insist on using
a product or an implementation strategy that really wasn't the best
way to go?  You give them the best advice you can, then you do what
they want to the best of their ability and if it works at all you take
their money.  Particularly when integrating legacy software or
documents, you may not get much choice about formats.

On Jan 30, 5:04 am, "John Timney \(MVP\)"

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc