????? ??????? ASP ?????? ???? ?????? XML ????? ??????

?????? ????????? ?????? ?????????
???? ???????: 288130 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ?????? ???????? ????? Microsoft ????? ?????? ?????? (ASP) ???? ???? ?????? ?? ????? ???? ?????? XML (XMLSS) ???????? ???? ???? ???????? Office. ???? ?? ???? XMLSS ???? ???????? ?? ???? ??? ?????:
  • ?? ???? ???? ???????? ??? ???? ???
  • ?? Microsoft Excel ???? ?? ??? ?????? ?? ????????
  • ??? ?????? ?? Microsoft Excel

??????? ????

???? ??????? ???? ???? ???????? ?? ??????? ?????? ?? ???? ?????? ?????? ????? ???????? ???? ?????? ?????? ??????? ???? ?????? ???????? ?? ???? ?????? ??????? ?? Microsoft Excel. ?????? ?? recomment ??????? ?? ??????? Office? ??? ?? ??? Excel? ??? ??????. ??? ???? ??? ??????? ??? ???? ?? ????? ???? ?? ?????? ??????? ?????. ???? ?? ????? XMLSS ?????? ?? ??????? ???????? ?? ?? ?? "???? ???? ????????" ? "Microsoft Excel. ???????? multi-sheet ????? ??????? ? ??????? ????????? ? ??? ??????? ? re-calculation ???? ?????? ?? ??? ???????. ???? ???? ???????? ????? ??? ???? ???? ???? ???? ?? ???? ???? ??????? Microsoft Excel. ????? ??? ??? ??????? ??? ???? ???? Excel ? ????? ?????? ????? ??? ????????? ???????? ?????? ?? ???????? Excel ? ?? ??????? ????????? ?? ???? ???? ????????.

???? ??????? ?????? ????? ????? ???? multi-sheet ?? XMLSS ??????? ???? ???? ???????? ?? ASP. ?????? ?????? ????? ??? ????? ??? ???? XMLSS ?????? ??? ???? ??? ?? ?? Microsoft Excel.

???????? ????? ASP ?????? XMLSS ???????? ???? ???? ????????

??? ASP ??????? XMLSS.asp ?? ?????? ????? ??????? ????? ???. ???? ???????? ?????? ????? ?? C:\inetpub\wwwroot.
<% Language=VBScript %>

<%
    Response.Buffer = True
    Response.ContentType = "text/xml"

    Dim NumOrders, NumProds, r
    NumOrders = 300
    NumProds = 10
        
    Dim oSS
    Dim oOrdersSheet
    Dim oTotalsSheet
    Dim oRange
    Dim c
    
    Set oSS = CreateObject("OWC10.Spreadsheet")
    Set c = oSS.Constants

    'Rename Sheet1 to "Orders", rename Sheet2 to "Totals" and remove Sheet3
    Set oOrdersSheet = oSS.Worksheets(1)
    oOrdersSheet.Name = "Orders"
    Set oTotalsSheet = oSS.Worksheets(2)
    oTotalsSheet.Name = "Totals"
    oSS.Worksheets(3).Delete
    
    '=== Build the First Worksheet (Orders) ==============================================
        
    'Add headings to A1:F1 of the Orders worksheet and apply formatting
    Set oRange = oOrdersSheet.Range("A1:F1")
    oRange.Value = Array("Order Number", "Product ID", "Quantity", "Price", "Discount", "Total")
    oRange.Font.Bold = True
    oRange.Interior.Color = "Silver"
    oRange.Borders(c.xlEdgeBottom).Weight = c.xlThick
    oRange.HorizontalAlignment = c.xlHAlignCenter
   
    'Apply formatting to the columns
    oOrdersSheet.Range("A:A").ColumnWidth = 20
    oOrdersSheet.Range("B:E").ColumnWidth = 15
    oOrdersSheet.Range("F:F").ColumnWidth = 20
    oOrdersSheet.Range("A2:E" & NumOrders + 1 _
        ).HorizontalAlignment = c.xlHAlignCenter
    oOrdersSheet.Range("D2:D" & NumOrders + 1).NumberFormat = "0.00"
    oOrdersSheet.Range("E2:E" & NumOrders + 1).NumberFormat = "0 % "
    oOrdersSheet.Range("F2:F" & NumOrders + 1).NumberFormat = "$ 0.00" '"_($* #,##0.00_)"
        
    'Obtain the order information for the first five columns in the Orders worksheet
    'and populate the worksheet with that data starting at row 2
    Dim aOrderData
    aOrderData = GetOrderInfo
    oOrdersSheet.Range("A2:E" & NumOrders + 1).Value = aOrderData
    
    'Add a formula to calculate the order total for each row and format the column
    oOrdersSheet.Range("F2:F" & NumOrders + 1).Formula = "=C2*D2*(1-E2)"
        oOrdersSheet.Range("F2:F" & NumOrders + 1).NumberFormat = "_(  $* #,##0.00   _)"

    'Apply a border to the used rows
    oOrdersSheet.UsedRange.Borders(c.xlInsideHorizontal).Weight = c.xlThin
    oOrdersSheet.UsedRange.BorderAround , c.xlThin, 15
    
    'Turn on AutoFilter and display an initial criteria where
    'the Product ID (column 2) is equal to 5
    oOrdersSheet.UsedRange.AutoFilter
    oOrdersSheet.AutoFilter.Filters(2).Criteria.FilterFunction = c.ssFilterFunctionInclude
    oOrdersSheet.AutoFilter.Filters(2).Criteria.Add "5"
    oOrdersSheet.AutoFilter.Apply
    
    'Add a Subtotal at the end of the usedrange
    oOrdersSheet.Range("F" & NumOrders + 3).Formula = "=SUBTOTAL(9, F2:F" & NumOrders + 1 & ")"
    
    'Apply window settings for the Orders worksheet
    oOrdersSheet.Activate   'Makes the Orders sheet active
    oSS.Windows(1).ViewableRange = oOrdersSheet.UsedRange.Address
    oSS.Windows(1).DisplayRowHeadings = False
    oSS.Windows(1).DisplayColumnHeadings = False
    oSS.Windows(1).FreezePanes = True
    oSS.Windows(1).DisplayGridlines = False
    
    '=== Build the Second Worksheet (Totals) ===========================================
    
    'Change the Column headings and hide row headings
    oTotalsSheet.Activate
    oSS.Windows(1).ColumnHeadings(1).Caption = "Product ID"
    oSS.Windows(1).ColumnHeadings(2).Caption = "Total"
    oSS.Windows(1).DisplayRowHeadings = False
    
    'Add the product IDs to column 1
    Dim aProductIDs
    aProductIDs = GetProductIDs
    oTotalsSheet.Range("A1:A" & NumProds).Value = aProductIDs
    oTotalsSheet.Range("A1:A" & NumProds).HorizontalAlignment = c.xlHAlignCenter

    'Add a formula to column 2 that computes totals per product from the Orders Sheet
    oTotalsSheet.Range("B1:B" & NumProds).Formula = _
        "=SUMIF(Orders!B$2:B$" & NumOrders + 1 & ",A1,Orders!F$2:F$" & NumOrders + 1 & ")"
    oTotalsSheet.Range("B1:B" & NumProds).NumberFormat = "_(  $* #,##0.00   _)"

    'Apply window settings for the Totals worksheet
    oSS.Windows(1).ViewableRange = oTotalsSheet.UsedRange.Address
    
    '=== Setup for final presentation ==================================================
    
    oSS.DisplayToolbar = False
    oSS.AutoFit = True
    oOrdersSheet.Activate

    Response.Write oSS.XMLData
    Response.End


Function GetOrderInfo()
    ReDim aOrderInfo(NumOrders,5)
    Dim aPrice, aDisc
    aPrice = Array(10.25, 9.5, 2.34, 6.57, 9.87, 4.55, 6, 13.05, 3.3, 5.5)
    aDisc = Array(0, 0.1, 0.15, 0.2)
    For r = 0 To NumOrders-1
        aOrderInfo(r, 0) = "'" & String(7-Len(CStr(r+1)), "0") & r+1 'Col 1 is Order Number
        aOrderInfo(r, 1) = Int(Rnd() * NumProds) + 1                 'Col 2 is Product ID
        aOrderInfo(r, 2) = Int(Rnd() * 20) + 1                       'Col 3 is Quantity
        aOrderInfo(r, 3) = aPrice(aOrderInfo(r, 1)-1)                'Col 4 is Price
        aOrderInfo(r, 4) = aDisc(Int(Rnd() * 4))                     'Col 5 is Discount
    Next
    GetOrderInfo = aOrderInfo
End Function

Function GetProductIDs()
    ReDim aPIDs(NumProds, 1)
    For r = 0 To NumProds-1
        aPIDs(r, 0) = r+1
    Next
    GetProductIDs = aPIDs
End Function

%>
				

??? XMLSS ??? ???? ???

???? ????? XMLSS ??? ???? ??? ??? ???? ??? ????? ????? XMLURL ?????? ??? "???? ???? ????????" ??? ???? ???? ????????? ?? ASP ? ??? ???:
<html>

<body>

<object classid="clsid:0002E551-0000-0000-C000-000000000046" id="Spreadsheet1">
  <param name="XMLURL" value="http://YourWebServer/xmlss.asp">
</object>

</body>

</html>
				
?????? ??? ??? ?????? Microsoft Office 2003 ? ?? ???? ??? ????? classid ?? ????????? ???????? ????? ??? ???????.

?? ?????? HTML? ??? ????? ????? XMLURL ???????? <param> ???????. ????? ????? ????? ????? XMLURL ????? ??? ??????? ??? ??? ???? ???????? ????????? ???????? ???????.
   Spreadsheet1.XMLURL = "http://YourWebServer/xmlss.asp"
				

??? ?? XMLSS ?? Microsoft Excel

???? ??? XMLSS ???? ?? ?????? ???????? ???? ???? ???????? ?? Microsoft Excel. ???? ?????? ?? ????????? ???????? ????? ?? ???? ???? ???????? ?? Microsoft Excel. ???? ???? ???? ???????? ??? ????? Excel ??. ???????? ??? ???? ???? Excel ??? ????? ?? ???? ???? ????????. ??? ????? ??? ?????? XML ?? ???? ?? ???? Excel ??? ???? ?? XMLSS.

???? ????? ASP ???? ???????? ????? ?? Microsoft Excel? ???? ??????? ???????:
  1. ??? ????? Microsoft Excel.
  2. ?? ??????? ???? ???? ??? ???.
  3. ?? ?????? ??? ????? ? ???? http://YourWebServer/xmlss.asp ??? ?? ???? ??? ???.
??? ?????? ????? ?? ???????? ?????????? ???? ?? ??????? ?? ??? ??????? ???? ???? ?? ?????? ??? ???? ?? Excel. ???? ??????? ????: ???????? ????????? ???????? ???? ?? ??????? ?? ???? ???? ???????? ?? ???? ??? Excel ??? ??? ?? ???? ????? ???? ???? ???????? ???? ?? ???? ??????? Microsoft Excel. ??? ??? ?????? XMLSS ???????? ???? ???? ???????? ?? ??? ??? ????? ?? Excel ???? ??? ??? ????? ?????? ????? ??.

????? ???? ???? XMLSS ????? ASP ?? Microsoft Excel ?? ????? ??? Excel ????? ??????? ?????? ???? ?????? (MIME) ?? ContentType ?? ASP. ??? ??????? ??? MIME Excel ??????? ??? ASP ???? ???? ????? ?? XMLSS ?? Microsoft Excel ?? ??? ?????? ?? ????????. ?????? ????? ???? ??????? ???????:
  1. ???? XMLSS.asp ?? ???? ??.
  2. ????? ????? ?????? ?? ???????? ?????:
    Response.ContentType = "text/xml"
    					
    ????? ????? ?? ????????? ???????? ???? ?? ???:
    Response.ContentType = "application/vnd.ms-excel"
    					
  3. ??? ????????? ??? XMLSS.asp ?? ?? ?????? Windows Internet Explorer.
  4. ?????? ?????? ??? http://YourWebServer/XMLSS.asp. ??? ??? ???? ?????? XML ?? Microsoft Excel ??? ????????? ?? ??? ?????? ?? ????????.

?????

????? ?? ?????????? ?? ?????? ??????? Office Web Components ?? ???? Microsoft ?????? ??? ?????:
http://support.microsoft.com/ofd
????? ?? ?????????? ???? ??? ????? ???????? ??????? ?????? ?? "????? ??????? ?? Microsoft:
285891????? ??????? Visual Basic ?? ASP ?????? ???? ?????? XML ?? Excel 2002 ? Excel 2003
278976????? ??????? XSL ?????? ???? ?????? XML ?? Excel ???? ????????? ?? ???? ??????
257757???????? ??????? ?? ???? ?????? ?? Office

???????

???? ???????: 288130 - ????? ??? ??????: 27/???? ??????/1428 - ??????: 5.2
????? ???
  • Microsoft Office 2003 Web Components
  • Microsoft Office XP Web Components
  • Microsoft Office Excel 2007
  • Microsoft Office Excel 2003
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Active Server Pages 4.0
????? ??????: 
kbmt kbhowto kbofficewebspread KB288130 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????288130

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com