Saving documents on server side.

Source: Internet
Author: User

Source: http://www.imcoder.org/enterprise-service/210201.htm

 

Q:

** Warning: possibly big newbie question below .**

Greetings,

Part of a web application I am developing involves generation of word documents (which I do using Word COM object) based on data provided by the client and then the application has to store them on the server.

However, I have yet to find the proper way in which to provide the paths needed both to save the document on the server and to load the template. I thought something like 'Folder-to-store-stuff/document.doc 'or'/folder-to-store-stuff/document.doc 'wocould work .. well, it didn't (Folders exist on the application path, so it's not that they weren't created ).

It is not a folder permission issue, the errors I get are that either the path is unreachable or that it cannot create the instance of Document because of not being able to find the path.

Any kind of help or directions wowould be greatly appreciated.

A: Hello, Can you please post some of your code so we can look at how your referenceing to the location of the folders.:

Greetings,

This is the method I created for the generation of the statements.

Sub

CreateDocument (ByVal empresa As String, ByVal contacto As String, ByVal pasante As String, ByVal tutor As String, ByVal duracion As String, ByVal desde As String, ByVal hasta As String)

Dim wa As New Word. ApplicationClass
Dim oTemplate As String = "/Documents/Templates/Template. dot"
Dim wd As Word. Document = wa. Documents. Add (oTemplate)
Dim ruta As String
Ruta = "/Documents/Contract" & AdministradorPasantias. getObject. getPasante. idPasante. ToString & response. getObject. getPasante. idPasantia. ToString & ". doc"

Try
Wd. Activate ()
'Assigns to each bookmark the corresponging value from the form.
Wd. Bookmarks. Item ("observaciones"). Range. Text = objInforme. observaciones
Wd. Bookmarks. Item ("empresa"). Range. Text = empresa
Wd. Bookmarks. Item ("contacto"). Range. Text = contacto
Wd. Bookmarks. Item ("pasante"). Range. Text = pasante
Wd. Bookmarks. Item ("duracion"). Range. Text = duracion
Wd. Bookmarks. Item ("tutor"). Range. Text = tutor
Wd. Bookmarks. Item ("desde"). Range. Text = desde
Wd. Bookmarks. Item ("hasta"). Range. Text = hasta
Wd. SaveAs (ruta)
Wd. Application. Quit ()
Catch ex As Exception

End Try
End Sub

The directory where I have the application has the corresponding "/Documents/Templates/" and "/Documents/Contract Documents/" inside.

Again, any kind of help will be greatly appreciated. I'm sure I must be missing something simple but... well, I'm stuck.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.