home *** CD-ROM | disk | FTP | other *** search
/ 74.208.221.89 / 74.208.221.89.zip / 74.208.221.89 / manage / importExcelUpload3.aspx < prev    next >
Text File  |  2015-03-13  |  2KB  |  48 lines

  1. <%@ Page Language="VB" Debug="true" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.OleDB" %>
  4. <%@ Import namespace="System.IO" %>
  5. <%@ Import namespace="System.Linq" %>
  6. <%@ Import namespace="DocumentFormat.OpenXml" %>
  7. <%@ Import namespace="DocumentFormat.OpenXml.Packaging" %>
  8. <%@ Import namespace="DocumentFormat.OpenXml.Spreadsheet" %>
  9. <script runat="server">
  10. Dim loc As String
  11. Dim loc1 As String
  12. Dim qr As String
  13. Dim language As String
  14. Dim exclfile As String
  15. Dim exltype As String
  16. Dim fileloc As String
  17.     Dim filename As String
  18.     Dim sqlstr, sqlstr1 As String
  19. Dim mycon As New conValue()
  20. Dim i As Integer
  21. Sub page_load()
  22. loc = Server.MapPath(".")
  23. exclfile = trim(Request.Querystring("filename"))
  24. fileloc = loc & "\" & exclfile
  25. '----------------
  26.  
  27.       
  28.         Using spreadsheetDocument As SpreadsheetDocument = spreadsheetDocument.Open(fileName, False)
  29.             Dim workbookPart As WorkbookPart = spreadsheetDocument.WorkbookPart
  30.             Dim worksheetPart As WorksheetPart = workbookPart.WorksheetParts.First()
  31.  
  32.             Dim reader As OpenXmlReader = OpenXmlReader.Create(worksheetPart)
  33.             Dim text As String
  34.             While reader.Read()
  35.                 If reader.ElementType = GetType(CellValue) Then
  36.                     text = reader.GetText()
  37.                     Response.Write(text & " ")
  38.                 End If
  39.             End While
  40.             'Console.WriteLine()
  41.             ' Console.ReadKey()
  42.         End Using
  43.         
  44.         
  45.         Response.Write("PRODUCTS ADDED SUCCESSFULLY. You can close this window.")
  46. End Sub
  47. </Script>
  48.