saving document to asp.net page

J

Jan Kucera

Hi,
We take a template on the server side, fill it with data and send it to the
user. How can we get it back? The user is allowed to do any changes in the
document, before we save it into the database archive.
Thanks for any ideas,
Jan
 
C

Cindy M -WordMVP-

Hi Jan,
We take a template on the server side, fill it with data and send it to the
user. How can we get it back? The user is allowed to do any changes in the
document, before we save it into the database archive.
1. Version of Word

2. How do you "send it to the user"?

3. Are you allowed to include VBA code in the document?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
J

Jan Kucera

Hi Cindy,
1. Version of Word
I'd prefer 2003, but I'm afraid it has to be compatible down to 2000 or
something like that. Please, if there are versions issues, let me know what
can be done in 2003 and what in older ones.
2. How do you "send it to the user"?
Well this also not said definitely, but at the moment by temporarily saving
them to the published folder and sending a http link to the user.
3. Are you allowed to include VBA code in the document?
That's the question. If it is possible without it, I would be happier,
because what to do when the security prevents macros from running?

However, if you can say in 2003 it can be done without macros and in lower
only with them, that's very ok.

Thank you,
Jan.
 
C

Cindy M -WordMVP-

Hi Jan,
I'd prefer 2003, but I'm afraid it has to be compatible down to 2000 or
something like that. Please, if there are versions issues, let me know what
can be done in 2003 and what in older ones.

Well this also not said definitely, but at the moment by temporarily saving
them to the published folder and sending a http link to the user.
So, as it stands, the user will effectively be downloading the document?

Then your only option would be 1) a hyperlink in the document or 2) a button,
toolbar or something similar linked to
- code in the document
- code in a template linked to the document (see Tools/Templates and
Addins, I'm talking about the "attached template" property)
- code in an ADDIN (either template or COM-Addin) distributed to each
machine/user
- possibly, your solution could be a SmartDocument or a VSTO solution

Or... Have you looked at a SharePoint server solution?
That's the question. If it is possible without it, I would be happier,
because what to do when the security prevents macros from running?
It is possible to digitally sign a file, but if they're being generated
completely from scratch, in a server environment...

Is this meant for an enterprise/corporate environment, or would your "clients"
be less, mmm, predictable? If the former, then a managed code solution or
distributed template would make a lot of sense (as listed above). I think I'd
need to know a bit more about the "target audience" to get much more specific
about what would work for you :)
However, if you can say in 2003 it can be done without macros and in lower
only with them, that's very ok.
A SmartDocument or VSTO solution is only possible with 2003; a managed code
COM Addin is acceptable back to version 2000. A (digitally signed) distributed
template is also good from 2000 upwards.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
J

Jan Kucera

Hi Cindy.
Thanks for trying help me. I'm not sure if it was a good idea to separate
my questions in multiple threads, but I thought these are conceptually
different topics, so sorry for complicating it.

Okay, so I'll try to point out my case. The "target audience" is government
offices. So I have one big requirement - do not install anything on the
clients. Be sure I'd love to have VSTO solution, but I am not allowed to
install the framework (I would have a thick application without all these
problems then). (I don't know what is needed to deploy add-ins) Personal
question - what is SmartDocument?
I also can't restrict these offices to use only 2003 Office. My solution
has to work in older versions as well, however it can be easier in 2003 (in
order to admonish to upgrade :) )

The whole lifecycle is:
1) The ASP.net application generates data.
2) The document template is taken from database blob and filled with that
data on the server
3) Client can modify this and complete the document
4) These changes are saved to the database with versioning.
---
The client should also be able to create its own templates (with older
versions of office)

The client is downloading the file at the moment because I didn't find any
easier way how to send it to it, moreover when I need to save the template
to the disk anyway to make it accessible to the Word in order to fill it. I
wish I could call Word with System.IO.Stream for open...and save :(

I don't need to add any UI elements to the document, since I can handle it
all in the document close event, however what to do in this time? How to
store it to the server?

Similar actions are required for Excel files too, so Word-only solution is
maybe not the right way.
---

What I've found and discovered today is, that I could use my http handler to
get and save the documents, if it would be Distributed Authoring and
Versioning compatible... what do you think about this idea? Where can I find
some help if I'd like to implement it? (eg. what should I response to
OPTIONS http method at least in order to get this working)

Thanks, Jan.
 
C

Cindy M -WordMVP-

Hi Jan,

I'm going to take this in the order of "shortest reply"... :)
What I've found and discovered today is, that I could use my http handler to
get and save the documents, if it would be Distributed Authoring and
Versioning compatible... what do you think about this idea? Where can I find
some help if I'd like to implement it? (eg. what should I response to
OPTIONS http method at least in order to get this working)
I'm afraid you're WAY outside may knowledge area on this one :) An IIS
group, perhaps?
The client is downloading the file at the moment because I didn't find any
easier way how to send it to it, moreover when I need to save the template
to the disk anyway to make it accessible to the Word in order to fill it. I
wish I could call Word with System.IO.Stream for open...and save :(

I don't need to add any UI elements to the document, since I can handle it
all in the document close event, however what to do in this time? How to
store it to the server?
My inclination would be to store the documents in Word's XML format. This
way you can stream them when building, versioning, etc. Just use automation
to open the result and save back to doc/xml Format for the last step. Yes,
this will mean saving the stream result to disk, but this way it can be
"temp". And this way, you'll have some elements in-place for an eventual
migration when Word 2007 roles out and the converter becomes available.
Okay, so I'll try to point out my case. The "target audience" is government
offices. So I have one big requirement - do not install anything on the
clients.
That makes it extremely tough, in all respects.
Be sure I'd love to have VSTO solution, but I am not allowed to
install the framework
Odd, that the framework wouldn't already be there. Given the security
requirements, I'd think that would be the "first thing..."
(I don't know what is needed to deploy add-ins)
Depends on what kind we're discussing :) A template Addin would "merely"
need to be copied into the user's Word Startup folder. A COM-Addin would
need to be registered on the machine, but it would be a single file. A
managed COM Add-in is more than one file, but still needs to be registered
on the machine.
Personal question - what is SmartDocument?
Word 2003 only. Implements the SmartDocument interface of the SmartTags
"thingy". It lets you present the user with a customized task pane for
performing actions (such as data entry, providing lists from
databanks/webservices, sending the document back). The taskpane is based on
XML tags inserted in the document (but generally not visible to the user);
requires a schema that defines the XML tags. Setup/installation/update is
controlled by a manifest. Can be COM or managed code.
To summarize:
The whole lifecycle is:
1) The ASP.net application generates data.
2) The document template is taken from database blob and filled with that
data on the server
3) Client can modify this and complete the document
4) These changes are saved to the database with versioning.
As mentioned above, I'd go with XML for 1 & 2, just opening it in Word 2003
and saving as a "regular" *.doc file as a last step, before providing the
user with the document.

Given that you can't install anything on the user's machines: Sending back
just isn't going to be something you can build into this, short of a
"mailto" hyperlink, unless macro code (in conjunction with a toolbar saved
in the document or an ActiveX control, such as a button) can be included in
the document.

If you go the XML route, you can include any macro code and toolbars in a
transform, so that processing client-generated templates shouldn't be a big
problem. Save them in Word 2003 as XML, then run the transform before
popping them into the database.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
J

Jan Kucera

Hi Cindy,
I've finally made an http handler to act as a DAV-compilant gateway to the
database and it works very cool.
My only bigger problem is the name of the file interpreted by word. It
downloads the file eg. from http:// ...
/Document.ashx/b08f4011-e025-40ac-97fb-4c55ba3d2bce (I access the files
through guid). The title of the window is that guid and at the save time it
asks Do you want to save changes to b08f4011-e025-40ac-97fb-4c55ba3d2bce?
Where can I say what filename should the Word display?
I have MyDocument.doc in the <displayname> properties of the resource,
which is required to be set on all resource by the protocol, but Word just
doesn't ask for these properties.. :(

Thanks for any idea...
Jan
 
C

Cindy M -WordMVP-

Hi Jan,
I've finally made an http handler to act as a DAV-compilant gateway to the
database and it works very cool.
My only bigger problem is the name of the file interpreted by word. It
downloads the file eg. from http:// ...
/Document.ashx/b08f4011-e025-40ac-97fb-4c55ba3d2bce (I access the files
through guid). The title of the window is that guid and at the save time it
asks Do you want to save changes to b08f4011-e025-40ac-97fb-4c55ba3d2bce?
Where can I say what filename should the Word display?
I have MyDocument.doc in the <displayname> properties of the resource,
which is required to be set on all resource by the protocol, but Word just
doesn't ask for these properties.. :(
Well, you can change the display of the title bar by setting the
ActiveWindow.Caption.

The Save As dialog box is another problem, altogether. That will always show
the file name, as saved to disk. All you could do is use the SaveAs method to
save it to disk as another file name, then the user will see that.

If you had a template on the user's machine, or code in the document, then you
could include a procedure named FileSaveAs and display your own dialog box,
instead.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top