Results 1 to 11 of 11

Thread: Word automation on server

  1. #1
    Hyperactive Member
    Join Date
    Mar 02
    Location
    Stockholm, Sweden
    Posts
    291

    Word automation on server

    Hi,

    I would like to generate word reports on the web server. My web host does not have office installed, and from what I´ve read it´s not recommended to use word on the server.

    Now, I just recently found this out, and I more or less counted on the reporting stuff being quite simple to set up.

    This is what I need.

    The user logs in and uploads data, changes it, calculates it and so on. When this is done he will need to generate a report, allthough preferably in a format he can edit (like maybe adding a comment or a logo or whatever).

    How do I do this? This really needs to look professional so features like page breaks and other kinds of formatting is needed.

    Thanks!

    Fuga.

    edit: It is sufficient if the document is generated and not opened on the server. I think I can require the user to have office installed locally in order to actually open the document and maybe print it. But the content must be generated from the sql database.
    Visual Studio 2010 xpress, Visual Studio 2008 pro, SQL Server, SQL Server management studio 2008 r2, MSAccess

  2. #2
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,738

    Re: Word automation on server

    Hello,

    You may be able to do "something" with the Primary Interop Assemblies for Office, but I believe that this would still require Word to be installed.

    Have you considered using an Out Of The Box reporting solution like Crystal Reports, this:

    http://weblogs.asp.net/rajbk/archive...10-part-1.aspx

    or this:

    http://www.telerik.com/products/reporting.aspx

    Gary

  3. #3
    Hyperactive Member
    Join Date
    Mar 02
    Location
    Stockholm, Sweden
    Posts
    291

    Re: Word automation on server

    Thanks for your reply.

    Yes I have considered crystal, and maybe I´ll go that way.

    The thing is I know that the users would like to mess about with it afterwards. maybe inserting a table of contents and so on. Also the charts a drawn from scratch, so I think I need to use inserted pictures in the report. Pictures, text, lists etc.

    I suppose you can do all that in crystal for instance, it´s just that I already know how to do it in word.

    However, just now I found this

    Is that what I´m looking for or am I missing something? I´ll definitely try it.

    Fuga.
    Visual Studio 2010 xpress, Visual Studio 2008 pro, SQL Server, SQL Server management studio 2008 r2, MSAccess

  4. #4
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,738

    Re: Word automation on server

    Hello,

    That technique will work, yes, however, you would really have to try it to find out whether it will do everything that you need.

    It is relying on the fact that Word can open an HTML file, and allow it to be editable. It may not provide all the functionality that an actual word document does though, so you will have to test it.

    Gary

  5. #5
    Hyperactive Member
    Join Date
    Mar 02
    Location
    Stockholm, Sweden
    Posts
    291

    Re: Word automation on server

    well what do you know!

    It seems to be working. I´ll try some more stuff before resolving the thread though...

    Fuga.
    Visual Studio 2010 xpress, Visual Studio 2008 pro, SQL Server, SQL Server management studio 2008 r2, MSAccess

  6. #6
    Hyperactive Member
    Join Date
    Mar 02
    Location
    Stockholm, Sweden
    Posts
    291

    Re: Word automation on server

    Thanks Gary, I just read your reply.

    Yes, my plan exactly. Some stuff might not work.

    Fuga.
    Visual Studio 2010 xpress, Visual Studio 2008 pro, SQL Server, SQL Server management studio 2008 r2, MSAccess

  7. #7
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,738

    Re: Word automation on server

    Good stuff.

    Let me know if you have any follow up questions.

    Gary

  8. #8
    Hyperactive Member
    Join Date
    Mar 02
    Location
    Stockholm, Sweden
    Posts
    291

    Re: Word automation on server

    Thanks!

    Well, I didn´t quite manage to put an image in there, using
    Code:
    <img src='" & CStr(Server.MapPath("x.jpg")) & "'>
    I´m thinking it might be a permission issue, since it just turns up as a crossed out icon.

    However I´ve come across open xml when searching for information.

    Do you think that´s a good idea, or does that have it´s limitations as well?

    Fuga.
    Visual Studio 2010 xpress, Visual Studio 2008 pro, SQL Server, SQL Server management studio 2008 r2, MSAccess

  9. #9
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,738

    Re: Word automation on server

    Hello,

    Have you verified that the resulting URL from the Server.MapPath call actually correctly links to the picture that you are interested in?

    Open XML is definitely an idea. The latest version of Word implements this standard as well. You can see this with the use of the docx extension. This file is actually just a zip file. Feel free to change the file extension and start having a dig around.

    Definitely worth some investigation to see what you can do with it.

    Gary

  10. #10
    Hyperactive Member
    Join Date
    Mar 02
    Location
    Stockholm, Sweden
    Posts
    291

    Re: Word automation on server

    Have you verified that the resulting URL from the Server.MapPath call actually correctly links to the picture that you are interested in?
    Thanks for the tip. It turns out it wasn´t, so I fixed that. However there is a permission issue as well. At least I think so.

    If I´m logged in, I can view the picture in the browser (in my test.html document), but not when I open it in word.

    Is there a way to "embed" the pictures instead of using the img link? I´m guessing automating a save on the client isn´t possible, as well as retrieving the path from the browser´s save dialog?

    Fuga.
    Visual Studio 2010 xpress, Visual Studio 2008 pro, SQL Server, SQL Server management studio 2008 r2, MSAccess

  11. #11
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,738

    Re: Word automation on server

    Hey,

    Since you are using HTML you could look to doing a base64 encoding of the image, and embedding this into the document.

    More info on this here:

    http://nathondalton.wordpress.com/20...se64-encoding/

    I honestly can't say if this is going to work though, it is not something that I have tried.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •