Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to generate dynamic word /pdf docs through web tools?

Status
Not open for further replies.

csk003

Programmer
Feb 9, 2004
26
US
I will have a word template and based on user's selection can I get that template filled so that user can download the document?

Eg: User will select City Name and County Name from a list box/dop down. I need to use the values user selected to fill in the word document and display it so that the word doc can be printed/saved?

 
This should get you started.
Here is some VB Code, simply translate it to ASP.

Code:
Private m_oWordApp As Word.Application
Private m_oWordDoc As Word.Document

Set m_oWordApp = CreateObject("Word.Application")
    Set m_oWordDoc = m_oWordApp.Documents.Add(App.Path & "\your.dot")

Dim oTable As Word.Table
    Dim oCell As Word.Cell
    
    Dim strTextValue As String

    m_oWordApp.Selection.Font.Name = "Times New Roman"
    m_oWordApp.Selection.Font.Size = 8
    m_oWordApp.Selection.Font.Color = wdColorBlack
    
    
    m_oWordApp.Selection.TypeText vbCrLf
  
    
    Set oTable = m_oWordApp.Selection.Tables.Add(m_oWordApp.Selection.Range, 2, 5)
    oTable.Id = "tblRiskMark"

    oTable.Select
    oTable.AllowAutoFit = True
    oTable.BottomPadding = 2
    oTable.TopPadding = 2
    
    oTable.Borders.InsideLineStyle = wdLineStyleNone
    oTable.Borders.OutsideLineStyle = wdLineStyleSingle
    oTable.PreferredWidth = InchesToPoints(6.5)


    Set oCell = oTable.Cell(1, 1)
        oCell.Select
        m_oWordApp.Selection.Font.Bold = True
        m_oWordApp.Selection.TypeText "Something to type"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top