EPPL在VB .net 2013中

时间:2015-04-27 21:24:35

标签: .net vb.net epplus

您是否有一个如何在VB.Net 2013中使用EPPlus的示例?,因为我按照说明编写了一个应用程序并且它不起作用。这是代码:

Imports System Imports System.IO 
Imports officeopenxml 
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            Dim NewFile As FileInfo = New FileInfo(My.Application.Info.DirectoryPath & "\control room abril.xlsx")
            Dim NewTemplate = New FileInfo(My.Application.Info.DirectoryPath & "\control room abril.xlsx")
            Dim XlPackage = New OfficeOpenXml.ExcelPackage(NewFile)
            Dim sheetDatos = XlPackage.Workbook.Worksheets("27 abril")
            Dim archivo As String
            archivo = sheetDatos.Cells(5, 2).Value
            MessageBox.Show(archivo)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

除非文件路径错误或路径正确但没有名为27 abril的工作表

,否则这应该有效