午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    ASP打印Word代碼
    來源:易賢網(wǎng) 閱讀:1680 次 日期:2014-09-09 11:44:25
    溫馨提示:易賢網(wǎng)小編為您整理了“ASP打印Word代碼”,方便廣大網(wǎng)友查閱!

    //保證可以運行js的情況下

    <html>

    <head>

    <title>Build Document by Script</TITLE>

    </HEAD>

    <Table id="myData" border=1 align=center>

    <Tr align=center>

    <Td>列表1</Td>

    <Td>列表2</Td>

    <Td>列表3</Td>

    </Tr>

    <Tr align=center>

    <Td>產(chǎn)品一</Td>

    <Td>This is a test</Td>

    <Td align=right>300.50</Td>

    </Tr>

    <Tr align=center>

    <Td>產(chǎn)品二</Td>

    <Td>This is a test</Td>

    <Td align=right>300.50</Td>

    </Tr>

    <Tr align=center>

    <Td>產(chǎn)品三</Td>

    <Td>This is a test</Td>

    <Td align=right>300.50</Td>

    </Tr>

    </Tabld>

    <input type=button onclick="vbscript:buildDoc '',4" value="build">

    <BODY>

    </BODY>

    </HTML>

    <script language="vbscript">

    Sub buildDoc(theTemplate,intTableRows)

    Dim Table1

    set Table1 = document.all.myData

    row = Table1.rows.length

    Set objWordDoc = CreateObject("Word.Document")

    ObjWordDoc.Application.Visible=True

    Dim theArray(4,4)

    'Redim Preserve theArray(4,row)

    colnum = Table1.rows(1).cells.length

    for i=0 to row-1

    for j=0 to colnum-1

    theArray(j+1,i+1) = Table1.rows(i).cells(j).innerHTML

    next

    next

    intNumrows = 4

    objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("測試的表格")

    objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")

    objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")

    Set rngPara = objWordDoc.Application.ActiveDocument.Paragraphs(1).Range

    With rngPara

    .Bold = True

    .ParagraphFormat.Alignment = 1

    .Font.Name = "Arial"

    .Font.Size = 12

    End With

    Set rngCurrent = objWordDoc.Application.ActiveDocument.Paragraphs(3).Range

    Set tabCurrent = ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,intNumrows,4)

    for i = 1 to colnum

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.InsertAfter theArray(i,1)

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.ParagraphFormat.alignment=1

    next

    tabRow = 2

    For j = 2 to intNumrows

    'ObjWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Borders.Enable=False

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(1).Range.InsertAfter theArray(1,j)

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(1).Range.ParagraphFormat.alignment=1

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(2).Range.InsertAfter theArray(2,j)

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(2).Range.ParagraphFormat.alignment=1

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.InsertAfter FormatCurrency(theArray(3,j))

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.ParagraphFormat.alignment=2

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter theArray(4,j)

    'objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter Chr(10)

    objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.ParagraphFormat.alignment=1

    tabRow = tabRow + 1

    Next

    ' objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.ParagraphFormat.alignment=1

    'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")

    'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")

    'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Regards,")

    'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")

    'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Daryl B. Morticum")

    'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Sales Associate")

    'objWordDoc.Application.ActiveDocument.Envelope.Insert Address

    ' objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("由廖家遠設(shè)計")

    objWordDoc.Application.ActiveDocument.SaveAs "tempSample.doc", 0,False,"",True,"",False,False,False, False,False

    'objWordDoc.Application.printout()

    End Sub

    </script>

    更多信息請查看IT技術(shù)專欄

    更多信息請查看腳本欄目
    易賢網(wǎng)手機網(wǎng)站地址:ASP打印Word代碼

    2025國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)