Solved

Asp And Word.Application

Posted on 2000-04-10
35
1,377 Views
Last Modified: 2010-05-18
I want to know where can found all  word.application command can user in asp, as like Document.Add, Visible = True, Selection.Font.Bold = True, Selection.TypeText, ActiveDocument.SaveAs and blah blah.....
0
Comment
Question by:weesiong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 6
  • 6
  • +8
35 Comments
 
LVL 4

Expert Comment

by:FRehman
ID: 2702903
interesting question but I think it is not possible on server side
0
 
LVL 4

Expert Comment

by:FRehman
ID: 2702905
I think it will use asp third party component
0
 
LVL 1

Accepted Solution

by:
guyss earned 50 total points
ID: 2702965
i have the information in a .hlp file

please post your e-mail and i'll mail it to you.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:weesiong
ID: 2703059
hi, guyss what is ur email address, my email address = weesiong@rocketmail.com, please post .hlp file to me, thanx!
0
 
LVL 1

Expert Comment

by:guyss
ID: 2703066
i just sent it.

some one told me it comes from MS office  but i didn't seem to find it there, anyway just search for the word "Application" and you'll find the object.
0
 

Expert Comment

by:jkvalli
ID: 2703154
Hi guyss,
Interested in knowing about the help file. Pl. send the .hlp file to my mail id jkvalli@calsoft.co.in. Thanks.
0
 
LVL 10

Expert Comment

by:makerp
ID: 2703762
this creates a word document on the client and puts the body of the HTML page in it.

set myObj = createobject("word.application")
myObj.visible = true
set mydoc = myobj.documents.add
myobj.ActiveDocument.Words(1).Text = document.body.outerHTML  

this might help ... i havnt read the whole thread  
0
 
LVL 7

Author Comment

by:weesiong
ID: 2704216
hi, guyss, i have open the file u send to me, but it seem no as like .hlp file. can u teach me how to user the file?
0
 
LVL 1

Expert Comment

by:guyss
ID: 2704263
it's a .zip file open it to get the .hlp file.
you can download winzip if you need it
at www.tucows.com
0
 
LVL 7

Author Comment

by:weesiong
ID: 2704301
hi, guyss
i have unzip it, but it is so many js page and few html page, and got .exe file, are you have sent wrong the file?
0
 
LVL 7

Author Comment

by:weesiong
ID: 2704316
hi, guyss
i have unzip it, but it is so many js page and few html page, and got .exe file, are you have sent wrong the file?
0
 
LVL 1

Expert Comment

by:guyss
ID: 2704388
did i send cbawrd.zip ?
this is the correct file,
i has 1 .hlp file in the zip.
0
 
LVL 15

Expert Comment

by:robbert
ID: 2705200
The easiest way is to record Word macros and, adopt them.
Also, there is the Word Visual Basic Editor: Menu: Extras | Macros | Visual Basic Editor.
In the VBE, select Menu: Edit | Object Browser, to see all methods and properties. Select an item and press F1 for help.
-- If there are problems converting the macros to VBScript, call back.
0
 
LVL 7

Author Comment

by:weesiong
ID: 2706089
Hi, guyss, i have got it!
Thanx!
0
 
LVL 7

Author Comment

by:weesiong
ID: 2706091
Good Man!
0
 
LVL 4

Expert Comment

by:FRehman
ID: 2706395
will you please send me the correct file at leo_faisal@yahoo.com
0
 
LVL 1

Expert Comment

by:guyss
ID: 2706558
FRehman, file is on it's way...

JKValli did you get it ???
0
 

Expert Comment

by:jkvalli
ID: 2706813
Nice Stuff, I am working on it.
Thanks.
0
 
LVL 7

Author Comment

by:weesiong
ID: 3157090
guyss can you send the cbawrd.zip to me again, because i've deleted it.
thanx! or anyone who got the files also can send to me please!
0
 
LVL 1

Expert Comment

by:guyss
ID: 3157835
on it's way...
0
 

Expert Comment

by:broby425
ID: 7575333
Hey guyss, I'd like a copy of the help file too, please.

Thanks!
0
 

Expert Comment

by:ydeewana
ID: 7930037
Guys,

i like to have this file too. My new project is, i have to take data from word document and add it in access. but i was thinking to have word document in ASP form and when i send mail to client.. transfer in MS word version. is it possible?

Please post your comments or email to me at ydeewana@yahoo.com

Thanks,

Yash
0
 

Expert Comment

by:k_murali_k
ID: 7955635
Hi, I too need the zip file. Please mail it to me also at kunapareddy@hotpop.com

Thanks
0
 
LVL 7

Author Comment

by:weesiong
ID: 7965078
Sorry forget bring the file to office, will try remember and upload the file to some place.

Best Regards,
Wee Siong
0
 
LVL 7

Author Comment

by:weesiong
ID: 7980740
Hi All,

I have sent the help files to you, the file about 3mb, i no sure your mailbox can get these big size mail or not, if cannot get it please let me know. Thanks.

best regards,
Wee Siong
0
 

Expert Comment

by:agg_rohit
ID: 8040127
I also need help files.Please send me.

My id is rohita@cressanda.com

Thanks in advance
0
 

Expert Comment

by:prateek_shri
ID: 8065093
Please send me the help files too.
my e-mail id: prateek@scanbuy.com

thanks.
0
 

Expert Comment

by:agg_rohit
ID: 8078154
when i edit word document through VB it works but not through ASP .Page remains in hanged state. Neither it edits nor it shows any message
0
 
LVL 7

Author Comment

by:weesiong
ID: 8078342
agg_rohit,

You can try post your code in here, i have try use ASP create the .doc and it work.


Best Regards,
Wee siong
0
 

Expert Comment

by:agg_rohit
ID: 8078387
i have created an DLL. when i edit through VB form it works but when doing same thing in ASP it does not.


clsWord.cls
******************************************************
'local variable(s) to hold property value(s)

Private P_Range As Range  'local copy
Public P_FileName As String  'local copy
 Public Property Set MRange(ByVal vData As Range)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Range = Form1
    Set P_Range = vData
    Set vData = Nothing
End Property


Public Property Get MRange() As Range
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Range
    Set MRange = P_Range
   
End Property


Public Property Let FileName(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.FileName = 5
    P_FileName = vData
End Property


Public Property Get FileName() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.FileName
    FileName = P_FileName
End Property


Public Function OpenFile(ReadOnlyMode As Boolean) As Boolean

On Error GoTo ErrorHandler

  If ReadOnlyMode = True Then
 
      Call MobjWordapp.Application.Documents.Open(P_FileName, , True)
      OpenFile = True
      Exit Function
  End If
 
  Call MobjWordapp.Application.Documents.Open(P_FileName, , False)
  OpenFile = True
  Exit Function

ErrorHandler:

MsgBox (Err.Description & Err.Number)

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function
Public Function Save() As Boolean

On Error GoTo ErrorHandler

 
  Call MobjWordapp.Application.Documents(P_FileName).Save
  MobjWordapp.Application.Documents(P_FileName).Saved = True

  Save = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function

Public Function Saveas(SFileName As String) As Boolean


 On Error GoTo ErrorHandler

 
  Call MobjWordapp.Application.Documents(P_FileName).Saveas(SFileName, , , , , , False)
 ' MobjWordapp.Application.ActiveDocument.Saved = True
    MobjWordapp.Application.Documents(SFileName).Close
  Saveas = True
 
  Exit Function
 
ErrorHandler:
MsgBox (Err.Description & Err.Number)
Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function


Public Function CloseFile() As Boolean

On Error GoTo ErrorHandler

 
  Call MobjWordapp.Application.Documents(P_FileName).Close

   CloseFile = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function
Public Function CreateFile() As Boolean

On Error GoTo ErrorHandler
 Dim MobjDoc As Word.Document
 
   Set MobjDoc = MobjWordapp.Application.Documents.Add
   
   MobjDoc.Saveas (P_FileName)
   
   Set MobjDoc = Nothing

   CreateFile = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)
Set MobjDoc = Nothing

End Function
Public Function SetWordRange() As Boolean

On Error GoTo ErrorHandler
    Set MRange = MobjWordapp.ActiveDocument.Content
     
    With MRange
        .Start = 0
        .End = MobjWordapp.ActiveDocument.Characters.Count
    End With
    SetWordRange = True
   
   Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)

End Function
Public Function InsertAtStart(Data As String) As Boolean

On Error GoTo ErrorHandler
 
 Call SetWordRange
 
   P_Range.InsertBefore (Data)

   InsertAtStart = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)
Set MobjDoc = Nothing

End Function


Public Function InsertAtEnd(Data As String) As Boolean

On Error GoTo ErrorHandler
 
 Call SetWordRange
 
   P_Range.InsertAfter (Data)

   InsertAtEnd = True
 
  Exit Function
 
ErrorHandler:

Call App.LogEvent(Err.Description & Err.Number, vbLogEventTypeError)
Set MobjDoc = Nothing

End Function
***************************************************

modcommon.bas
********************************************************
'Public P_FileName As String 'local copy
       
Public MobjWordapp As Word.Application
     
'Public MobjWordDocument  As Word.Document

Public Sub Main()
   
    With App
            .StartLogging "C:\CslWord.Log", 2
            'LogMode = 2 should be the same as vbLogToFile,
            'but vbLogToFile constant is not defined as shown
            'in books online.
           
            .LogEvent "Specified Path File Logging " & Now, vbLogEventTypeInformation
            .LogEvent .LogPath
            .LogEvent .LogMode
End With

    Set MobjWordapp = CreateObject("Word.Application")
       
End Sub

***********************************************************

frm1.frm
**********************************************************
Private Sub Command1_Click()
Dim x As New clsWord
x.FileName = "c:\1.doc"
x.OpenFile (True)
x.InsertAtStart ("Hi x")
x.InsertAtEnd ("Bye x")
x.Saveas ("c:\2.doc")
Set x = Nothing
End Sub

In ASP
*******************************************************
 <%
 Dim x,FileName,tempFile,strStart,strEnd
 set x=server.CreateObject("cslWord.clsWord")
 x.FileName = "c:\1.doc"
 x.OpenFile (True)
 x.InsertAtStart ("Hi x")
 x.InsertAtEnd ("Bye x")
 x.Saveas ("c:\2.doc")
 Set x = Nothing
 %>

my email ID is agg_rohit@yahoo.com

if you have yahoo messenger then i am online


thanks for your response
0
 
LVL 7

Author Comment

by:weesiong
ID: 8078437
agg_rohit,

Make sure you have permission to create the DOC.
0
 

Expert Comment

by:agg_rohit
ID: 8078462
i am opening 1.doc into readonly mode and then edit and then save it as 2.doc into writable mode.

if it can work through form then why not from web.
what have you done ,can you send me your code through zip files so that i can run and see them.

0
 

Expert Comment

by:agg_rohit
ID: 8078539
i am opening 1.doc into readonly mode and then edit and then save it as 2.doc into writable mode.

if it can work through form then why not from web.
what have you done ,can you send me your code through zip files so that i can run and see them.

0
 

Expert Comment

by:agg_rohit
ID: 8078831

i am opening 1.doc into readonly mode and then edit and then save it as 2.doc into writable mode.

it is working fine through VB form but gives following errors through web.

Error       Application C:\CslWord.Log: Thread ID: 1308 ,Logged: Could not open macro storage.5981
Error       Application C:\CslWord.Log: Thread ID: 1308 ,Logged: Could not open macro storage.5981
Error       Application C:\CslWord.Log: Thread ID: 1308 ,Logged: Object variable or With block variable not set91
0
 
LVL 7

Author Comment

by:weesiong
ID: 8079130
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question