Solved

Asp And Word.Application

Posted on 2000-04-10
35
1,368 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
  • 12
  • 6
  • 6
  • +8
35 Comments
 
LVL 4

Expert Comment

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

Expert Comment

by:FRehman
Comment Utility
I think it will use asp third party component
0
 
LVL 1

Accepted Solution

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

please post your e-mail and i'll mail it to you.
0
 
LVL 7

Author Comment

by:weesiong
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi, guyss, i have got it!
Thanx!
0
 
LVL 7

Author Comment

by:weesiong
Comment Utility
Good Man!
0
 
LVL 4

Expert Comment

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

Expert Comment

by:guyss
Comment Utility
FRehman, file is on it's way...

JKValli did you get it ???
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Expert Comment

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

Author Comment

by:weesiong
Comment Utility
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
Comment Utility
on it's way...
0
 

Expert Comment

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

Thanks!
0
 

Expert Comment

by:ydeewana
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I also need help files.Please send me.

My id is rohita@cressanda.com

Thanks in advance
0
 

Expert Comment

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

thanks.
0
 

Expert Comment

by:agg_rohit
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
agg_rohit,

Make sure you have permission to create the DOC.
0
 

Expert Comment

by:agg_rohit
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now